Hello,
In Page.php :
<?php
class Page extends SiteTree {
...
public static $has_many = array(
'Chapters' => 'Chapter'
);
...
In Chapter.php :
<?php
class Chapter extends DataObject {
...
public static $db = array(
'Title' => 'Text',
'Content' => 'Text'
);
public static $has_one = array(
'Photo' => 'Image',
'MyPage' => 'Page'
);
...
In templates/Includes/Chapter.ss :
<% control Chapters %>
<h2>$Title</h2>
<img <% control Photo %><% control SetWidth(440) %>src="$URL" height="$height" width="$width"<% end_control %><% end_control %> alt="$Title" />
<p>$Content</p>
<% end_control %>
I would like to enable my client to include the Chapter.ss template wherever he wants in the content editor with a short code (http://www.silverstripe.org/form-questions/show/14225 - http://www.silverstripe.org/general-questions/show/12609).
But I have no idea of what to put in my "shortcodehandler" function in Page.php.
Could anyone give me a hint ? Thank you !
Stan