Reputation: 2208
My friend asked me to add a simple javascript to her page. Unfortunately it is built on joomla (which I have never used). I cannot find any place to include such a script. There are some empty indexes everywhere. Is there any way to do this? I just need to make the page scroll to some position after pressing a button.
Upvotes: 0
Views: 161
Reputation: 410
Add this code in your template, the path may vary depending on the framework
or structure of your template, most commonly the main file is called index.php.
$doc = JFactory::getDocument();
// In this example the js file is called main.js inside js folder
$doc->addScript('/templates/' . $this->template . '/js/main.js', 'text/javascript’);
Some templates also include an option to add your custom files or code directly
in your template configuration, check out the options of your template.
Regards.
Upvotes: 0
Reputation: 496
Try to add your script in this file:
[sitename]/templates/[current_template]/index.php
You can find out the name of the current template in
Go to Administration > Extensions > Template Manager (it will be starred, see screen below)
After that you shold click on template name link, and on other page click Edit main page template for editing index.php (it depends from template).
The second way to find out the template name it's browser DevTools, see screen below.
Also you can edit template file via FTP + your text editor.
UPDATE: For Jm internet theme main template file is here:
[template_root]/tpl/default.php
Also main template layout can loads from these files: content-left-right.php, left-right-content.php etc. It depends from selected options in template settings.
Upvotes: 1