By keesee on
Hi Drupalers,
I'm a theme dev that has work in css, js for the past couple of year wanting to dive in to php. I was hoping for some assistance with this statement...
<?php if ($node->type == 'panel') && file_exists('/images/header/' .$node->title .'jpg') { ?> <img src="/images/<?php print $title ?>.jpg"> <?php } ?>
I'm trying to create a statement for panel nodes (panels2) where if I've created a header image, it will print it - else nothing would be printed.
I'm sure its full of mistakes... but one has got to learn sometime. Any assistance would be greatly appreciated.
thx in advance
--
J.
Comments
file extension
I'm not certain if the premise of the code is right, but it looks like you need a period before the jpg file extension. Also, in one place you use $title and then another you use $node->title. Was that intentional?
-Mike Goodwin
http://www.not2us.net
http://www.redleafmedia.com
The entire logical argument
The entire logical argument must be put into parenthesis:
<?php if (($node->type == 'panel') && file_exists('/images/header/' .$node->title .'jpg')) { ?> <img src="/images/<?php print $title ?>.jpg"> <?php } ?>- Corey