When i loaded the theme in to drupal 7.14 the theme complained that 2 variables where not defined.

the problem was in this code in node.tpl.php. $terms and $field_tags are not defined in drupal 7. I think they have to be removed from the theme to remove the problem. Variables are not in drupal 7 by default.

 <?php if ($page == 0) { ?><h2 class="title"><a href="<?php print $node_url?>"><?php print $title?></a></h2><?php }; ?>
   <?php if ($submitted || $terms): ?> <div class="submitted">  <?php if ($submitted): ?><?php print $date?> by <?php print $name ?> <?php endif; ?>&nbsp; <?php if ($content['field_tags']): ?><?php print '<div class="taxonomy"> ' . render($content['field_tags']) . '</div>'; ?><?php endif; ?> </div><?php endif; ?> 

Notice: Undefined index: field_tags in include() (line 8 of /content/Hosting/m/a/martinnaughton.com/web/sites/all/themes/addari/node.tpl.php).
Notice: Undefined variable: terms in include() (line 8 of /content/Hosting/m/a/martinnaughton.com/web/sites/all/themes/addari/node.tpl.php).

What do you think?

CommentFileSizeAuthor
#3 1866050-4.patch994 byteskalman.hosszu
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

martin naughton’s picture

Issue summary: View changes

did not comment the code

martin naughton’s picture

looking at the api for drupal 7 terms is not there. but it is there in drupal 6.

http://api.drupal.org/api/drupal/modules!node!node.tpl.php/7

martin naughton’s picture

i changed the code to this. i replaced the $terms with render($content['field_tags'])). it seems to have gotten rid of the problem but i do not think it is working.

   <?php if ($submitted || render($content['field_tags'])): ?> 
	<div class="submitted">  
	<?php if ($submitted): ?>
	<?php print $date?> by <?php print $name ?> 
	<?php endif; ?>
	&nbsp; 
	<?php if (render($content['field_tags'])): ?>
	<?php print '<div class="taxonomy"> ' . render($content['field_tags']) . '</div>'; ?>
	<?php endif; ?>
	 </div>
<?php endif; ?> 

followed this mans output
http://robotlikehuman.com/web/how-print-taxonomy-term-nodetplphp-drupal-7

i checked the value of the content array but it does not seem to contain field_tags value.

Array ( [links] => Array ( [#theme] => links__node [#pre_render] => Array ( [0] => drupal_pre_render_links ) [#attributes] => Array ( [class] => Array ( [0] => links [1] => inline ) ) [node] => Array ( [#theme] => links__node__node [#links] => Array ( [node-readmore] => Array ( [title] => Read more about How to rename mulitple files in linux [href] => node/57 [html] => 1 [attributes] => Array ( [rel] => tag [title] => How to rename mulitple files in linux ) ) ) [#attributes] => Array ( [class] => Array ( [0] => links [1] => inline ) ) ) ) [body] => Array ( [#theme] => field [#weight] => 0 [#title] => Body [#access] => 1 [#label_display] => hidden [#view_mode] => teaser [#language] => und [#field_name] => body [#field_type] => text_with_summary [#field_translatable] => 1 [#entity_type] => node [#bundle] => story [#object] => stdClass Object ( [vid] => 57 [uid] => 1 [title] => How to rename mulitple files in linux [log] => [status] => 1 [comment] => 0 [promote] => 1 [sticky] => 0 [nid] => 57 [type] => story [language] => und [created] => 1309021543 [changed] => 1310422894 [tnid] => 0 [translate] => 0 [revision_timestamp] => 1310422894 [revision_uid] => 1 [body] => Array ( [und] => Array ( [0] => Array ( [value] =>

martin naughton’s picture

Issue summary: View changes

again

kalman.hosszu’s picture

Issue summary: View changes
Status: Active » Needs review
FileSize
994 bytes

I attached a patch which resolves the problem. The $term variable doesn't exist in node.tpl.php for Drupal 7 so I changed it to the default "$content['field_tags']" (this was used by the template but the condition was wrong).

Please test it, and if it's ok set the status to RTBC to help the maintainer.