0
Welcome Guest! Login
0 items Join Now

different css per preset

  • different css per preset

    Posted 13 years 7 months ago
    • working with gantry:

      i wanted to add additional parameter to a preset, which would load additional css. i've looked in here and it says " 'cssstyle' => 'style3' ", " 'cssstyle' => 'style2' ", ... etc. everywhere, so i thought it would be that easy

      however, when i tried adding this parameter to my custom template preset it did nothing, didn't load the css file at all

      is it even possible to load additional css with preset like this? or does "cssstyle" property in preset configuration mean something coimpletely different?
  • Re: different css per preset

    Posted 13 years 7 months ago
    • come on, is there really absolutely no way how to include a custom stylesheet for a preset in gantry? :shock:
  • Re: different css per preset

    Posted 13 years 7 months ago
    • sorry for the resurrection, but maybe someone will search for this in future so i thought i would post a solution:

      go to your template/templateDetails.xml and add these parameters:

                 <param name="cssstyle" type="chain" label="Additional css"  description="Load additional CSS for the preset">
                      <param name="enabled" type="toggle" default="0" label="ENABLED" />
                      <param name="file" type="text" default="additional" label="File" description="File name (without .css extension)" class="text" />
                  </param>

      then edit your template index file and add these lines into the head
         if($gantry->get('cssstyle-enabled')){
            $gantry->addStyle($gantry->get('cssstyle-file').".css");
          }

      now you can load additional css in the template backend per menu item. if the settings get ignored, since it's kinda quirky, then manually go to [template]/custom/menuitemparams/[your menu item ini] and add this
      menuitemparam_cssstyle-enabled=1
      menuitemparam_cssstyle-file=_your_css_file_

Time to create page: 0.057 seconds