0
votes

I'm a WordPress developer who's been tasked to create a temporary one-pager to a Drupal site. The client would like to have a simple front page with a logo and 4 external links until their new site is ready. Normally I'd just make a simple index.html page with some CSS and call it a day. But in this case they need some of the sub-pages from the Drupal site to continue to work.

Had it been a WordPress site, I would have just created a new template file and a new page inside WordPress, and made that the front page. But as I have zero experience with Drupal, I don't know if you can do the same thing here.

What is the easiest (quickest) way to make a simple splash-page as the front page, while having the rest of the drupal site continue to work? The splash-page should ignore all CSS and JS from the original theme — preferably have a completely independant section fromt the rest of the site.

2
Another helpful trick would be to enable the "theme_debug" settings. It creates a Html comment showing from which file the "section" is generated from and also what other overrides to the template files are available. This can be totally changed/manipulated on theme_preprocess functions by altering theme_hook_suggestions. To enable that settings, go to drupal_project_folder/sites/default/settings.php and set $conf['theme_debug'] = TRUE;Sanjok Gurung

2 Answers

1
votes

In Drupal 7 you have few "levels" of templates. First you have "most outer" template html.tpl.php It contains html head and it is usually common for all pages.

Then inside that html.tpl.php you'll include page.tpl.php. That one should again contain some common page elements, as header and footer, but again, if your design requires that, you can have more than one page template.

Page template will include node template. In drupal you have 2 basic content (node) types but you can create many more of them. Basically for every different page layout you can create new content type (but there also are lot of different ways to achieve the same thing).

Basically you should create new content type called i.e. "splash" (machine name!). Add fields to it if they need to be back-end editable.

Then you should create new template file for your content type. Name matters, so you should call it node--splash.tpl.php . You can find and copy to your theme existing node.tpl.php and change it to your needs.

Keep in mind that when ever you add/remove new template file you have to clear the cache so drupal would scan theme directory, notice and start using new templates.

And if you need also different page template for you page you'll have to put some code into you tamplate.php file:

https://www.digett.com/insights/overriding-page-templates-content-type-drupal-7

0
votes

Drupal template engine design an specific file name for override front page.

You can create the file html--front.tpl.php, and this will be used only for the front page without touch any other page. You can page here your custom HTML and reference css/js.

If the page you need share common styles with the rest of the site, I would recommend to instead override page--front.tpl.php which is basically the content of the page without the tags

For more information here is a link https://www.drupal.org/docs/7/theming/howto/customize-the-front-page-template