Jump to content

Recommended Posts

Posted

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.

Thanks
John

Posted

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?

Posted

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?

Posted

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" ?

  • Like 1
Posted (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 by Martijn Geerts
  • Like 1
Posted

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.

Posted

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!

Posted

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.

Posted

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.

  • Like 2

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...