Is there a reason url is a function instead of just a template variable?

I am trying to display images in custom flexinode template.

 <a href="/{$node->flexinode_8}">{html_image file=$url$node->flexinode_7->filepath}</a>

I need to prepend the url value to the filepath from flexinode. I can not figure out how to do this with url as a function with making an extra assign call for each image (and template file).
Any ideas how to do this?

Comments

tclineks’s picture

Status: Active » Fixed

Sorry about the belated response here.

I may make base_url available within the template scope as a variable in the future but for now the best solution is to add a _smarty_variables() function to your smartytemplate.php file.

function _smarty_variables($hook, $variables) {
    $variables['url'] = base_path();
    return $variables;
}

see http://drupal.org/node/16383 for more information (s/phptemplate/smarty/g)

Anonymous’s picture

Status: Fixed » Closed (fixed)