I have set up a server side includes in my site, All the graphics work ok, but not the links to the other pages, it is not uploaded to the site yet so there is no point in go to the url, I have pasted the mark up below. can any one help please.
<div id="banner"><img src="images/banner968_238.jpg" width="968" height="238" alt="The Carpet and Flooring Consultant" />
<div id="navigate"><ul id="MenuBar">
<li> <a href="../index.html">Home</a></li>
<li> <a href="../commercial-contract_carpet_and_flooring.html">Commercial</a> </li>
<li> <a href="../residential-domestic_carpet_and_flooring.html">Residential</ a></li>
<li><a href="../information.html">Information</a>
<ul>
<li><a href="../contact.html">Contact</a></li>
<li><a href="../photo_slideshows/products.html">Product</a>
<ul>
<li><a href="../photo_slideshows/picture_gallery_commercial.html">Commercial </a></li>
<li><a href="../photo_slideshows/picture_gallery_residential.html">Residenti al</a></li>
</ul>
</li>
<li><a href="../tips_and_tricks.html">Tips_and_Tricks</a></li>
<li><a href="../newsletter.html">Newsletter</a></li>
</ul>
</li>
<li><a href="../inspections.html">Inspections</a></li>
</ul>
<p> </p>
<script type="text/javascript">
// BeginOAWidget_Instance_2141544: #MenuBar
var MenuBar = new Spry.Widget.MenuBar2("#MenuBar", {
widgetID: "MenuBar",
widgetClass: "MenuBar MenuBarRightShrink",
insertMenuBarBreak: true,
mainMenuShowDelay: 100,
mainMenuHideDelay: 200,
subMenuShowDelay: 200,
subMenuHideDelay: 200
});
// EndOAWidget_Instance_2141544
</script>
</div>
</div>
Jeffrey54 Lane wrote:
I have set up a server side includes in my site, All the graphics work ok, but not the links to the other pages, it is not uploaded to the site yet so there is no point in go to the url, I have pasted the mark up below. can any one help please.
<div id="banner"><img src="images/banner968_238.jpg" width="968" height="238" alt="The Carpet and Flooring Consultant" />
<div id="navigate"><ul id="MenuBar">
<li> <a href="../index.html">Home</a></li>
<li> <a href="../commercial-contract_carpet_and_flooring.html">Commercial</a> </li>
<li> <a href="../residential-domestic_carpet_and_flooring.html">Residential</ a></li>
<li><a href="../information.html">Information</a>
<ul>
<li><a href="../contact.html">Contact</a></li>
<li><a href="../photo_slideshows/products.html">Product</a>
<ul>
<li><a href="../photo_slideshows/picture_gallery_commercial.html">Commercial </a></li>
<li><a href="../photo_slideshows/picture_gallery_residential.html">Residenti al</a></li>
</ul>
</li>
<li><a href="../tips_and_tricks.html">Tips_and_Tricks</a></li>
<li><a href="../newsletter.html">Newsletter</a></li>
</ul>
</li>
<li><a href="../inspections.html">Inspections</a></li>
</ul>
<p> </p>
<script type="text/javascript">
// BeginOAWidget_Instance_2141544: #MenuBar
var MenuBar = new Spry.Widget.MenuBar2("#MenuBar", {
widgetID: "MenuBar",
widgetClass: "MenuBar MenuBarRightShrink",
insertMenuBarBreak: true,
mainMenuShowDelay: 100,
mainMenuHideDelay: 200,
subMenuShowDelay: 200,
subMenuHideDelay: 200
});
// EndOAWidget_Instance_2141544
</script>
</div>
</div>
Probably because the include IS NOT in the same directory as the other pages???
You have to remember that when you insert an include in a page which is outside the directory where the actual include is the links DO NOT change so the pages cannot be found.
When working with includes I always use the full url in the include file to the pages and then at the point I'm ready to upload to the remote server I'll do a find and replace, changing the links to echo the remote full url.
When working with includes I always use the full url in the include file to the pages and then at the point I'm ready to upload to the remote server I'll do a find and replace, changing the links to echo the remote full url.
That's alot of unnecessary work. Just use a root relative link. Include files should always use root relative links for best results (unless you feel like you want to use absolute links, but there is no functional advantage to doing so).
Murray *ACP* wrote:
That's alot of unnecessary work. Just use a root relative link. Include files should always use root relative links for best results (unless you feel like you want to use absolute links, but there is no functional advantage to doing so).
Hummm Ive never been able to get root-relative includes to work for me that's why I always go the abosulte url link
Ok I have this set up:
index.php (in site root folder)
about.php in PAGES folder
INCLUDES folder in PAGES folder
In INCLUDES folder menu.php:
<a href="http://localhost/sitename/index.php">Home</a>
<a href="http://localhost/sitename/pages/about.php">About</a>
Root relative would be? /
<a href="index.php">Home</a>
<a href="about.php">About</a>
When I set up SSI, I usually put them in their own directory. So my includes url would be: /includes/myinclude.inc.php
That would point to an include called myinclude.inc.php that is in my includes folder. It works well using php and asp.... of course the asp include would have the asp extension ![]()
Jim
polar_bare wrote:
When I set up SSI, I usually put them in their own directory. So my includes url would be: /includes/myinclude.inc.php
That would point to an include called myinclude.inc.php that is in my includes folder. It works well using php and asp.... of course the asp include would have the asp extension
Jim
Yeah but if your pages were in a folder named 'monkey' the link would be ../includes/myinclude.inc.php? And your index.php is outside the 'monkey' folder - includes/myincludes.inc.php BUT what would the links look like in one of the include files because they surely would not be correctly linked to serve both the index.php and the pages in the 'monkey' folder?
Sure they would.
On any page the link would be the same, no matter where they were located and how deep in the directory structure. the / tell it to start at the root. So all of them would be the same.
/(start at the root)/includes (the folder where the file resides)/myinclude.inc.php (the name of the file)
It has always worked for me.
Jim
polar_bare wrote:
Sure they would.
On any page the link would be the same, no matter where they were located and how deep in the directory structure. the / tell it to start at the root. So all of them would be the same.
/(start at the root)/includes (the folder where the file resides)/myinclude.inc.php (the name of the file)
It has always worked for me.
Jim
Not talking about actually including the include file into a page, that's pretty simple. I'm trying to address the issue of the links inside the include files. If youre linking to pages in different directories I don't see how one include file can service all directories because the links in the include file don't change?? As I see it the only way is to use the absolute url for the links or keep the pages and the includes in the same directory.
<a href="/PageDirectory/Page.php/">
<img src="/images/timage.png" alt="myimage" width="140" height="111" border="0" />
</a>
We'll its not happening for me.
In the index.php page I have the following link but the link does not find the page_1.php
<a href="/pages/page_1.php">
only finds it if I drop the leading slash:
<a href="pages/page_1.php">
In the index.php page I have the following link but the link does not find the page_1.php
<a href="/pages/page_1.php">
only finds it if I drop the leading slash:
<a href="pages/page_1.php">
Are you talking about a local preview or a remote browse to this page? If the former, it will only work if a) the index.php is in the root of the site, and b) if you have enabled temp files for preview. If the latter, then there are other problems that we don't have enough information to solve.
Murray *ACP* wrote:
In the index.php page I have the following link but the link does not find the page_1.php
<a href="/pages/page_1.php">
only finds it if I drop the leading slash:
<a href="pages/page_1.php">
have enabled temp files for preview.
Well that could be it then....I've just done that. Will give it a test in a bit.
Was beginning to think it could be something local that was not set up correctly and as its never worked locally I've never tried it on a remote, which was going to be my next step because I could NOT see how it was not working.
When you enable preview with temp files, and then preview a page, TWO things happen:
1. All root relative links are converted to document relative links, and
2. Certain related files linked in the page are actually embedded in the head (CSS and javascript externals)
These two things are done in a temporary file which is what gets passed to the browser.
Just so you'll know....
Humm well its getting closer.
I still have the necessity to include the name of the site folder infront like:
<a href="/siteFolderName/index.php">Home</a>
So really that's not much better than the full url because I've still got to replace the site folder name when I upload to the remote server??
If you don't want to have to replace it everywhere, if there are multiple instances, then you can use something like this to define the document root, if you are using php.
<a href=($_SERVER['DOCUMENT_ROOT']."/index.php">Home </a>
That would work anywhere you put it I think.. .right Murray?
Hi I am not sure where to start at the moment, here is my url: http://www.thecarpetandflooringconsultant.co.uk My root file name is: consultant_cs5. How do I look on the Remote “web URL” to see if that name is there. Thanks Jeff
Jeffrey54 Lane wrote:
Hi I am not sure where to start at the moment, here is my url: http://www.thecarpetandflooringconsultant.co.uk My root file name is: consultant_cs5. How do I look on the Remote “web URL” to see if that name is there. Thanks Jeff
Not sure what it is you are asking.......all your links appear to work?
Murray *ACP* wrote:
That means that your site is not properly defined (DW is thinking that your local root folder is "siteFolderName". Please check your definition for the site (also look on the Remote site definition, "Web URL" and see if that folder name is there too).
Sure its properly defined. I have all my dynamic sites in library>webserver>documents. I set up a folder in the documents folder and define the site to point to that folder
Testing server: /Library/WebServer/Documents/siteFolderName
URL prefix: http://localhost/siteFoldername/
Everything else works - it's always the way I've done it.
Obviously / looks for something in 'localhost' but my site isnt in 'localhost' its in a 'folder' in 'localhost'
Sorry Osgood I was a bit premature with that, it’s not the links on the site that don’t work it’s the ones I am working, you see I need to add to the spry bar but I don’t want to have to change them all one by one, so it’s the server side I am working on that I got the problem with, thanks jeff
Sorry - it's the TESTING server that needs it -
for me, my local testing servers all have this in that field -
http://192.168.1.82/foldername
(but that is because my testing server is on another box - replace the IP with localhost if you are testing from your local workstation).
Murray *ACP* wrote:
Sorry - it's the TESTING server that needs it -
for me, my local testing servers all have this in that field -
http://192.168.1.82/foldername
(but that is because my testing server is on another box - replace the IP with localhost if you are testing from your local workstation).
Nah still don't work.
I can see it perhaps working if you have a virtual host set up as it cuts out the need for the browser to look in localhost>folder for the website. You sure that's not the set up youre working with, a virtual host?
Murray *ACP* wrote:
I am working with a virtual host setup, but what I am telling you does not depend on that. What do you have in the Server Folder, and the Web URL field of your Testing server definition
I have this, as posted in one of my replies:
Testing server: /Library/WebServer/Documents/siteFolderName
URL prefix: http://localhost/siteFoldername/
Murray *ACP* wrote:
That will work with temp files enabled to PREVIEW a page containing root relative links. You cannot click away from that page, however, because that will NOT work.
Hummm.. well if I cannot click away from the page what's the point? How do I check the links are working? Might work ok on a remote set up which it should do but I'm guessing unless you have a virtual host set up which echoes the remote server behaviour it doesnt really work.
I'll go back to the full url or may investigate a virtual host.
Murray *ACP* wrote:
Clicking away from a page will not ever work unless you would have virtual hosts set up. The preview will work (with or without virtual hosts) when you are using root relative links (like in your include files for images), but only if you have preview with temp files enabled.
All I wanted to do was check the include page links using / which I obviously cannot. But hey it was a wortwhile effort - I now understand why they don't work, which really no one explains. Now I know and I know how to make it work if need be, set up a local virtual host. Not even Powers himself explains that well in his books about includes and their links although he has a whole bloody chapter on them to get the message across.
North America
Europe, Middle East and Africa
Asia Pacific