21310 Posts in 5739 Topics by 2604 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 314 Views |
-
get Image from another page type

14 November 2011 at 12:23pm
I hve got a PageType with an Image.
class News extends Page{
static $has_one = array(
'BannerImage' => 'Image'
);}
My news page has multiple children:
class ArticleCategory extends Page{
static $has_one = array(
'BannerImage'=>'Image'
}Now I want that all ArticleCategorys have the same BannerImage as News.
-
Re: get Image from another page type

14 November 2011 at 1:04pm
ok, i dont 100% understand what you need to be done, but i think you trying to pull the image from "News" page to display on the "ArticleCarigory" ?! if this is it, Do the following:
in the Articlegatigory.SS add this: <% control children %> $BannerImage <% end_control %> << this will take the image from the childrent pages & list them on the Articlegatigory.SS page .
.................
If you trying to do something different, please explain more below ;)
good luck -
Re: get Image from another page type

14 November 2011 at 1:12pm
Yes thats what I want. But I think I should have explain more in detail. News is the parent and the ArticleCategorys are the children. However you give me the hint to the solution. I used <% control parent %> $BannerImage <% end_control %>
I was pretty sure that it won't be something too complicated. But I haven't expected that it would be that easy. Thanks!
-
Re: get Image from another page type

14 November 2011 at 1:21pm
kk nice, also, from the 1st time istarted SS, i have started collection some samples & code that i use alot, here is the link..
http://www.sspaste.com/paste/show/4ebe879fe1f63It is not that something big, but it save me having to search for small codes all the time..
If you want,
.. one more, use the live chat http://irc.silverstripe.org/cgi-bin/irc.cgi as i am there 24/7 for the next few weeks (if no one replay to You( afk) , then come back to forums of course ) -
Re: get Image from another page type

15 November 2011 at 8:52am
Wow that's quiet a helpful site. Thanks a lot
| 314 Views | ||
|
Page:
1
|
Go to Top |


