21278 Posts in 5728 Topics by 2599 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 2553 Views |
-
If Page Type?

17 April 2009 at 1:29am Last edited: 17 April 2009 1:59am
Hi
I have the following code that displays all children:
<% control Children %>
How do I limit this to a certain page type?For instance "NewPageType"
Tried this and It did not work <% if NewPageType %>Thanks
-
Re: If Page Type?

17 April 2009 at 2:14am
Hi.
Have a look at this:
<% control ChildrenOf(page-url) %>
This will create a datafeed of the children of the given page. Handy if you want a list of the subpages under staff (eg the staff) on the homepage etc
<% control Page(my-page) %>$Title<% end_control %>
“Page†will return a single page from the site tree, looking it up by URL. You can use it in the <% control %> format. Can’t be called using $Page(my-page).Title.
Taken from here: http://doc.silverstripe.org/doku.php?id=built-in-page-controls
Cheers,
Christian -
Re: If Page Type?

17 April 2009 at 2:22am Last edited: 17 April 2009 2:37am
Thanks,
Unfortunatly it did not work for me I put in
<% control Children(NewPage Type) %>
and it did not restrict the other pages.Any other ideas?
Gareth
-
Re: If Page Type?

17 April 2009 at 4:43am
I dont understand how to use this.
Can you interpret this in the context of NewPageType
I dont understand how classtype fits inThanks
-
Re: If Page Type?

17 April 2009 at 5:56pm
corkg, I havent tested this, but in your case, it should be:
<% if ClassName = NewPageType %>
<% control Children %>
...
<% end_control %>
<% end_if %>
| 2553 Views | ||
|
Page:
1
|
Go to Top |



