JS/CSS Linking not consistent between pages

Permalink 1 user found helpful
Hi everyone!

I am creating a theme that utilizes the skel.js framework. At first everything appeared to be working, as the home page worked great. However, when I added a sub page, the JS files that subsequently called the appropriate CSS files could not be found, meaning that my site did not have CSS.

I receive the following error:

localhost/mysite.com/concrete5.6.3.1/index.php/blog-1/themes/mytheme/css/style.css 404 (not found)

I believe that something is going on with getThemePath() or the prefix in the skel.js init file is somehow wrong. For the homepage, it links directly to:

localhost/mysite.com/concrete5.6.3.1/themes/mytheme/css/style.css

js link:
<script src="<?php echo $this->getThemePath(); ?>/js/skel.min.js"></script>
<script src="<?php echo $this->getThemePath(); ?>/js/skel-panels.min.js"></script>
<script src="<?php echo $this->getThemePath(); ?>/js/init.js"></script>



skel.js:
skel.init({
   prefix: 'themes/mytheme/css/style'



Like I said, my homepage works fine and looks good. However, when I try to access a subpage, the styles are gone.

Is there a way to fix this so that I don't have to hard code links into each page?

 
Steevb replied on at Permalink Reply
Steevb
So how is a sub page calling the relevant files, through the header.php or footer.php?
mavrio replied on at Permalink Reply
Yea, the header.php and footer.php files are used in the sub page.
WebcentricLtd replied on at Permalink Best Answer Reply
change skel.init to use the full URL to the CSS folder?
mavrio replied on at Permalink Reply
Thanks AndyJ! Through your suggestion and some trial and error I was able to find the solution by changing the skel.init file to:

skel.init({
   prefix: '/mysite/concrete5.6.3.1/themes/mytheme/css/style',