JohnHalsey Posted April 3, 2014 Share Posted April 3, 2014 I have created 2 templates (so far). One is for the hompage, it includes files which in turn have links to things like the stylesheet, images etc. This works fine. I created a template on PW with this template and created all my editable fields, its all good, page display properly. I now have a second template as a more basic content page. I have done the same thing, used the same include files (which is it recognising) but its not happy with the links inside those includes and I can't understand why not. I uploaded the template to PW in the same way, created my fields, created a page with this template, then when I view the page it shows everything I entered but it doesn't recognise the stylesheet or images etc. Any suggestions welcome, I'm pulling my hair out. Man I need a coffee! FYI I'm using version 2.4.0. ThanksJohn Link to comment Share on other sites More sharing options...
JohnHalsey Posted April 3, 2014 Author Share Posted April 3, 2014 Just to add to this it looks like it is happening to all templates that are not set as the home page template. I just switched the 2 templates over and now the other template works (because the site thinks it is the homepage). I can't understand why that should make a difference? Link to comment Share on other sites More sharing options...
Wanze Posted April 3, 2014 Share Posted April 3, 2014 Hi JohnHasley, Grab a coffee and provide some code please, we can't help without more information If you open your console you should see the resources that won't load. What error code do you get? Link to comment Share on other sites More sharing options...
marcus Posted April 4, 2014 Share Posted April 4, 2014 When including your css and js, do you use something like... <link rel="stylesheet" href="<?php echo $config->urls->templates?>/dist/css/main.css"> ...or are you traversing folders like href="../../css/main.css" ? 1 Link to comment Share on other sites More sharing options...
Martijn Geerts Posted April 4, 2014 Share Posted April 4, 2014 (edited) To expand a little on marcus post. the templates folder, usually /site/templates/ (if PW is installed in the root) | +----------------+------------------+ | | <link rel="stylesheet" href="<?php echo $config->urls->templates?>dist/css/main.css"> | | | +-+--+-+-+ / \ / custom folder / named css custom folder named dist had 1 slash to much.. changed Edited April 4, 2014 by Martijn Geerts 1 Link to comment Share on other sites More sharing options...
JohnHalsey Posted April 4, 2014 Author Share Posted April 4, 2014 Thanks for your replies. I'm not linking to the stylesheet like that. I'm just doing... <link rel="stylesheet" href="site/templates/styles/site.css" /> This worked for a previous site I did with PW, but I will definitely try that method you have provided. Link to comment Share on other sites More sharing options...
Martijn Geerts Posted April 4, 2014 Share Posted April 4, 2014 site/templates/styles/site.css <-- thats relative, you forget the starting / So if your url is http://my-domain.com/products/, the browser is gonna look for /products/site/templates/styles/site.css This should work: ( see the starting slash ? ) <link rel="stylesheet" href="/site/templates/styles/site.css" /> 1 Link to comment Share on other sites More sharing options...
Joss Posted April 4, 2014 Share Posted April 4, 2014 site/templates/styles/site.css <-- thats relative, you forget the starting / And since any new a page is a child page of the home page (/mynewpage/), it will be looking in the wrong place for your css etc EDIT: Oh, Martijn explained that - I should read the whole post! Link to comment Share on other sites More sharing options...
JohnHalsey Posted April 4, 2014 Author Share Posted April 4, 2014 Yes I tried it with the preceding / before site but that didn't work at all for either the homepage or any other. I'll check again and report back. Thanks all. Link to comment Share on other sites More sharing options...
adrian Posted April 4, 2014 Share Posted April 4, 2014 Do you have PW installed in a subdirectory of your html/www root? If so, then /site etc won't work either. You really should be using: <link rel="stylesheet" href="<?php echo $config->urls->templates?>/styles/site.css"> like Martijn suggested. 2 Link to comment Share on other sites More sharing options...
Martijn Geerts Posted April 4, 2014 Share Posted April 4, 2014 Actually I do see now It had a typo. removed the slash here | | <link rel="stylesheet" href="<?php echo $config->urls->templates?>styles/site.css"> 1 Link to comment Share on other sites More sharing options...
adrian Posted April 4, 2014 Share Posted April 4, 2014 And I blindly copied you! Last time I do that Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now