does anyone know how to add links or HTML onto the left sidebar of a drupal theme without using a block? I am using drupal 7.14. Any help would be appreciated.
-
1I'm curious: why do you not want to use a block? Knowing your reasoning/problem may help someone answer your question more appropriately? Also, are these links something you are trying to do on a single page or is this something you may want to re-use?– Boriana DitchevaSep 17, 2012 at 20:34
1 Answer
Can be done using the _phptemplate_variables function in template.php in your theme directory.
function _phptemplate_variables($hook, $vars) {
if ($hook == 'page') {
foreach (array('left','right') as $region) {
$vars[$region] = drupal_get_content($region);
return $vars;
}
}
}
And just call this function below where you want to display the link.
$output = l('some link text','node/1234');
drupal_set_content('left', $output);
-
Note that
_phptemplate_variables
is deprecated. Alternate for D6 and above istemplate_preprocess
Apr 1, 2013 at 7:50