Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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