By ambientdrup on
I have the following PHP line(s) in my content template:
if (is_array($node->taxonomy) ) { foreach ($node->taxonomy as $item) if ($item->tid == 3) { print " return to main home page"; } }
Basically what is happening here is when the user is on a page that uses term ID=3 they will be presented with the text "return to main home page".
However, I'd like to make the "return to main home page" text a hyperlink so the user clicks on it to return. How do I add a hyperlink to the print statement. I tried adding but I'm getting a parse error.
So how can I add the into my print statement portion of that PHP line?
Any assistance would be much appreciated!
Thanks!
Comments
l() function
you can print using print l("return to main home page", "http://homepage.com");
you can also write this code into node.tpl
--
Kuldip Gohil
Software Engineer - Global Software Consulting (Gloscon)
1-888-DRUPAL-9 (378-7259)
http://www.gloscon.com
Thanks! It works.
Brilliant! Thanks for your help. That works.
I think you could even do:
I think you could even do:
print l('return to main home page', '<front>');which *i think* should make a link to your home page, regardless of whether it's www.example.com or www.example.com/drupal or www.example.com/path/to/my/drupal/installation.edit: Yes, that will work. It's a special case of the url function, which l() uses internally.
HTH,
Dave