fuel_var('page_title') question

edited November 2012 in News & Announcements
In my views/_variables/main file I have this condition:
<h1 class="pageTitle"><?= fuel_var('page_title', '') ?></h1> <?php if(fuel_var('page_title', '') != 'Order Online' && fuel_var('page_title', '') != 'Contact Us'): echo "Test"; endif; ?>
My Order Online controller sets the page_title variable:
$vars['page_title'] = 'Order Online'; $page_init = array('location' => 'order/orderonline_view'); $this->load->module_library(FUEL_FOLDER, 'fuel_page', $page_init); $this->fuel_page->add_variables($vars); $this->fuel_page->render();
My Contact Us controller does not set the page_title variable:
// use Fuel_page to render so it will grab all opt-in variables and do any necessary parsing $page_init = array('location' => 'contact'); $this->load->module_library(FUEL_FOLDER, 'fuel_page', $page_init); $this->fuel_page->render();
Both pages show the page title correctly, but I still see the Test word. Why is that?

Comments

  • edited 12:00PM
    The fuel_var() function actually returns the variable plus the inline editing code and shouldn't be used for evaluating such as in an "if" statement. To do that, simply just use $page_title.
  • edited 12:00PM
    Thank you, but $page_title doesn't work either.

    What does work is the uri->segment.
  • edited 12:00PM
    Sorry, page_title does work, I just needes to change the wording because I was using the uri->segment until I get an answer.

    Thanks
Sign In or Register to comment.