Layout Checkboxes

edited July 2013 in Modules
I've created a checkbox in my layout for "NO Index" ...

if (fuel_var('meta_no_index', '') != "") {
echo '';
}

does not work.. it consistently echos the meta tag whether the checkbox is checked or not..

How do checkboxes and radios work???

Comments

  • edited 11:20PM
    the echo was supposed to be echo "< meta tag NO INDEX >"
  • edited 11:20PM
    Use $meta_no_index. fuel_var is a function that will output the inline editing code unless you set the third parameter to FALSE
  • edited 11:20PM
    I'm still not getting a value at all..

    in the MY_fule_layouts.php file this is what I have... Is there something else I'm supposed to do???

    'meta_no_index' => array('label' => 'NO Index', 'type' => 'checkbox', 'description' => 'Keep this page out of the search engines.'),

    $config['layout_fields']['main'] = array(
    'copy' => array('copy' => lang('layout_field_main_copy')),
    'page_title' => array('label' => lang('layout_field_page_title')),
    'meta_description' => array('label' => lang('layout_field_meta_description')),
    'meta_keywords' => array('label' => lang('layout_field_meta_keywords')),
    'meta_no_index' => array('label' => 'NO Index', 'type' => 'checkbox', 'description' => 'Keep this page out of the search engines.'),
    'body' => array('label' => lang('layout_field_body'), 'type' => 'textarea', 'description' => lang('layout_field_body_description'))
    );
  • edited 11:20PM
    Is this .93 or 1.0 beta? Also, when you say you aren't getting a value, is it when the checkbox is checked or unchecked. Forms don't submit unchecked checkbox values. An alternative is to use an enum with a 'yes'/'no' value.
  • edited 11:20PM
    0.93... so you're saying don't use the checkbox use a radio button? I need some sort of toggle for an admin layout.
  • edited 11:20PM
    If you are using 0.93, I would. I do remember there being issues with checkboxes because they don't present a value to save if you don't check them so I always opted for radios. 1.0 you can use checkboxes.
  • edited 11:20PM
    How hard is it to upgrade to 1.0??? What is the best way??? Just copy views/controllers/module and upgrade the config in the new version?
  • edited 11:20PM
    It depends on the amount of customization that's been done. In most cases though, it's not too bad. I would do the following:
    1. Create a new project folder and clone the repo into that folder. I recommend using GIT as opposed to just downloading the ZIP because it makes doing updates easier going forward as 1.0 get's closer to an official release.
    2. Checkout the 1.0 branch (the master branch is currently 1.0)
    3. Move over all your own non-fuel views, controllers, helpers libraries, etc from your current projects application directory to the newly created FUEL 1.0 directory. 1.0 has moved out most of it's helpers and libraries to the fuel/modules/fuel/ folder to avoid issues when upgrading later.
    4. Move over your FUEL configuration files MY_fuel.php, MY_fuel_modules.php and MY_fuel_layouts.php
    5. Move over your assets directory
    6. Run the fuel/install/upgrades/fuel_1.0_schema_changes.sql file in your project database (may want to backup your database first just in case).

    That should pretty much be it. Post back though if you run into other issues. You can review the 1.0 docs at docs.getfuelcms.com
Sign In or Register to comment.