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 /

How to call or include stuff from content


Reply


3 Posts   1079 Views

Avatar
senica

Community Member, 18 Posts

20 June 2010 at 8:06am

I'm trying to come from ModX over to SilverStipe, thinking there is more flexibility. There seems to be some limitations that are quite frustrating to me.

I understand the concept of MVC, so please don't post back saying this shouldn't be allowed.

From within the admin...let's say I am editing the Home page's content. How could I include another page directly from here. I know I can do it from within the templates, but I build pages for clients, and a large majority of clients don't need to know HTML if they are using a CMS.

Secondly, is it possible to call something like :<% control MyLinkedImage %><a href="$URL">$Image</a><% end_control %> from the content section of the HomePage? Again using the CMS?

I'm basically trying to find an easy way that my clients could include something or use controls that I've made for them without having to open a php or ss file.

Thanks.

Avatar
Willr

Forum Moderator, 5513 Posts

20 June 2010 at 12:05pm

Hi Senica,

I think you may want to look at creating short codes to embed functionality in the cms

http://doc.silverstripe.org/shortcodes
http://ssbits.com/2-4-using-short-codes-to-embed-a-youtube-video/

You can't include <% %> tags directly in content as the template parser doesn't also parse the database fields so the best way to include tokenized functionality it to use short codes. One limitation of the shortcodes is there is no way of showing all shortcodes in the CMS for a user so I normally also include a LiteralField before the Content which lists all the available codes.

Avatar
senica

Community Member, 18 Posts

20 June 2010 at 1:36pm

Willr, Thanks! Yeah, this will work out nicely!