Hiding the link with php code

werushka - March 30, 2008 - 03:52

Hi!
I have a code in page.tpl.php

<div id='primary-links' class='clear-block'>
        <?php
echo l('Create Story !', "node/add/story", false, "destination=node/add/story");
?>

      </div>

I would like to edit the code that if the user is on "node/add/story" that total code is ignored so no div class or the code is visible to the browser?
I am kind of noob in php I would really appreciate any help

The simplest solution would

efolia - March 30, 2008 - 04:27

The simplest solution would be to wrap that output in a conditional statement.

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

Cheers :-)

efolia

Sweet :) efolia thanks a lot

werushka - March 30, 2008 - 04:33

Sweet :) efolia
thanks a lot

 
 

Drupal is a registered trademark of Dries Buytaert.