I have been building a site in Drupal 7. I have the content type "Basic Page" but added taxonomy terms for the user to be able to select "Standard" or "Full Width" page.
If the user selects "Full Width" the page.tpl.php file has some code which recognises the value chosen for the page removes a sidebar (usually seen on the "Standard" page).
It is working perfectly on the frontend but has an error in the backend.
Here is the code in the page.tpl.php page:
<?php $field_page_width = field_view_field('node', $node, 'field_page_width'); ?>
<?php if ($field_page_width['#items'][0]['taxonomy_term']->name == 'Standard') { ?>
<div class="col-xs-12 col-sm-12 col-md-8 col-lg-8 internal_content">
<?php print render($page['content']); ?>
</div>
<div class="hidden-xs hidden-sm hidden-md col-lg-1"></div>
<div class="col-xs-12 col-sm-12 col-md-4 col-lg-3 side_content">
<?php print render($page['side_content']); ?>
</div>
<div class="clearfix"></div>
<?php } else { ?>
<div class="col-xs-12 col-sm-12 col-md-12 col-lg-12 internal_content">
<?php print render($page['content']); ?>
</div>
<div class="clearfix"></div>
<?php } ?>
I am receiving this error:
Notice: Undefined variable: node in include() (line 76 of /home/public_html/sites/all/themes/zen/child_theme/templates/page.tpl.php).
Why do I get this error? Do I need to have something which establishes $node
in the template.php file?