0

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.

2 Answers 2

1

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) enter image description here 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. enter image description here

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.

Sign up to request clarification or add additional context in comments.

5 Comments

This template index.php looks strange. It contains only this code: defined('_JEXEC') or die; if (!defined('JMF_EXEC')) { throw new Exception(JText::_('TPL_JMTEMPLATE_MISSING_JFM')); } include_once(JMF_TPL_PATH.DIRECTORY_SEPARATOR.'lib'.DIRECTORY_SEPARATOR.'jm_template.php'); $jmtpl = new JMTemplate($this); $jmtpl->renderScheme('default'); Damn... no html, body etc??
Can you provide link to your theme?
It is called "jm internet" theme
Ok, try to open this file: [current_template]/tpl/default.php Do you see any html-tags?
Yes, there is just html tag and milions of objective php code, included modules etc. Damn this will be difficult :D Thank you
0

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.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.