How to place content into a sidebar

Talk about writing modules and plugins for CMS Made Simple, or about specific core functionality. This board is for PHP programmers that are contributing to CMSMS not for site developers
Locked
epo
Forum Members
Forum Members
Posts: 12
Joined: Mon Jun 09, 2008 9:00 am

How to place content into a sidebar

Post by epo »

OK, first post be kind. I am trying my first site with CMSMS - having a reasonable amount of experience with the MODx CMS - and have run into a newbie problem. I have tried looking at the documentation but could easily have missed something so if there is a TFM I would appreciate a pointer so I could RTFM and be enlightened in the "CMSMS way".

I am trying to port a 2 column design to CMSMS, content defined in the Page menu gets inserted via a {content} tag and all is OK. However I am baffled by the sidebar content. The templates I have looked at seem to have the sidebar in the main template so that all pages using that template get the same sidebar content - and to change the sidebar text one edits the template.

In my case the home page (it is for a management trainer) might have testimonials and upcoming events on the home page sidebar and course-specific supplementary details on other page sidebars (e.g. prerequisites). Now I could imagine having a set of different templates, one for each type of sidebar but what about pages sharing the same type of sidebar but with different content? My reading so far seems to imply there is one template per page and that users edit the page to change the content and edit the template to change the sidebar which seems wrong.

What I am imagining is some kind of page-specific {sidebar} tag which I can edit to populate the side bar for a given page thus having the ability to change the look of a page by swapping templates but retaining the main and sidebar content as-is.

I think my question comes down to this: How do I define sidebar content per page without entering the sidebar content in the template and thus having one template per page.

Ed
RonnyK
Support Guru
Support Guru
Posts: 4962
Joined: Wed Oct 25, 2006 8:29 pm
Location: Raalte, the Netherlands

Re: How to place content into a sidebar

Post by RonnyK »

Ed,

welcome.....

You can put multiple content-blocks in the template. Check the Extensions -> Tags -> Content for the help and the logic....
When you put that 2nd block in the template, another edit-area will show as well, during the adding/editing of a page...

Ronny
epo
Forum Members
Forum Members
Posts: 12
Joined: Mon Jun 09, 2008 9:00 am

Re: How to place content into a sidebar

Post by epo »

Thanks Ronny,

Simple when you know where to look?

My sidebar content consists of a heading and lots of other content, is it possible to provide default or initial content for these content blocks? I notice that in "Page Defaults" there are defaults for metadata and content, is it possible to add a default editor for my sidebar content block?
Pierre M.

Re: How to place content into a sidebar

Post by Pierre M. »

Hello,

may be Smarty can do things like {content|default:' '}
or "capture" the content to "thec" and use {$thec|default:' '}

see "assign" and "capture" in other posts (you can search with Google +site parameter)

Pierre M.
epo
Forum Members
Forum Members
Posts: 12
Joined: Mon Jun 09, 2008 9:00 am

Re: How to place content into a sidebar

Post by epo »

Pierre M. wrote: may be Smarty can do things like {content|default:' '}
or "capture" the content to "thec" and use {$thec|default:' '}
Hi Pierre

Thanks, haven't yet looked at capture but the default: mechanism seems to be a display-only trick, i,e, if content not defined display this instead.

What I had in mind was the initial content for a side bar, e.g. Header goes hereContent here etc which would show up in the editor so that if the side bar was empty then the default text would show otherwise the user edited content would show up. This is how I'd imagine the page default content mechanism works.

Still plugging away, oh liking CMSMS by the way.
User avatar
Nullig
Power Poster
Power Poster
Posts: 2380
Joined: Fri Feb 02, 2007 4:31 pm
Location: Comox Valley, BC

Re: How to place content into a sidebar

Post by Nullig »

You could write a UDT that is attached to the ContentEditPost event that looks to see if the sidebar content block has any text and, if not, provide some default text.

Nullig
epo
Forum Members
Forum Members
Posts: 12
Joined: Mon Jun 09, 2008 9:00 am

Re: How to place content into a sidebar

Post by epo »

Nullig wrote: You could write a UDT that is attached to the ContentEditPost event that looks to see if the sidebar content block has any text and, if not, provide some default text.

Nullig
Don't know what a UDT is - something else to learn - sigh! :-) -

I 've just noticed that this thread "Site Admin > Page Defaults > Content :: Define Template-specific Default Content" in product support discusses essentially the same topic, so have started adding my comments to that topic.

Thanks

Ed
Locked

Return to “Developers Discussion”