<html>
<head>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div class="moz-cite-prefix">I got the token reference from the
token list. You can request that link at the bottom of the page
where you define the code field in display suite.<br>
<br>
I found a way around this problem for now. It's kind of a dirty
hack.<br>
I used $entity->field_project_type['und'][0]['tid'] in my
condition. A quick dpm gave me the value of the tid. Ideally I
should request the taxonomy term using the tid and get the value
from that.<br>
<br>
I got a solution for now. I'll have to dig into using tokens a bit
further later.<br>
<br>
Here's the code I used<br>
<br>
<?php<br>
if ($entity->field_project_type['und'][0]['tid'] === '12') {<br>
print "Project " . "[node:title]";<br>
} else {<br>
print "[node:title]";<br>
}<br>
?><br>
<br>
Bert<br>
<br>
<br>
On 26/07/14 07:31, Paul Rijke wrote:<br>
</div>
<blockquote
cite="mid:CANUh=GPddR-JanmcJD_HuafptncqXq8Sin5ne00Kt-CB6ee=1g@mail.gmail.com"
type="cite">
<div dir="ltr">
<div style="font-family:trebuchet ms,sans-serif"
class="gmail_default">Could it be that de field referenced is
wrong?</div>
<div style="font-family:trebuchet ms,sans-serif"
class="gmail_default"> </div>
<div style="font-family:trebuchet ms,sans-serif"
class="gmail_default">
I am no php programmar, but in examples I see
$node->field_project_type used</div>
</div>
<div class="gmail_extra"><br>
<br>
<div class="gmail_quote">2014-07-26 0:55 GMT+02:00 Don <span
dir="ltr"><<a moz-do-not-send="true"
href="mailto:donald@fane.com" target="_blank">donald@fane.com</a>></span>:<br>
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">
<div text="#000000" bgcolor="#FFFFFF">
<div>Doesn't look like ' [node:field_project_type] ' has
any real value in the if() statement.<br>
<br>
-Don-<br>
<br>
<br>
On 7/25/2014 6:36 PM, Bert Van Kets wrote:<br>
</div>
<blockquote type="cite">
<pre>Hi all,
I need to change the title of a node depending on the value of the field
field_project_type. I created a "PHP code" code field in display suite
and added the following code:
<?php if ([node:field_project_type] == 'Project') { ?>
Project [node:title]
<?php } else { ?>
[node:title]
<?php } ?>
However, I get the following error:
Parse error: syntax error, unexpected ':', expecting ']' in
/var/www/wallfish/modules/php/php.module(80) : eval()'d code on line 1
What am I doing wrong?
I can't find any correct way to get the value of that field through a token.
Thanks.
Bert
</pre>
<span class="HOEnZb"><font color="#888888"> </font></span></blockquote>
<span class="HOEnZb"><font color="#888888"> <br>
<br>
<div>-- <br>
<br>
<div>-- <br>
-Don Pickerel-<br>
Fane Software<br>
<img alt=""
src="cid:part2.04080905.08020203@gmail.com"
height="70" width="66"><br>
</div>
</div>
</font></span></div>
<br>
--<br>
[ Drupal support list | <a moz-do-not-send="true"
href="http://lists.drupal.org/" target="_blank">http://lists.drupal.org/</a>
]<br>
</blockquote>
</div>
<br>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
</blockquote>
<br>
</body>
</html>