In-line Editing of fuel variables

I've got one page and one block uploaded into the CMS. I'm using site variables for a few of the paragraphs and headings. So far it's all working, except the in-line-editing of those site variables. When the pencil icon is clicked, instead of allowing me to edit the variable, I get the error: "This variable must either be saved in the admin or edited in the associated views/_variables file." Does anyone know what might cause this error? (the pencil for editing the body of the page is the only one that works) Thanks!


  • edited 11:00AM
    How are you calling the inline editing in your code? Is it:
    <?=fuel_var('myvar', 'default', 'sitevariables')?>
    Note the 3rd parameter specifying to use sitevariables instead of pagevariables
  • edited 11:00AM
    <?php echo fuel_var('index_banner_text')?>

    I'm not using using any of the optional variables. the variables are defined in the pagevariables section of the CMS only.
  • edited 11:00AM
    Is the "fuel_mode" set to "auto" in your fuel/application/config/MY_fuel.php file? That message will appear if the variable being displayed isn't being pulled from the CMS (or the variable value doesn't exist)
  • edited 11:00AM
    Yes, it is set to auto. I double checked and it is pulling the variables from the database. When I change the variable value from the CMS, it updates the page accordingly. Most of the variables don't have anything entered into the 'scope' field.
  • edited April 2014
    So these are variables set under the Pages module for a page or the Site Variables module? If the latter, have you tried:
    <?=fuel_var('myvar', 'default', 'sitevariables')?>
  • edited 11:00AM
    Ah, assigning 'sitevariabales' to the 3rd parameter was the key. Thanks!
  • rl2rl2
    edited 11:00AM
    Okay I've found this thread and it doesn't help for me.

    My fuel_mode is set to auto.

    If I specify 'sitevariables' in the third parameter I get...

    *** http://localhost:3000/fuel/sitevariables/inline_edit/ - 404 Page Not Found

    <?php echo fuel_var('homeInsuranceTelephone','','sitevariables');?>

    If the third parameter is 'pagevariables' I get...

    "This variable must either be saved in the admin or edited in the associated views/_variables file."

    <?php echo fuel_var('heading','','pagevariables'); ?>

    The heading variable is clearly defined in MY_fuel_layouts.php:

    $config['layouts']['home-insurance-page'] = array(

    'fields' => array(
    'Header' => array('type' => 'fieldset', 'label' => 'Header', 'class' => 'tab'),
    'page_title' => array('label' => lang('layout_field_page_title')),
    'meta_description' => array('label' => lang('layout_field_meta_description')),
    'opengraph_image' => array('label' => lang('layout_field_opengraph_image')),
    'meta_keywords' => array('label' => lang('layout_field_meta_keywords')),
    'introbanner_alttext' => array('label' => 'Intro Banner SEO Text (leave blank for H1 Heading)', 'type' => 'string'),

    'Body' => array('type' => 'fieldset', 'label' => 'Body', 'class' => 'tab'),
    'heading' => array('label' => lang('layout_field_heading')),
    'heading2' => array('label' => 'Sub Heading (H2)', 'type' => 'string'),
    'body' => array('label' => lang('layout_field_body'), 'type' => 'textarea', 'description' => lang('layout_field_body_description')),
    'body_class' => array('label' => lang('layout_field_body_class')),
    'testimonial_block' => array('label' => 'Testimonial Block Visible', 'value' => 'yes', 'type' => 'enum', 'mode' => 'radios', 'options' => array( 'yes' => 'yes', 'no' => 'no') ),

    And of course it's writing to the page correctly!
  • edited 11:00AM
    For that particular page, do you have a field called "heading" specified in your layout that has been saved? That error message will appear if it doesn't find that value saved in the fuel_pagevariables table for that particular page.
  • rl2rl2
    edited 11:00AM
    Correct, it is.

    Just logged at the console output...

    jquery-3.2.1.min.js?c=:2 Uncaught TypeError: $this.filter(...).size is not a function
    at HTMLSpanElement. (fuel_inline.min.js?c=:81)
    at Function.each (jquery-3.2.1.min.js?c=:2)
    at e.fn.init.each (jquery-3.2.1.min.js?c=:2)
    at moveMarkers (fuel_inline.min.js?c=:81)
    at refresh (fuel_inline.min.js?c=:80)
    at showEditors (fuel_inline.min.js?c=:90)
    at toggleEditors (fuel_inline.min.js?c=:90)
    at initFUELBar (fuel_inline.min.js?c=:96)
    at init (fuel_inline.min.js?c=:74)
    at HTMLDocument. (fuel_inline.min.js?c=:96)

    in modules/fuel/assets/js/fuel/fuel_inline.min.js

    At line 82 you make use of the .size method which has been deprecated since jQuery 1.8. I replaced this with:


    This solved the problem of errors in console output but it did not solve my particular problem with inline editing.
  • edited 11:00AM
    The size() fix has been updated already in the develop branch. Is that "heading" variable being saved in the fuel_pagevariables table for that page_id (you'll need to lookup the corresponding page ID in the fuel_pages table using the "location" field).
  • rl2rl2
    edited 11:00AM
    I have checked the database all ids and page variables are set in the appropriate table/row.
  • edited 11:00AM
    What is the fuel_mode set to in fuel/application/config/MY_fuel.php?
  • rl2rl2
    edited 11:00AM
  • edited 11:00AM
    That's tough for me to tell at this point. I would start by looking at the fuel_var function itself found in the fuel_helper.php file.
  • rl2rl2
    edited 11:00AM
    I've looked at Pagevariables.php in fuel/modules/fuel/controllers/ at this function.

    public function inline_edit($field = NULL, $page_id = NULL)

    If I paste the below code within the true branch of ! is_numeric($field))... both the function arguments are empty

    echo "field = " . $field . "
    echo "page_id = " . $page_id . "

    Therefore making the values going into the $where = array('name' => '', 'page_id' => $page_id) empty.
Sign In or Register to comment.