Using Joomla's baseurl to import javascript
I am trying to use Joomla's basurl to link to my开发者_运维百科 javascript files like this:
<script type="text/javascript" src="<?php echo $this->baseurl ?>/templates/js/music.js"></script>
My code highlighting though seems out of whack and I am wondering if anyone knows how I should be writing this please?
if I use it in the css link everything looks fine there:
<link rel="stylesheet" href="<?php echo $this->baseurl ?>/templates/music/css/nav.css" type="text/css" />
Many thanks!
From looking at your include css and include js code it seems like your template is called music
.
Therefore, you need to have your template's name as part of the path. Instead of /templates/js/
use /templates/music/js/
<script type="text/javascript" src="<?php echo $this->baseurl; ?>/templates/music/js/music.js"></script>
精彩评论