3212 Posts in 847 Topics by 809 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 834 Views |
-
Page Specific Templates

27 March 2010 at 10:16am
Hi All,
I know that this is probably simple to accomplish but the answer is eluding me. How do I create a template that will only be applied to a couple of pages? I'd like for the site to have a couple pages with nothing but an image, no header, no logo, no navigation menu, just an image. I'm having a hard time figuring out how to accomplish this.Thanks,
Chris -
Re: Page Specific Templates

27 March 2010 at 3:38pm
Well the easiest way is to just make new page types. So the pages which have different layouts would be a different page type to the others. Tutorial 2 covers making new page types.
If you don't want to make separate page types for the layouts you could do something like have a dropdown field on the page in the cms where the user can choose the page template.
<?php
class Page extends SiteTree {
static $db = array(
'Template' => "Enum('One, Two, Three', 'One')"
);function getCMSFields() {
$fields = parent::getCMSFields();
$fields->addFieldToTab('Root.Content.Template', new DropdownField('Template', 'Template', $this->dbObject('Template')->enumValues());return $fields;
}That will put the template option in the cms. then in the function init() in that same file you can use $this->renderWith($this->Template) to implement a custom template. Making separate page types is easier.
| 834 Views | ||
|
Page:
1
|
Go to Top |


