Note that there are some explanatory texts on larger screens.

plurals
  1. POAdding Variables to JavaScript in Joomla
    primarykey
    data
    text
    <p>This is the script I am using to display an accordion in my Joomla site:</p> <pre><code>&lt;?php defined('JPATH_BASE') or die(); gantry_import('core.gantryfeature'); class GantryFeatureAccordion extends GantryFeature { var $_feature_name = 'accordion'; function init() { global $gantry; if ($this-&gt;get('enabled')) { $gantry-&gt;addScript('accordion.js'); $gantry-&gt;addInlineScript($this-&gt;_accordion()); } } function render($position="") { ob_start(); ?&gt; &lt;div id="accordion"&gt; &lt;dl&gt; &lt;?php foreach (glob("templates/rt_gantry_j15/features/accordion/*.php") as $filename) {include($filename);} ?&gt; &lt;/dl&gt; &lt;/div&gt; &lt;?php return ob_get_clean(); } function _accordion() { global $gantry; $js = " jQuery.noConflict(); (function($){ $(document).ready(function () { $('#accordion').easyAccordion({ slideNum: true, autoStart: true, slideInterval: 4000 }); }); })(jQuery); "; return $js; } } </code></pre> <p>I want to call these three values in the templateDetails.XML file as a user input.</p> <pre><code> slideNum: true, autoStart: true, slideInterval: 4000 </code></pre> <p>Like this in the templateDetails.xml file:</p> <pre><code>&lt;param name="accordion" type="chain" label="ACCORDION" description="ACCORDION_DESC"&gt; &lt;param name="slideNum" type="text" default="true" label="SlideNumber" class="text-short" /&gt; &lt;param name="autoStart" type="text" default="true" label="AutoStart" class="text-short" /&gt; &lt;param name="slideinterval" type="text" default="4000" label="SlideInterval" class="text-short" /&gt; &lt;/param&gt; </code></pre> <p>How can I do so? What will be the exact syntax for the same. </p> <p>I am very new to programming ans specially to JavaScript.</p> <p>Kindly help.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload