Jump to content

Hiding link on specific page


werushka

Recommended Posts

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...

Link to comment
https://forums.phpfreaks.com/topic/98565-hiding-link-on-specific-page/
Share on other sites

<?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>";
}
?>

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 :(

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>";
}
?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.