3212 Posts in 847 Topics by 809 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 1001 Views |
-
creating new custom variable to make more admin editable text

1 May 2010 at 12:28am
Possibly a very simple question:
I'm building my very first SilverStripe website. I'm using the default "BlackCandy" as my starting point and slowly converting the graphics and CSS to our design.
The "BlackCandy" template(s) have the "Your Site Name" and "your site's tagline here" elements within the main Page.ss file. That's fine for static content pulling information solely from that .ss file. But let's say that the site's "tagline" is something that changes quite frequently and it would be best/easiest if that was an editable text area within the CMSs Admin area.
I can see the $Content variable within the Page.ss file (which obviously pulls text from the "Content" area of the database... but I can't see how to make another area similar to $Content.
The SilverStripe online demo has a homepage has 7 separate "content" areas - "Content", "LeftBoxText", "LeftImage", "MiddleBoxText", "MiddleImage", "RightBoxText" and "RightImage".
If I wanted a "LeftBoxText" variable - how would I go about making it? I assume that it's custom made for the demo...?
I've seen something about having to add something to the Page.php file (in MySite) along the lines of:
static $db = array(
'Date' => 'Date',
'Author' => 'Text'But i'm obviously not doing something right as that's not working for me.
Any help/advice greatly received.
Regards,
Martin. -
Re: creating new custom variable to make more admin editable text

1 May 2010 at 10:04pm
Have a read of tutorial 2 for how to add fields to the CMS. In 2.4 the Site Title and the Site Tagline are in the CMS on the SiteConfig panel so you don't need to edit the templates to change it.
-
Re: creating new custom variable to make more admin editable text

4 May 2010 at 7:35pm
Hi,
Thanks for the reply.
I'm currently using v2.3.7 (isn't 2.4 still in beta? Can't really use a beta for a "real" job for a client).
I have read through tutorial and I'm not sure I fully understand (more my lack of coding knowledge than any suggestion the tutorial is poor).
I'm hoping someone would treat me like a REAL amateur at this and give me a simple point-by-point example of creating a custom variable. I'm sure once I've done one (and it works) producing any more after that will be easy.
Cheers,
m.
| 1001 Views | ||
|
Page:
1
|
Go to Top |


