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.

General Questions

General questions about getting started with SilverStripe that don't fit in any of the categories above.

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

Re-Using content of a field added to a page type


Reply

4 Posts   829 Views

Avatar
designerdre

21 March 2009 at 1:37am Community Member, 19 Posts

In another CMS that I use it's possible to request the content of a field on a page. For example, if I had a quote of the day field on the homepage, in another template If I wanted that quote to show up as well I could just refer to the quote field of the homepage. What's the best way to handle this type of content re-use in SilverStripe?

Avatar
Fuzz10

21 March 2009 at 1:48am Community Member, 787 Posts

Yes you can .... ;)

Have a look at this page :
http://doc.silverstripe.com/doku.php?id=built-in-page-controls&s=page%20controls

You can do something like :

<% control Page('URLSegment') %>
$YourField
<% end_control %>

Avatar
designerdre

22 March 2009 at 5:44pm Community Member, 19 Posts

Hey thanks a lot for this valuable info! It looks like exactly what I need. I'll go study up on it.Have a good one!

Avatar
biapar

4 September 2009 at 12:14am Forum Moderator, 435 Posts

For example:

<% control Page(home) %>
<ul id="portfolio">
<li>
<img src="$BannerImage1.PageBanner.URL" alt="Header Image" />
</li>

</ul>
<% end_control %>

In other page, you use Image data of "home" page.