werushka Posted March 30, 2008 Share Posted March 30, 2008 Hi folks, I have the following code <div id='primary-links' class='clear-block'> <?php echo l('Duyuru Yap !', "node/add/story", false, "destination=node/add/story"); ?> </div> it works perfectly but I want to add an option to the code that if the user is on this page "node/add/story" the whole code above including the div tag is not displayed. I would really appreciate any help... Quote Link to comment https://forums.phpfreaks.com/topic/98565-hiding-link-on-specific-page/ Share on other sites More sharing options...
MadTechie Posted March 30, 2008 Share Posted March 30, 2008 <?php $page = $_GET['page'];; //or however you identify the page! if( ($page != "node" && $page != "add" && $page != "story") ) { echo "<div id='primary-links' class='clear-block'>"; echo ('Duyuru Yap !', "node/add/story", false, "destination=node/add/story"); echo "</div>"; } ?> Quote Link to comment https://forums.phpfreaks.com/topic/98565-hiding-link-on-specific-page/#findComment-504461 Share on other sites More sharing options...
werushka Posted March 30, 2008 Author Share Posted March 30, 2008 Thank you very much for your reply, the code is for page.tpl.php file the example code is like below <?php if($search_box) { ?> <div id='search-box'> <?php print $search_box ?> </div> <?php } ?> </div> the code above works but the code you provided doesnt seem to work, I am kind of noob in php Quote Link to comment https://forums.phpfreaks.com/topic/98565-hiding-link-on-specific-page/#findComment-504466 Share on other sites More sharing options...
MadTechie Posted March 30, 2008 Share Posted March 30, 2008 if the user is on this page "node/add/story" How do you know the page name ? do you have something like ?page=add in the url ? without more detail its hard to say! Quote Link to comment https://forums.phpfreaks.com/topic/98565-hiding-link-on-specific-page/#findComment-504468 Share on other sites More sharing options...
werushka Posted March 30, 2008 Author Share Posted March 30, 2008 yes i have it on the address bar when I am on that page, I have clean urls. Quote Link to comment https://forums.phpfreaks.com/topic/98565-hiding-link-on-specific-page/#findComment-504478 Share on other sites More sharing options...
MadTechie Posted March 30, 2008 Share Posted March 30, 2008 on the address bar does it say page=add on the add page ? if not what exactly does it say ? its case sensitive Quote Link to comment https://forums.phpfreaks.com/topic/98565-hiding-link-on-specific-page/#findComment-504484 Share on other sites More sharing options...
werushka Posted March 30, 2008 Author Share Posted March 30, 2008 They helped me in another forum the below code works <?php if (!(arg(0) == 'node' && arg(1) == 'add' && arg(2) == 'story')) { print "<div id='primary-links' class='clear-block'>". l('Create Story !', "node/add/story", false, "destination=node/add/story") ."</div>"; } ?> Quote Link to comment https://forums.phpfreaks.com/topic/98565-hiding-link-on-specific-page/#findComment-504489 Share on other sites More sharing options...
keeB Posted March 30, 2008 Share Posted March 30, 2008 That's like.. the same code ;x Quote Link to comment https://forums.phpfreaks.com/topic/98565-hiding-link-on-specific-page/#findComment-504499 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.