Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
By RobotHero on
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
One fix down, one to go?
So I've managed to get the node version to work by changing the code to this:
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?
Types of Flexinodes
This is what I need to switch between types of Flexinodes.