Getting Pagevars

edited February 2017 in Feature Requests
Hi! iam trying to get the page variables looping over the fuel->options_list("cms"):

$pages = $this->fuel->pages->options_list("cms");
foreach ($pages as $item){
$e= $this->fuel->pagevars->retrieve($item);
print_r($e);
}

But i having something like a timeout while printing $e.

Any idea? Thanks!

Comments

  • edited 9:52AM
    The timeout may be because $e contains a model object that references the CI object and using print_r on it will. Try something like print_r(array_keys($e)) to see if it prints the names of the variables for the page.
  • edited 9:52AM
    Great, solved!
    I have another question: How can i print these page variables into a view? i´am trying to get these using the fuel_var('page_variable') on the "_variables" global.php file but without success.

    Thank you!
  • edited 9:52AM
    The fuel_var function is really only intended for view files if you are wanting to add the inline editing functionality. You can always access a variable simply as the variables name (e.g. $my_var) in your view file too. If you are adding them to the global.php file, you can do an array_merge with the $vars variable or set a unique array key on the $vars variable in which to access those variables. If the latter, the variable in the view file would be an array of variables.
  • edited 9:52AM
    Just accessing it using the variable name is enough.
    Again, thank you for your time.
Sign In or Register to comment.