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.


Our old forums are still available as a read-only archive.

Moderators: martimiz, Sean, biapar, Willr, Ingo, simon_w

Side Content

Go to End

9 Posts   3099 Views


15 October 2007 at 8:19pm 31 Posts


I've created a web page that has both main content and side content.

I was wondering how to best implement this in CMS.

Many thanks.


15 October 2007 at 8:38pm 53 Posts

What is it that you wish to show in the side content is it mainly for navigation to other areas of the site?


15 October 2007 at 8:51pm 31 Posts

Hi Trevor,

Thanks for the quick response.

No, not navigation, just extra content. For example, I created a contact page in which the main area is a contact form and the right-side area has address, phone and email information, among other things (a 3 column layout).



15 October 2007 at 9:22pm 53 Posts

Ok so in the normal template this outputs $Content which is the field in the database that stores the main content so what you will need to do is either add a sidecontent field to your page type or the individual fields for address, email, phone etc. and then create a template for your page type and output the fields.

Its simpler to just have a template under the layout folder which is the same name as your page type providing this fits with what you want to do. I only say this because I made a mistake of creating an additional template for each page type which in certain instances was not necessary.




15 October 2007 at 9:55pm 31 Posts

Hi Trevor,

First off, I just want to thank you for the help you're providing.

I think I'm pretty good with the template aspect, I guess I was more curious as how to implement this in the CMS. For example, would I need to create a 'SideContent' pagetype that would we accessible to each 'Parent' pagetype that I designate as 3 columns? What I mean is, would I create a pageholder pagetype, let's say called 3ColHolder.php, then create a 3ColPage pagetype (3ColPage.php) that is a child to the pageholder?

Am I making this too complicated?




15 October 2007 at 10:49pm 53 Posts

No Problem, I have received help from others and so if I can then pass on that help this is what hopefully will help the community.

Also if I see what others a trying to do it helps see other possibilities so indirectly this helps me too.

You could do what you are saying and then in the template for the 3colholder access the 3colpage(s) and display this in the side. this will mean you won't need to add any additional db fields as you will just use the $Content from the 3colpage entries created. So in the cms you would create a 3colholder and then underneath create 3colpage or pages.

You could just have one include file that did this iterating the Children of the page to display in the side column and use this in whichever pagetype you require.

I hope I'm helping here maybe if you look at the way the menus work in the example system then this will clarify how to do it. It all depends on what you are trying to achieve for the content.




16 October 2007 at 12:28am Community Member, 501 Posts

I'd do it like this:

in the Page class I would do

static $db = array(
   "SideContent" => "Text"
function getCMSFields()
      $fields = parent::getCMSFields();
      $fields->addFieldToTab('Root.Content.Side', new HtmlEditorField(SideContent', 'Side Content'));
      return $fields;

And there you have it.


16 October 2007 at 11:25am 31 Posts

Hi Trevor, Dio5,

Thanks for the info. Dio5, the information you provided worked like a charm. I thank you both for your time and effort.


Go to Top