Can't get preprocess_node function to override items I've been stuck on getting a custom preprocess_node function to work in a Drupal 6 install. I can get it to echo out things based on values but I just can't seem to get overrides working. The latest thing I've tried is the answer described in the answer on this page. If I do:

$node-&gt;title = "Test";


and do a print_r on the $node I can see that it is overridden in the array with the new value but the title that's being output is still the old one. I've also tried setting $variables[title] but no luck. I'm actually trying to target something deeper than the title but thought I'd start with this. Here's an example I've tried putting in the template.php file. I've replaced my actual theme name with mythemename. 

function mythemename_preprocess_node(&amp;$variables) {

//Profiles
if($variables['type'] == "child_profile"){

    $node = $variables['node'];

        $node-&gt;title = "Test";
        //This echo correctly shows the new title but it's not actually overriding anything
        echo $node-&gt;title;


    $variables['node']=$node;
}}
If you look at node.tpl.php, the title is being printed like this:

&lt;?php if (!$page): ?&gt;
  &lt;h2&gt;&lt;a href="&lt;?php print $node_url ?&gt;" title="&lt;?php print $title ?&gt;"&gt;&lt;?php print $title ?&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;?php endif; ?&gt;


As you can see that's using the $title variable, not $node-&gt;title.

There's a one-to-one mapping between the array keys of the template's variables, and names of variables available in the template file. If you have $variables['my_awesome_var'] in the preprocess function, that variable will be available as $my_awesome_var in the template file.

So with that in mind, all you should need to do in your preprocess function is this:

function mythemename_preprocess_node(&amp;$variables) {
  //Profiles
  if ($variables['type'] == "child_profile") {
    $variables['title'] = 'Test';
  }
}


To complete the thought - you could also change the node template to print $node-&gt;title instead, and your current code would work fine. But since the original template file uses a separate $title variable, it would be better to stick to convention and use that method.