adding javascripts same way as css ?
adding javascripts same way as css ?
is there, or there should be, a modul that u can ad a javascript the same way u can add css in the database and then to a page?
-
- Support Guru
- Posts: 8169
- Joined: Tue Oct 19, 2004 6:44 pm
Re: adding javascripts same way as css ?
Use global content blocks.
that's what they're for. snippets of HTML code.
that's what they're for. snippets of HTML code.
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
Re: adding javascripts same way as css ?
I think this is a great idea,too. Global content blocks aren't quite what I want. Sure, you could use them to add some javascript, but when the javascript file is 15kb, that isn't a good option. So instead I have to upload them, find the correct address for them, and then add the script tag into the template. If javascript could be added just like the css is now, it would be amazing.
Last edited by brady on Sat Feb 24, 2007 6:07 pm, edited 1 time in total.
Re: adding javascripts same way as css ?
Create a file with this inside
save it as function.jinsert.php and upload it to /libs/smarty/plugins.
Now you can call many javascripts as you want with {jinsert files='script-1.js,script-2.js'}. Base path is uploads/js.
Code: Select all
<?php
function smarty_function_jinsert($params, &$smarty)
{
$files = explode(',', $params['files']);
foreach ($files as $file) echo '<__script__ type="text/javascript" src="uploads/js/'.$file.'"></__script>'."\n";
}
?>
Now you can call many javascripts as you want with {jinsert files='script-1.js,script-2.js'}. Base path is uploads/js.
Last edited by cyberman on Mon Apr 23, 2007 4:47 am, edited 1 time in total.