I found out how to choose which page to use as a frontpage on admin/config/system/site-information. However, I want the frontpage to be special layout. How do I use a special layout for exactly the page I choose to be my frontpage? Thank you in advance!

Comments

ryivhnn’s picture

Make a page-front.tpl.php. Have you read the theming guide?

works at bekandloz | plays at technonaturalist

lsolesen’s picture

I have created page-front.tpl.php. But the only way I can get it to show is:

// page.tpl.php
if ($is_front):
  include('page-front.tpl.php');
  return;
endif;

But I must be doing something wrong then?

wismoyo’s picture

thank you.. it's works fine to me.. :)

lsolesen’s picture

I have read the theming guide - will reread it :) I have done the following:

- created page-front.tpl.php
- I chose one specific node to be the front page

But it is just using page.tpl.php, not page-front.tpl.php. Maybe I am missing something?

lsolesen’s picture

Turned out that in Drupal 7, you need to use page--front.tpl.php. I also tried to edit another content type, but there I could not get page--subject.tpl.php to work. I had to use node--subject.tpl.php.

ryivhnn’s picture

I am so sorry for appearing to abandon you, I find it hard to get on the forums every day. Am glad you worked it out, and sorry for inadvertantly leading you astray with the page--front.tpl.php, probably a combo of habit from D6 and dodgy keyboard :)

Pages are templates for the entire document layout, nodes are to lay out just the content type. Structure wise it goes:

html.tpl.php (contains your doctype, head and opening and closing body tags as well as some code for running and exiting scripts, I also put skipnav up here)
- page.tpl.php | page--type.tpl.php (included by html.tpl.php, layout for the site, use page--type if you want a page like the front to look different)
-- node.tpl.php | node--type.tpl.php (included by page.tpl.php, lays out the content types you make)

Just in the unlikely event you didn't already find it while trawling the docs :)

works at bekandloz | plays at technonaturalist

lsolesen’s picture

Thanks for taking your time to reply :) I am getting the hang of Drupal.

asim.shahzad’s picture

yes using double dash in file name does the trick for me.
So that means in order to override front page template in drupal 7 one needs to use page--front.tpl.php as template or file name.
where as in drupal 6 one need to use page-front.tpl.php as template or file name.

Anonymous’s picture

There's also the Front Page module:

http://drupal.org/project/front

[edit: ah, I see you say 7]

d.sandip59’s picture

i have created a theme and made the following files:-
1.html.tpl.php
2.page.tpl.php
3.page--front.tpl.php

then i have run the home page such as http://www.example.com/, then it calls html.tpl.php page, but it does not call "page--front.tpl.php" nor the "page.tpl.php" page.

So how can i make call the "page--front.tpl.php" page to make a different template page for home page at drupal 7?

ryivhnn’s picture

Stupid questions:

  1. you selected the right theme? :)
  2. do you really need your own html.tpl.php? If not try ditching it and see if using the system one solves anything
  3. if you need your own, does it have $styles and $scripts in the head and $page_top, $page and $page_bottom in the body?

If you add extra tpls you usually have to clear the cache for Drupal to notice them.

works at bekandloz | plays at technonaturalist

dks786’s picture

goto admin/content than
+Add content -> Basic page (create a basic page)
give title and content of that page
in URL path settings set URL alias like front-page
than save.

Now drupal created a page with some title and content and url is yoursitename/front-page

Now go to configuration->site information->FRONT PAGE->Default front page
in text box enter the url alias of your front page for eg. front-page
and Save configuration

Now its your front page ready!