By andyau on
Right so this may be straight forward but
Is it possible to use a theme with multiple page layout styles?
Cheers
Andy
Right so this may be straight forward but
Is it possible to use a theme with multiple page layout styles?
Cheers
Andy
Comments
Simple answwer is yes
But the details of what you want to do will determine the how to do and how easy (or hard).
Two content types
It's so you can one layout for the product pages and another layout for the say news or straight text pages.
Custom node?
I think what you want is one theme and a standard layout for most sorts of page. Then a new node-type for the product pages. You would then create a node-product.tpl.php for the layout of these pages. There are ways to show/hide other blocks on these pages too.
HTH
It depends on how different you want them
There is over all page layout which by default is controlled by page.tpl.php which can have variations applied.
There is the layout of the content area and focusing on your need this is controlled by node.tpl.php or a variation of it (you can easily make a type specific version as pointed out above).
And as mentioned above, you can control the visiblity of the blocks
Thanks for posting this!
Thanks for posting this question and for posting answers to it! I had the same question. :-)
Linking to the the two templates from the menu
So is it then possible to select which template you would like to use when creating a new content page?
Yes, two ways;-
If you mean choosing
node-product.tpl.phpornode.tpl.php (default)then you choose by creating a node with the appropriate content type.If you mean choosing the whole style of the page (not just the layout), then http://drupal.org/project/taxonomy_theme could be the answer, just add the appropriate term from a vocabulary and it will be themed accordingly (you will need more than one theme).
Regarding theming the whole page
Regarding theming the whole page, there are alternatives to using the taxonomy theme module since you can have multiple page.tpl.php files (with different names of course). Details depend on what determines which template is to be used.
Yes, my reply was rather confusing…
I was referring to the whole style, rather than the whole page.
If you want your choice to be based on content type you can use this to determine the
node[-*].tpl.phpandpage[-*].tpl.phpfiles, as nevets says. These control the layout of the page. See http://drupal.org/phptemplate .If you want to make your choice based on independent criteria, then http://drupal.org/project/taxonomy_theme can do this, but it selects a completely separate theme (.css etc.) ie. style as well, not just the layout (*.tpl.php), to which the first technique is limited.
Very easy to do this
I solved this problem simply by giving a different name to the .tpl file, as so:
page.tpl.php - main page
page-contact.tpl.php - contact page
page-portfolio.tpl.php - portofolio page
page-about.tpl.php - About page
Each has it's own layout, but uses the same CSS file. Your page alias's would be contact, portfolio. This means you need friendly URL's. Or you could always do something like page-node-4.tpl.php Drupal version for the site I use this for was 4.3. I'm not an expert on how it works, but it's a function of the template engine.