test
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • veeco Friend
    #139059

    hello, i installed too many script in my head html, i would like to reduce it, so when the specific module that require the script is not loaded.. so the script is not loaded also..

    just like <?php if($this->countModules(‘left’)) : ?>

    but more likely like this

    <?php if($this->useModuleinaPage(‘mod_mainmenu3’)) : ?>

    <script language=”JavaScript” type=”text/javascript” src=”<?php echo $this->baseurl ;?>/templates/<?php echo $this->template ;?>/js/slidemenu/slidemenu.js”></script>

    <?php endif ; ?>

    … if mod_mainmenu3 is not loaded in a page.. so the script is not loaded..

    right now my web is kinda heavy with loaded script (mootools and jquery also loaded)…

    please help

    ShannonN Friend
    #295649

    veeco;117337hello, i installed too many script in my head html, i would like to reduce it, so when the specific module that require the script is not loaded.. so the script is not loaded also..

    just like <?php if($this->countModules(‘left’)) : ?>

    but more likely like this

    <?php if($this->useModuleinaPage(‘mod_mainmenu3’)) : ?>

    <script language=”JavaScript” type=”text/javascript” src=”<?php echo $this->baseurl ;?>/templates/<?php echo $this->template ;?>/js/slidemenu/slidemenu.js”></script>

    <?php endif ; ?>

    … if mod_mainmenu3 is not loaded in a page.. so the script is not loaded..

    right now my web is kinda heavy with loaded script (mootools and jquery also loaded)…

    please help

    what template are you using, post a live url and post in correct forum please
    ShannonN

    veeco Friend
    #295754

    this is not about JA templates, i’m learning to build template from scratch…

    wooohanetworks Friend
    #295757

    For scripts included in the header there is no way or no easy way to let those only load when the extension is loaded that uses those.

    From as far I know, those scripts always have to be loaded with the site and not just at point of time the extension uses it, better said, those scripts and extensions are built this way and require the script to be loaded before the extension is actually called to do something based on the script. In better words, the script is already active also when it looks like it is not already working.

    As when you take Highslide JS, the regular version needs a header includes like you mentioned. But also when the script is thought to be called only upon clicking a picture for example and opens the highslide effect the whole process starts much earlier.

    At point of time the site loads, the picture you have working with Highslide or even the text link is loaded already by the system including the highslide script. As this is logic, the codes contain the class ID of Highslide. And this picture or link is already displayed with the script also when, by the look as a user, the picture or link is still only a text link or a plain picture file that is later to be loaded with highslide or for the link to open a highslide effect. But this is wrong, already when the link is loaded and same with the picture, the script is active.

    Well there are ways to go around this for sure and it is also depending on what type of extension and script you want to load, but the normal way is so. A header included scripts needs to be loaded all the time, while you may have some extensions that have their own scripts without the header includes in the index.php and there may be ways to avoid those to load also when not directly active. Maybe you should go this way and use more extensions that do not require additional header includes. Most the Joomla extensions do not require this, really 99% of them, while there are some that need those like JoomlaBamboo VM Sliders, that even cause script conflicts with any other Ajax and Mootools on the side when you include those, nothing works no more on scripts on the site but the product slider happily slides and slides suddenly. So, the way to go is more to use extensions that have their own .js in their directories and not scripts you place into the site, not to use the script versions would benefit the situation indeed or when the script is not available as an extension that works without additional header included you may have to create one with the scripts you need to avoid such overloads.

    Hope this explains a bit of your problem.

Viewing 4 posts - 1 through 4 (of 4 total)

This topic contains 4 replies, has 3 voices, and was last updated by  wooohanetworks 15 years, 9 months ago.

We moved to new unified forum. Please post all new support queries in our New Forum