Dwoo variable not rendering in custom field
  • toymachiner62toymachiner62 February 19
    I have a custom field on a layout I created and in that field i'm trying to use a php variable in the dwoo syntax like this

    A Collection of Our {$catName} Patterns.


    In my view i'm using the fuel_var function and when I view my page, it prints out exactly what I have in the custom field. Why does it not use the php variable?
  • adminadmin February 20
    How is the $catName variable being set for that layout/page?
  • toymachiner62toymachiner62 February 20
    It's being set in my controller.
  • adminadmin February 20
    How is it being set? Are you doing something like this:
    $page_init = array('location' => 'my_page');
    $this->load->module_library(FUEL_FOLDER, 'fuel_page', $page_init);
    $this->fuel_page->add_variables($vars);
    $this->fuel_page->render();
  • toymachiner62toymachiner62 February 20
    It is being set through a query like this:


    $vars['catName'] = $this->patterns_access_model->get_category_by_id($categoryId);
    // use Fuel_page to render so it will grab all opt-in variables and do any necessary parsing
    $page_init = array('location' => 'patterns', 'render_mode' => 'cms');
    $this->load->module_library(FUEL_FOLDER, 'fuel_page', $page_init);
    $this->fuel_page->add_variables($vars);
    $this->fuel_page->render();
  • adminadmin February 20
    On line 249 of the fuel/modules/fuel/libraries/Fuel_page.php file, there is a $vars variable that is passed to the Template parsing on line 255. If you do a print_r on the $vars['catName'], does anything show up?
  • toymachiner62toymachiner62 February 20
    Yes it contains my variable value.
  • toymachiner62toymachiner62 February 20
    Yes it contains my variable value.
  • toymachiner62toymachiner62 February 20
    Sorry for the duplicate comment.
  • adminadmin February 20
    Hmm... I'm not sure. If it gets to that point and has the proper variable information right before it is sent to the Dwoo parser, I would think it would work. If you echo out the output from line 255 right after, does it still show {$catName}? Also, just to be safe, you may want to clear the fuel/application/cache/dwoo/compiled directory (or you can do that in the admin by clicking the Page Cache link on the left menu)
  • toymachiner62toymachiner62 February 21
    Yes the value is still there after line 255. I'm actually using {$catName} in the "Body" section of the admin and it works fine as well as in the "Page Title" section, but if I put it in a "Heading" section which i've added through my layout, {$catName} is not recognized.
  • adminadmin February 23
    I'm not quite sure why that is happening at the moment... any luck on your end?
  • toymachiner62toymachiner62 February 23
    Not yet, I have one more thing I want to try tonight.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In Apply for Membership

Categories