Question

New to PHP. Having a problem with a "Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING"

Here is the code:

<?php 
$moreLink = '';
if ($data->node_type == "product_book") :
$path = str_replace(' ', '-', strtolower($data->node_title));
$moreLink = '<a href="/books/'.$path'">Read more > </a>';
else :
$path = drupal_get_path_alias( 'node/' . $data->nid);
$moreLink = '<a href="/'.$path.'">Read more > </a>';
endif;
return $moreLink;
?>

Any help would be greatly appreciated. Thanks. -Matt

Was it helpful?

Solution

You forget a . on this line:

$moreLink = '<a href="/books/'.$path'">Read more > </a>';

It should be

$moreLink = '<a href="/books/'.$path.'">Read more > </a>';
                                    ^ here
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top