Din Muhammad Sumon,
Actually, I have found the proper way to do this using the
mycustomstyle routine.
Modify the mycustomstyle.php file by adding the 'addScript' function
below the 'addStyle' function. Like this:
<?php
/*
* @package Custom Feature (Add custum stylesheet) - RocketTheme
* @version August 1, 2010
* @author RocketTheme
http://www.rockettheme.com
* @copyright Copyright (C) 2007 - 2010 RocketTheme, LLC
* @license
http://www.gnu.org/licenses/gpl-2.0.html GNU/GPLv2 only
*
*
*/
defined('JPATH_BASE') or die();
gantry_import('core.gantryfeature');
class GantryFeatureMyCustomStyle extends GantryFeature {
var $_feature_name = 'mycustomstyle';
function isEnabled() {
return true;
}
function isInPosition($position) {
return false;
}
function init() {
global $gantry;
//custsom CSS styles & JS functions
$gantry->addStyle("mycustomstyle.css");
$gantry->addScript("
https://ajax.googleapis.com/ajax/libs/jquery/
1.5.1/jquery.min.js");
}
}
?>
This will allow you to include JS script files without touching the
Gantry files at all. Much better.
Luke
> I'm assuming you have aJavaScriptfunction you want to add for use on
> your website so here goes.
>
> First, upload yourJavaScriptfile to the 'templates\rt_gantry\js'
> folder.
>
> Open up the default Gantry template index.php file and look for this
> line in the '<head>' section but with different filename other than
> 'customsscript.js'.
>
> $gantry->addScript("customscript.js");
>
> If you find it, add your script like this changing the
> 'customscript2.js' to the name of yourJavaScriptfile.
>
> $gantry->addScript(array('customscript.js', 'customscript2.js'));
>
> Save the file.
>
> However, if you don't find that line, then look for the line like
> this:
>
> $gantry-
>
> >addStyles(array('template.css','joomla.css','style.css'));
>
> Add this line below it and change 'customscript.js' to the name of
> yourcustomscript.
>
> $gantry->addScript("customscript.js");
>
> Save the file.
>
> This should dynamically include yourJavaScriptfile when the site is
> loaded.
>
> Luke
>
> On Jan 17, 4:47 am, Din Muhammad Sumon <
dmsu...@gmail.com> wrote:
>
>
>
>
>
>
>
> > How to load my owncustomJavascriptfile from the JS folder in
> > Gantry? Please
> > help me.