this might have been answered a while ago when 4.2 actually came out, but im trying to update my theme and i get the error "Invalid argument supplied for foreach() in /usr/local/psa/home/vhosts/wornpath.net/httpdocs/includes/common.inc on line 960" I looked that up and its the function to insert a link into the page but im not really sure what is wrong with the foreach... i dont know the ins-and-outs of drupal to go messing around so if someone could tell me what i need to fix in my theme i would appreciate it... thanks, horix - www.wornpath.net

Comments

fiade’s picture

Hi,

I had the same problem. After searching for a while, i found here that l() function (among others) had changed so you should modify your .theme where this function appears.

In my .theme the main problem was that i had something like this at the beginning of my function node:

$terms = array();
      if (function_exists("taxonomy_node_get_terms")) {
        foreach (taxonomy_node_get_terms($node->nid) as $term) {
          $terms[] = l($term->name, array("or" => $term->tid), "index");
        }
      } 

i changed it, so it is now:

if (module_exist("taxonomy")) {
      $terms = taxonomy_link("taxonomy terms", $node);
}

you will probably have to change more l() in your node title and the like...

before:

<div class="nodetitle">
          <?php print $main ? l($node->title, array("id" => $node->nid)) : $node->title ; ?&gt
        </div>

now:

<div class="nodetitle">
          <?php echo "<a href=\"/node/view/$node->nid\">$node->title</a>"; ?>
        </div>

Good luck

KaT
http://www.fiade.com/

horix’s picture

thanks... ill try that out.. appreciate the info.