eGate-Network Posted July 13, 2014 Share Posted July 13, 2014 (edited) Hi all,I am a bit of a noob when it comes to website building and php etc so please have patients with me I am learnig as I go.I have come across this problem before and cannot remember what I did to fix it but any way it is presenting its self to me again.I have this page: http://minecraftconsolecrafting.comxa.com/index.php with an include file loading random images, however the same code on these pages:http://minecraftconsolecrafting.comxa.com/sections/build-navi.phphttp://minecraftconsolecrafting.comxa.com/sections/springhill-kingdom-01.phpare not working.I have other websites that this method of coding is working fine on for example here is another of my websites:http://divinegardensandlandscapes.com/index.php here the include code for random image loader is working fine on all pages it appears on so what is happening when this fail takes place?Any help and or advice would be hugely appreciated, Thanks in advance.Please remeber I am a noob when answering. Thanks Edited July 13, 2014 by eGate-Network Quote Link to comment Share on other sites More sharing options...
requinix Posted July 13, 2014 Share Posted July 13, 2014 If you don't mind, I'm going to not look at those pages and instead make a guess. The URLs to those images. Are you using relative paths? Paths that don't start with a slash like "topic/289806-include-code-works-on-one-page-but-not-another/". They're relative to the current "directory" of the page. With the second and third URLs the browser will go looking for "/sections/path/to/image" when it should have gone looking for "/path/to/image". Put a slash at the beginning of the URLs. Quote Link to comment Share on other sites More sharing options...
eGate-Network Posted July 13, 2014 Author Share Posted July 13, 2014 Sorry? I am a little offended. Why wouldnt you want to look at the pages and just make a guess?Its not like its a page full of offensive stuff, its just pictures of minecraft, geez, and because you wont look at it that means you have got your guess wrong,Yes i have tried that thanks any way. Quote Link to comment Share on other sites More sharing options...
eGate-Network Posted July 13, 2014 Author Share Posted July 13, 2014 If you don't mind, I'm going to not look at those pages and instead make a guess. The URLs to those images. Are you using relative paths? Paths that don't start with a slash like "topic/289806-include-code-works-on-one-page-but-not-another/". They're relative to the current "directory" of the page. With the second and third URLs the browser will go looking for "/sections/path/to/image" when it should have gone looking for "/path/to/image". Put a slash at the beginning of the URLs. Useless response. Any one here worth listening to? Quote Link to comment Share on other sites More sharing options...
requinix Posted July 13, 2014 Share Posted July 13, 2014 (edited) It's fine to be offended... if I'm wrong. function banner() { } ; b = new banner() ; n = 0 b[n++]= "<A target='_blank' HREF='http://flowernursery.co.uk'><IMG SRC='random-ads/flower-nursery-banner-01.png' border='0' title='Flower Nursery' >" b[n++]= "<A target='_blank' HREF='http://greatviewlandscapes.com'><IMG SRC='random-ads/greatviewlandscapes-banner.png' border='0' title='Great View Landscapes' >" b[n++]= "<A target='_blank' HREF='http://egatemarket.com'><IMG SRC='random-ads/egm-ad-728x90-banner.png' border='0' title='eGate Market' >" b[n++]= "<A target='_blank' HREF='http://divinegardensandlandscapes.com'><IMG SRC='random-ads/divine-banner-01.png' border='0' title='Divine Gardens & Landscapes' >" b[n++]= "<A target='_blank' HREF='http://minecraftconsolecrafting.comxa.com'><IMG SRC='random-ads/mcc-banner-01.png' border='0' title='MCC Crafting Minecraft PS3 Edition' >" <img border="0" src="random-ads/egm-ad-160x600-video-games.png" alt="Buy & Sell New & Used Video Games For FREE!" title="Buy & Sell New & Used Video Games For FREE!" vspace="5" width="160" height="600">What's this? I was right? Slashes. Add them. function banner() { } ; b = new banner() ; n = 0 b[n++]= "<A target='_blank' HREF='http://flowernursery.co.uk'><IMG SRC='/random-ads/flower-nursery-banner-01.png' border='0' title='Flower Nursery' >" b[n++]= "<A target='_blank' HREF='http://greatviewlandscapes.com'><IMG SRC='/random-ads/greatviewlandscapes-banner.png' border='0' title='Great View Landscapes' >" b[n++]= "<A target='_blank' HREF='http://egatemarket.com'><IMG SRC='/random-ads/egm-ad-728x90-banner.png' border='0' title='eGate Market' >" b[n++]= "<A target='_blank' HREF='http://divinegardensandlandscapes.com'><IMG SRC='/random-ads/divine-banner-01.png' border='0' title='Divine Gardens & Landscapes' >" b[n++]= "<A target='_blank' HREF='http://minecraftconsolecrafting.comxa.com'><IMG SRC='/random-ads/mcc-banner-01.png' border='0' title='MCC Crafting Minecraft PS3 Edition' >" <img border="0" src="/random-ads/egm-ad-160x600-video-games.png" alt="Buy & Sell New & Used Video Games For FREE!" title="Buy & Sell New & Used Video Games For FREE!" vspace="5" width="160" height="600"> [edit] Oh, and spoiler: I lied. I did check first. But somehow I don't think that's the point here. So don't go getting all offended that someone didn't spend a lot of time on your problem and then ignore what they say, because if they turn out to be right, they're not going to be the one looking bad for it. Edited July 13, 2014 by requinix Quote Link to comment Share on other sites More sharing options...
eGate-Network Posted July 14, 2014 Author Share Posted July 14, 2014 (edited) It's fine to be offended... if I'm wrong. function banner() { } ; b = new banner() ; n = 0 b[n++]= "<A target='_blank' HREF='http://flowernursery.co.uk'><IMG SRC='random-ads/flower-nursery-banner-01.png' border='0' title='Flower Nursery' >" b[n++]= "<A target='_blank' HREF='http://greatviewlandscapes.com'><IMG SRC='random-ads/greatviewlandscapes-banner.png' border='0' title='Great View Landscapes' >" b[n++]= "<A target='_blank' HREF='http://egatemarket.com'><IMG SRC='random-ads/egm-ad-728x90-banner.png' border='0' title='eGate Market' >" b[n++]= "<A target='_blank' HREF='http://divinegardensandlandscapes.com'><IMG SRC='random-ads/divine-banner-01.png' border='0' title='Divine Gardens & Landscapes' >" b[n++]= "<A target='_blank' HREF='http://minecraftconsolecrafting.comxa.com'><IMG SRC='random-ads/mcc-banner-01.png' border='0' title='MCC Crafting Minecraft PS3 Edition' >" <img border="0" src="random-ads/egm-ad-160x600-video-games.png" alt="Buy & Sell New & Used Video Games For FREE!" title="Buy & Sell New & Used Video Games For FREE!" vspace="5" width="160" height="600">What's this? I was right? Slashes. Add them. function banner() { } ; b = new banner() ; n = 0 b[n++]= "<A target='_blank' HREF='http://flowernursery.co.uk'><IMG SRC='/random-ads/flower-nursery-banner-01.png' border='0' title='Flower Nursery' >" b[n++]= "<A target='_blank' HREF='http://greatviewlandscapes.com'><IMG SRC='/random-ads/greatviewlandscapes-banner.png' border='0' title='Great View Landscapes' >" b[n++]= "<A target='_blank' HREF='http://egatemarket.com'><IMG SRC='/random-ads/egm-ad-728x90-banner.png' border='0' title='eGate Market' >" b[n++]= "<A target='_blank' HREF='http://divinegardensandlandscapes.com'><IMG SRC='/random-ads/divine-banner-01.png' border='0' title='Divine Gardens & Landscapes' >" b[n++]= "<A target='_blank' HREF='http://minecraftconsolecrafting.comxa.com'><IMG SRC='/random-ads/mcc-banner-01.png' border='0' title='MCC Crafting Minecraft PS3 Edition' >" <img border="0" src="/random-ads/egm-ad-160x600-video-games.png" alt="Buy & Sell New & Used Video Games For FREE!" title="Buy & Sell New & Used Video Games For FREE!" vspace="5" width="160" height="600">[edit] Oh, and spoiler: I lied. I did check first. But somehow I don't think that's the point here. So don't go getting all offended that someone didn't spend a lot of time on your problem and then ignore what they say, because if they turn out to be right, they're not going to be the one looking bad for it. What? Sorry I am not offended someone may not want to spend long on my problem, I am offended you come to my post on a forum where you obviously try to help people or get help and start with "If you don't mind, I'm going to not look at those pages and instead make a guess." Anyway your still wrong as your just talking about a random src code for a random image not used in this include, nothing to do with my question? I am a complete noob at all this and yet am baffled that this is the best respons on this forum. If anyone here does have 5 mins to help and wants to, I am looking for assistance with the include file code on the above mentioned pages. Not anything else like random src codes etc. Thanks a million. UPDATE: Just to be sure the slashes have been implemented in the src codes and no difference. Edited July 14, 2014 by eGate-Network Quote Link to comment Share on other sites More sharing options...
fastsol Posted July 14, 2014 Share Posted July 14, 2014 You do need somthing similar to the / like mensioned above, but with a slight difference cause you're dealing with server side rather than client side for this particular issue. Put this piece of code towards the top of your main include so that it can be used on everypage. define("ROOT", $_SERVER['DOCUMENT_ROOT'].'/'); Then for your includes you woudl do something like this include(ROOT.'yourpage.php'); That will tell php to find the included page starting from the domain root rather than the root of "sections" Quote Link to comment Share on other sites More sharing options...
fastsol Posted July 14, 2014 Share Posted July 14, 2014 Another thing, your html is absolutely horrible. You need to get away from using tables for layout, it hasn't been good to do that for over 10 years now. Use divs and css. Also you have dual <title> tags and they aren't even inside <html> or <head> tags. You have dual <head> tags too and lots of html before you open the <body> which is where ALL your html markup should be inside. So you really need to fix all that before moving forward or you're asking more problems when you try to put things where you want and wonder why they aren't working n the browser. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.