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.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

General Questions /

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

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

control Page by PageType


Go to End


2 Posts   1176 Views

Avatar
cSGermany

Community Member, 37 Posts

17 September 2013 at 10:50pm

Hi there,

I've just upgraded to SS 3.1 RC2

I want to control a Page by it's Pagetype, normally I'm using this snippet for it

	function PageType($class = 'Page') {
		Return DataObject::get_one($class);
	}

<% control PageType(HomePage) %>

But if I use this in the new SS i get the following error after flushing the page

if($caller) {
172 				user_error($caller.' is deprecated.'.($string ? ' '.$string : ''), $level);	
173 			} else {
174 				user_error($string, $level);	
175 			}

can someone tell me how to solve this?

Thx in advance

cSGermany

Avatar
cSGermany

Community Member, 37 Posts

18 September 2013 at 5:59pm

to answer my own (silly) question.
I just need to use a loop instead of control