Jump to:

3444 Posts in 1030 Topics by 871 members

Template Questions

SilverStripe Forums » Template Questions » I don't understand "control ChildrenOf(page-url)"

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

Page: 1
Go to End
Author Topic: 1153 Views
  • suntrop
    Avatar
    Community Member
    131 Posts

    I don't understand "control ChildrenOf(page-url)" Link to this post

    I want to display all product categories on my homepage (every category has its own thumbnail, that I want to display within a jQuery image scroller).

    I think the …

    <% control ChildrenOf(page-url) %>


    … is the right function for that. But I don't know how to use it. This topic http://silverstripe.org/template-questions/show/9008 couldn't help.

    What exactly do I have to enter for page-url? The web URI? The page type? Something else?

    My site looks like this …
    - Home
    - Products
    -- A
    --- First product in category A
    --- Second product in category A
    -- B
    --- First product in category B
    --- Second product in category B
    -- C
    --- First product in category C
    --- Second product in category C
    - About us
    - Contact

    I'd like to display thumbnail for category A, B and C. But how?

    Hope someone can help.
    Thanks
    suntrop

  • Willr
    Avatar
    Forum Moderator
    5502 Posts

    Re: I don't understand "control ChildrenOf(page-url)" Link to this post

    What exactly do I have to enter for page-url? The web URI? The page type? Something else?

    Perhaps page-url is a bad word, should be URLSegment. You pass in the URLSegment (viewable under each pages meta-data tab) that you want to control over. If your Products page has the URL Segment of "products" then you would use <% control ChildrenOf(products) %> if you want to use page type or classname you can write your own php method for that.

  • suntrop
    Avatar
    Community Member
    131 Posts

    Re: I don't understand "control ChildrenOf(page-url)" Link to this post

    Thanks for your help, Willr.

    The URL segment is products and I wrote …

    <% control ChildrenOf(products) %>
    <a href="$Link">$MenuTitle</a>
    <% end_control %>

    … just to test (with ?flush=1). But nothing happens. How do I access titles, links and the thumbnails?

  • Willr
    Avatar
    Forum Moderator
    5502 Posts

    Re: I don't understand "control ChildrenOf(page-url)" Link to this post

    That should return a list of 'A','B','C' in your example. Check you have enabled 'Show In Menus' for those A,B,C pages and also check that the url segment is 'products'

  • suntrop
    Avatar
    Community Member
    131 Posts

    Re: I don't understand "control ChildrenOf(page-url)" Link to this post

    Many many thanks for your help!

    I didn't checked "Show in Menus".

    Is there any difference to the way of getting the products like some blog news (like in tutorial 2 extending a basic site)?

    1153 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.