I'm trying to follow the example listed here:
http://drupal.org/node/70249

To that end, I have added this to smartytemplate.php

function  _smarty_variables($hook, $variables) {
 switch($hook) {
	case 'node-flexinode-3' :
		$vars['hallow'] = 'Hello, World!'; 
	break;
	case 'node' :
		$variables['newvar'] = 'new variable';
        	$variables['title'] = 'new title';
        break;
	}
 return $vars;
}

And I've added this to node.tpl

  New Variable: {$newvar}

And this to node-flexinode-3.tpl

  <h1>{$hallow}</h1>

The templates are being applied, because I get "New Variable:' and '<h1></h1>' But the variables aren't getting assigned any values.

What am I missing?

Comments

RobotHero’s picture

So I've managed to get the node version to work by changing the code to this:

function _smarty_variables($hook, $variables) {
 switch($hook) {
	case 'node-flexinode-3' :
		$variables['hallow'] = 'Hello, World!'; 
	break;
	case 'node' :
                $variables['newvar'] = 'new variable';
                $variables['title'] = 'new title';
        break;
	}
 return $variables;
}

So now it works for the node case, but not the flexinode case.

So I guess I'll have to pursue the flexinode angle of this more. What variable do I reference to know which kind of node it is?

RobotHero’s picture

This is what I need to switch between types of Flexinodes.

switch($hook) {
	case 'node':
		switch ($variables['type']) {
			case 'flexinode-3' :

			break;
			case 'flexinode-2' :
				
			break;
		}
        break;
	}