Hello,
Sorry for the title... I use a view slideshow and for a specific node type and I want to link the title to another node. I created a special cck text field called field_url_promo.
I try to return a different title linked to a node wether this special field is empty or not. So I wrote this at the end of the view fields in a php field.

if ($row->field_url_promo_value>0) {
$destitle = '<a href="' . $row->field_url_promo_value . '"><h2>' . $row->title . '</h2></a>';
}

else {
$destitle = '<a href="node/'  . $row->nid . '"><h2>' . $row->title . '</h2></a>';

}
return $destitle;

It doesn't work because I'm not good with PHP. Can somebody tell me how to do to make it work please ?

Thank you for your help.

Comments

infojunkie’s picture

I assume your code is correct. To debug it, enable Devel module and use dsm to examine your variables.

You need to place your code snippet in the "Output code" section of the PHP field. Instead of return $destitle, use print $destitle.

liam morland’s picture

Issue summary: View changes
Status: Active » Closed (outdated)

Drupal 6 is no longer supported. If this applies to a later version, please re-open and update the version.