Note the upgraded forum! If you are experiencing issues logging in, you may need to reset your password which should send an email. If the email doesn't arrive, be sure to check your spam folder just in case.

About the CMS Page and variables

edited July 2017 in Modules
Hi, I'm new in fuel cms and setup v1.4 already. I'm trying CMS Page function and have a question about the variable file.
Is it CMS page will not load the corresponding variable file ?
(e.g. I had a CMS page which location is : /index, all variables inside _variables/index.php will not load except those variables in _variables/global.php is loaded normally). Thanks !

Comments

  • edited 4:40AM
    If you are wanting to load variables for the home page, use "home.php" for the variables file name instead.
  • edited 4:40AM
    Thanks for reply, I give some test to load the corresponding variable file. If it is the opt-in (use view file) way, it works. But for a page create in CMS admin then it is not. (e.g. cms page with location "home" will not load _variables/home.php, but I remove the cms page, instead use a view file "views/home.php", then all variable inside _variables/home.php is loaded)
  • edited 4:40AM
    Just describe more for trouble shooting here:
    I create 2 CMS page in cms admin which location is "about" & "about/team", and I load and show a variable $test in both page.
    Step 1.
    $vars['test'] = 'global'; // put inside "_variables/global.php"
    in this case both about and about/team show 'global'

    Step 2.
    $vars['test'] = 'about'; // put inside "_variables/about.php"
    in this case both about and about/team show 'about', variables in about.php overwrite global.php, so far so good.

    Step 3.
    $vars['test'] = 'team'; // put inside "_variables/about/team.php"
    in this case about/team still showing 'about', variables in team.php not load (seems all variables put in team.php is not load... is it normal ?)

    p.s. I didn't create "About" controller in this test.
  • edited 4:40AM
    _variables files shouldn't be in subfolders. In that case your would put your about/team page specific variables in the _variables/about.php file using the $pages variable instead of the $vars variable:
    $pages['about/team'] = array('test' => 'team');
  • edited 4:40AM
    thanks for the advice. I'll follow this.
Sign In or Register to comment.