Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

Customising the CMS /

Footer Page Customization


Reply


2 Posts   1295 Views

Avatar
dennis@fruchtman

Community Member, 1 Post

27 February 2010 at 5:50am

I have a client who already has silverstripe installed and functioning properly (2.3.1). However, the "Footer Content"" page is set up in a very specific, almost too easy to use, manner. There are sections for page name, address1, address2, google maps link, store hours, copyright, and google analytics.

I need to drop an image into the footer, but the way its currently setup wont allow for any html, or images to be placed there. What can I do to manipulate the footer to allow for images to be placed in? Any help is appreciated, thanks

Dennis@fruchtman.com

Avatar
theAlien

Community Member, 131 Posts

1 March 2010 at 2:56am

Edited: 01/03/2010 2:56am

Hi,
You have a few options, in all options you have to modify FooterContent.php, and in some cases also FooterContent.ss.
The options:
1) Set the [url=http://doc.silverstripe.org/doku.php?id=data-types]datatype[/url] of one of the datafields to HTMLText or HTMLVarchar(255) (fx address1 => Text, becomes address1 => Varchar(255) ), so you can add HTML to the address1-field. If you like you can also change the addressfield to HTMLEditorField or TextareaField (instead of TextField).
2) Add an Image datafield to the database:

class FooterContent extends Page{
...
static $has_one = array (
myimage => image
);
...


And now: read up on [url=http://doc.silverstripe.org/doku.php?id=imagefield]ImageField[/url], or [url=http://doc.silverstripe.org/doku.php?id=simpleimagefield]SimpleImageField[/url]. You might also want to read up on [url=http://doc.silverstripe.org/doku.php?id=image]images[/url], [url=http://doc.silverstripe.org/doku.php?id=recipes:imageupload]image uploading[/url] and [url=http://doc.silverstripe.org/doku.php?id=form-field-types]formfieldtypes[/url] for more advanced AND general information.
3) Create a new databasefield of the type HTMLText or HTMLVarchar(255). Create a new [url=http://doc.silverstripe.org/doku.php?id=textareafield]TextareaField[/url] FieldType to be able add any HTMLblock to your footer.

If you created new datafields&formfields (as in 2 and 3), of course you also have to modify your template-file (.ss), otherwise the new info wouldn't show up.

Good luck

BTW maybe the person who set up your database already set some of those fields to HTMLText or HTMLVarchar. Just try it out...