Link script from local file on the server in K2 items?

Support help forum dedicated to free and commerical templates for Joomla 3 and 2.5 version.
GK User
Sun Aug 13, 2017 11:26 pm
In the item I need to call a javascript in some of my K2 items so I have this line:
Code: Select all
<script src="http://www.somesite.com.mk/WEBprostor/calc/js/rates.js" type="text/javascript"></script>

Any chance I can change www.somesite.com.mk/ with something and to work?
txs
User avatar
Platinum Boarder

teitbite
Sat Aug 19, 2017 11:06 am
Hi

Ok I do not understand Your question at all. Do You mean the script You've added doesn't work or if You want to add it on certain K2 items only ?

If it's the second question than I would suggest to use a custom code module and enable the line You've presented only on pages You need it.
User avatar
Moderator

GK User
Sat Aug 19, 2017 11:36 am
Instead of http://www.somesite.com.mk/ I would like some custom code to get from local path server so I can use only /WEBprostor/calc/js/rates.js
I need this script in K2 extra fields and If I add the script to the website backend it doesnt work.
I know there was PHP command to obtain absolute path but no luck till now.
txs
User avatar
Platinum Boarder

teitbite
Tue Aug 22, 2017 5:03 pm
Hi

Och in that case You can use /layouts/blocks/head.php file and use a structure like mentioned there already:

Code: Select all
$this->API->addJS($this->API->URLtemplate() . '/js/scrollreveal.js');


when the file is located in template's /js folder which I recommend,
User avatar
Moderator


cron
Remember me
Register New Account
If you are old Gavick user, click HERE for steps to retrieve your account.