Deleting a variable from the page template
While we introduced a new variable in the previous recipe, we will be removing an existing variable in this one. To demonstrate the effectiveness of template variable manipulation, we will be removing the search form as well as feed icons, such as the RSS icon, from only the front page of the site by making them unavailable to the page template file.
Getting ready
We will be using the myzen theme created earlier in this book as the example theme in this recipe. It is also assumed that a page.tpl.php
file exists in myzen's templates
folder. If not, this file will need to be imported from the Zen base-theme or a new one will need to be created.
How to do it...
Just as we manipulated myzen_preprocess_node()
to add a variable to node templates, we will be manipulating myzen_preprocess_page()
to remove variables from the page template file as follows:
Navigate to the myzen folder at
sites/all/themes/myzen
.Open the file
template.php
in an editor.Look for the...