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:
skel.js:
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?
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:
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?
So how is a sub page calling the relevant files, through the header.php or footer.php?
Yea, the header.php and footer.php files are used in the sub page.
change skel.init to use the full URL to the CSS folder?
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',