0
Welcome Guest! Login
0 items Join Now

Correct XML For Custom Position In Head

  • Correct XML For Custom Position In Head

    Posted 11 years 3 months ago
    • Trying like many others to create a custom position in the HEAD to place analytics, tracking, tag managers etc. Can not find anywhere in the documentation a listing of the layout types. In the index.php of tr_paradigm I have placed the following guessing 'basic' is correct:

      <?php echo $gantry->displayModules('headtag','basic','standard'); ?>

      in the template-options.xml I have added:

      <fields name="headtag" type="position" label="HEAD_POS" description="LAYOUT_POS_DESC">
      <field name="layout" type="positions" default="3,3,3,3" label="headtag">
      <schemas>1,2,3,4,5,6</schemas>
      <words>2,3,4,5,6,7,8,9,10</words>
      </field>
      <field name="showall" type="toggle" default="0" label="FORCE_POS"/>
      <field name="showmax" type="showmax" default="6" label="POS_COUNT"/>
      </fields>

      Still no luck with the scripts in the modules at the positions "headtag" appearing. Being in the HEAD I know I dont need alot of the fields but what can I remove safely?
    • Who?'s Avatar
    • Who?
    • Preeminent Rocketeer
    • Posts: 25562
    • Thanks: 613
    • Joomla freelancer

    Re: Correct XML For Custom Position In Head

    Posted 11 years 3 months ago
  • Re: Correct XML For Custom Position In Head

    Posted 11 years 3 months ago
    • Yes have read that page a dozen times. Does not explain the layout types. Also since this position in the HEAD do I need the extraneous Fields for positioning. Does "standard" insert DIV tags around the content? Does "basic"? How about "raw" - the documentation needs more explanation and the example given for the XML is confusing.
    • Who?'s Avatar
    • Who?
    • Preeminent Rocketeer
    • Posts: 25562
    • Thanks: 613
    • Joomla freelancer

    Re: Correct XML For Custom Position In Head

    Posted 11 years 3 months ago
    • Did you try every option you just listed here and inspect HTML code to see what it looks like? I am not the developer so I can't offer you much more explanation then it is already written in the official docs
    • Check my services at: Mihha-Vision
  • Re: Correct XML For Custom Position In Head

    Posted 11 years 3 months ago
    • Hard for to believe that this exact same thing has not been done hundreds of times in other Gantry templates. I think it's the XML - nothing is being output.
  • Re: Correct XML For Custom Position In Head

    Posted 11 years 3 months ago
    • Solved getting the new Module to appear. templateDetails.xml was wrong. It appeared after adding the new position to the list of positions. Now the issue is getting the DIVs to go away. 'basic', 'basic' is not working. Are the only options for a module basic and standard? I can't find any list of what is available anywhere in the documentation.
  • Re: Correct XML For Custom Position In Head

    Posted 11 years 2 months ago
    • I've wrote a mini tut based on the gantry docs, just for give it a try


      Gantry: Display HTML ( render() ) of a custom feature without a position


      To display the HTML of the render() function just add the following code to your template index.php. You could even pass variables etc... to work with in your features render() function!
          $feature = $gantry->getFeature('myCoolFeature');
          $feature->render([mixed] $var);

      You could access any of the functions as described in the docs above. For example you have added an Enable switcher to template-options.xml and would like to get the state:
          if ( $feature->isEnabled() ) {
              // ... do anything
          }

      You could also override the isEnabled() function with your own, if you would like to add additional conditions, like:
          /** features/feature.php */
          function isEnabled() {
              global $gantry;
              if ( $this->enabled ) {
                  if ( $gantry->get('splitmenu-enabled') ) {
                      return true;
                  } else {
                      return false;
                  }
              } else {
                  return false;
              }
          }

      In your template-options.xml add something like the below code if you wish to enable or disable the feature within the template admin area
      	<fields name="myCoolFeature" type="chain" label="MYCOOL_FEATURE_LBL" description="MYCOOL_FEATURE_DESC">
      		<field name="enabled" type="toggle" default="0" label="MYCOOL_FEATURE_ENABLE"/>
      	</fields>



      So next time calling $feature->isEnabled() you'll get true if the splitmenu is enabled... (splitmenu, just as an example)

      So you do not need a module position, just render the features html in render() function



      and have a look into the modules.php in your gantry based template path: yourTemplate/html/modules.php

      you could add your own module chromes here

      Note:
      1. Clear the Cache
      2. Your customization may override during a template update! Always backup your files, and use one of the many file diff apps to reapply your customizations in the new template version.
      3. Please do not add module positions to the <head>
    • Last Edit: 9 years 4 months ago by Kat05.
    • Why i am doing what i do? Sometimes it simply came over me!

      Don't forget to hit the THANKS button for those who helped you and for those who need this for their alter ego :)
  • Re: Correct XML For Custom Position In Head

    Posted 11 years 2 months ago
    • Why not add custom positions to the HEAD? This would seem the best solution.

      What I had to do was as follows:

      1. Created a custom position - in my case "Head" - <?php echo $gantry->displayModules('head','basic','basic'); ?>

      Note I used 'basic', 'basic' for the Layout and Chrome. These settings will eliminate almost all the pesky DIVs.

      2. still had to create a custom.php in /mod_custom to get rid of the last DIV and assign this under Advanced Option in my Custom HTML module. I really see no way around this method as I need several similiar modules for a wide variety of scripts and pixels asigned to different pages. All which require placement in the HEAD tags with no extra HTML.

      <?php
      /**
      * @package Joomla.Site
      * @subpackage mod_custom
      * @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
      * @license GNU General Public License version 2 or later; see LICENSE.txt
      */

      // no direct access
      defined('_JEXEC') or die;
      ?>


      <?php echo $module->content;?>
  • Re: Correct XML For Custom Position In Head

    Posted 11 years 2 months ago
    • Ah ok, that was not clear for me as i read your first post.

      I thought you only want to add something like analytics, etc.. for the whole site and want to add some template admin functionality...

      Now it is clear enough for me :)


      tip: To post code here, click the </> icon above and place your code within the bracket tags ( the quick reply function does not have any styling options, use reply instead )
    • Last Edit: 11 years 2 months ago by Lahmizzar V.
    • Why i am doing what i do? Sometimes it simply came over me!

      Don't forget to hit the THANKS button for those who helped you and for those who need this for their alter ego :)

Time to create page: 0.101 seconds