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, biapar, Willr, Ingo, swaiba, simon_w

If else ?


Reply


3 Posts   1716 Views

Avatar
mommek

Community Member, 9 Posts

20 July 2010 at 3:45am

Hi,

I need do this:

<?php

if ($_GET['page'] == 'news')
{
do nothink
}
else{
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..

Avatar
Willr

Forum Moderator, 5513 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 %>

Avatar
mommek

Community Member, 9 Posts

21 July 2010 at 2:09am

thx a lot, I solve this problem with:

<% if Pos != 2 %>