21286 Posts in 5733 Topics by 2602 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 354 Views |
-
How to create a full homepages as demo

19 March 2011 at 9:04am
Hello,
My question is:
How to create homepages (as in the demo):
- Content
- Left box text
- Left Image
- Middle text box
- Middle Image
- Right text box
- Image RightThank you again
Sincerely,
-
Re: How to create a full homepages as demo

19 March 2011 at 6:11pm
Have a read of tutorial 2. This covers how to add fields to pages. In the case of the demo it looks something like
<?php
class HomePage extends Page {
static $db = array(
"LeftBoxTxt" => "HTMLText",
"MiddleBoxTxt" => "HTMLText",
"RightBoxTxt" => "HTMLText"
);static $has_one = array(
'LeftBoxImg' => 'Image',
'MiddleBoxImg' => 'Image',
'RightBoxImg' => 'Image'
);
function getCMSFields() {
$fields = parent::getCMSFields();
$fields->addFieldToTab("Root.Content.Main", new HTMLEditorField("LeftBoxTxt","Left box text"));
$fields->addFieldToTab("Root.Content.Main", new ImageField('LeftBoxImg', 'Left Image'));
$fields->addFieldToTab("Root.Content.Main", new HTMLEditorField('MiddleBoxTxt','Middle box text'));
$fields->addFieldToTab("Root.Content.Main", new ImageField('MiddleBoxImg', 'Middle Image'));
$fields->addFieldToTab("Root.Content.Main", new HTMLEditorField('RightBoxTxt','Right box text'));
$fields->addFieldToTab("Root.Content.Main", new ImageField('RightBoxImg', 'Right Image'));
return $fields;
}
}class HomePage_Controller extends Page_Controller {
}
But I recommend reading the 2nd SilverStripe tutorial (http://doc.silverstripe.org/sapphire/en/tutorials/2-extending-a-basic-site) to get to grips with what that code does.
| 354 Views | ||
|
Page:
1
|
Go to Top |


