21489 Posts in 5783 Topics by 2622 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 173 Views |
-
Calling a "command" from within the page content?

9 March 2013 at 4:09am Last edited: 9 March 2013 4:09am
Hi all!
How would I go about calling a command (tag?) from within the WYSIWYG editor, in order to place a CMS menu within the page content. EG, in the way that placing "$UserDefinedForm" within the page content editor places the form where you want it to go, and lets you have text above and below it?
I have a menu within the template that currently sits below the $Content tag, but i'd like to be able to call it from within the actual content so that I can decide precisely where it goes, eg something like:
-----
This is my headingSome content
$CallMenu
Some more content
-----Hope this makes sense - struggling to explain it!
Cheers, L x
-
Re: Calling a "command" from within the page content?

9 March 2013 at 12:00pm
Userforms does a basic str_replace on the content (https://github.com/silverstripe/silverstripe-userforms/blob/master/code/model/UserDefinedForm.php#L385) but a better method would be to use ShortCodes.
http://www.ssbits.com/tutorials/2010/2-4-using-short-codes-to-embed-a-youtube-video/
-
Re: Calling a "command" from within the page content?

9 March 2013 at 12:29pm
Brilliant thanks Will! I just didn't know what terms to search for to find this info. Short codes will do exactly what I need, but the str_replace is good to be aware of too. Cheers
| 173 Views | ||
|
Page:
1
|
Go to Top |


