permalink issues when adding a prefix

Hi all,

I have just started using the permalink plugin, and thought everything was going fine, but I have noticed a couple of huge issues with my detail viewer pages, 

 I have a list viewer page located at /listings/informer_list.php in the permalink.db I have added an entry bridlington-news with the source url of /listings/informer_list.php  If I load the url mywebsite.com/bridlington-news I get the page loading and everything works fine on the page, no problem with paths to scripts or styles.

If I click on a list viewer link the detail page loads as expected with the full article using the url mywebsite.com/listings/informer_detail.php?article name again no issues with links to scripts or style sheets.

At this point I thought it would be nice to have the detail viewer page show up with permalink urls something like mywebsite.com/news/article name so looking at the instructions It seems all I have to do is create a permalink field within the table and include a default value of say "news/"

so I add a field called permalink with the default value "news/" I then open one of the records, I can see the new permalink field but leave it blank and save it so it automatically creates the permalink.  I then reload my list viewer page and click the link for the record I have just updated the url resolves to mywebsite.com/news/name of the article which is just what I wanted, however I have lost all my styling, the page is obviously no longer resolving the paths to the stylesheets properly which is confusing the hell out of me for the following reasons.

1) the physical location of the page hasn't changed it is still in a subfolder one level from the root ie  /listings/ and I assumed that all the foolery was handled by permalinks and no physical location change was occurring.

2) when I viewed the list viewer page I didn't have any such problems and the page was in the same location as the detail viewer so why were the paths recognised on the list viewer but not the detail viewer.

Using logic I surmise that it must be something to do with the fact that the url looks as though the page is in a sub folder, but hang on the url shows the page as being in a  subfolder which is still just one level up from the root ie /news/ so surely the paths would all still work as the actual location is /listings/ so I am again confused. but to test the theory I remove the default value in the permalink so that the url just resolves the same way as the list viewer ie it looks as though it is off the root.  So I remove the default value, go back into the record, remove the old value from the permalinks field and save. 

I reload my listings page, click the link and this time it loads as mywebsite.com/article name/ all the styling is back in place but the java script rotating banners are no longer functioning so why not? it is now operating in the same way as the list viewer, same location same depicted url type but the banners will not rotate, it looks as though it is no longer finding the javascript files. I have tried amending the paths and they still wont work, I have even used absolute paths and still the banners dont work.

I am assuming that if it was a path issue then my style sheets wouldnt work either so I am completely stumped.

I would as you can imagine be extremely grateful if someone could explain why this is happening and why is it only an issue with detail viewers? the banners are also on the list viewer pages and they work fine, they work fine on the detail viewers so long as I am not using a permalink to access them.

In case it helps I have  attached the detail viewer page in case it holds the answer.

Thanks in advance

Attachments:

informer_detail.php 31K

Hi willydoit,

The problem is that the links to your style sheets are relative and not absolute. This article gives you an overview of the difference between the two:

http://www.coffeecup.com/help/articles/absolute-vs-relative-pathslinks/

An absolute file path starts with a / or http:// / https:// and the browser assumes that the file path starts from the base of the site, no matter what the current directory is. An example of an absolute file path would be:

<link rel="stylesheet" href="/Site/styles/twitter-bootstrap/bootstrap.css">

or:

<link rel="stylesheet" href="http://example.com/Site/styles/twitter-bootstrap/bootstrap.css">

You current have the path set up to be relative:

<link rel="stylesheet" href="../Site/styles/font-awesome/css/font-awesome.css"/>

So your browser looks at the current URL:

mywebsite.com/news/article name/

then is trying to looking for the URL path:

mywebsite.com/news/Site/styles/font-awesome/css/font-awesome.css

So you just need to change the URL path for your CSS sheets to there absolute values. 

Let me know if you have any questions.

Thanks!

Greg

Greg Thomas







PHP Programmer - interactivetools.com