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.

Themes /

Discuss SilverStripe Themes.

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

If else ?

Go to End

3 Posts   1986 Views


Community Member, 9 Posts

20 July 2010 at 3:45am


I need do this:


if ($_GET['page'] == 'news')
do nothink
generate submenu



I have 5 main pages -> 2 of them have submenu ... I want show only 1 of them submenu.. second -> I dont wanna generate in html submenu.

I know, that it is possible turn-off in admin (show in menus - on/off) but I can't change this..


Forum Moderator, 5521 Posts

20 July 2010 at 1:16pm

Do you need to do this in the template? or in the cms?. In the front end you need to write a function which detects the get var (are you sure you want to use get and not the URLParams ?) so in Page.php something like

function IsNews() {
return isset($_GET['news']);

Then in the template you can do <% if IsNews %> ... <% else %>... <% end_if %>


Community Member, 9 Posts

21 July 2010 at 2:09am

thx a lot, I solve this problem with:

<% if Pos != 2 %>