ricky spires Posted January 6, 2012 Share Posted January 6, 2012 hello. im having trouble getting my images to show my navigation (which i downloaded from http://www.dynamicdrive.com/dynamicindex17/ddaccordionmenu.htm) im pulling in the navigation dynamically. i can get it to show the navigation and css but not the images its quite a long destination url... if i put this code on the ddAccordian.php page it works <link href="http://localhost:8888/djsonrotation/admin/pages/contElements/Navigation/Vertical/ddAccordion/css/styles.css" rel="stylesheet" type="text/css" /> if i try and shorten the url like below the css works but i get no images <?PHP require_once("../includes/initialize.php"); ?> <style type="text/css" rel="stylesheet"> <?php include(NAVIGATION.DS."styles.css"); ?> </style> the include(NAVIGATION.... is being created in my initialize file defined('NAVIGATION') ? null : define('NAVIGATION', $_SERVER['DOCUMENT_ROOT'].DS.'djsonrotation'.DS.'admin'.DS.'pages'.DS.'contElements'.DS.'Navigation'.DS.'Vertical'.DS.'ddAccordion'.DS.'css'); in my css file i have tried all of these (1 at a time) but none work: background: black url(titlebar.png) repeat-x center left; background: black url(/titlebar.png) repeat-x center left; background: black url(./titlebar.png) repeat-x center left; background: black url(../titlebar.png) repeat-x center left; background: black url(images/titlebar.png) repeat-x center left; background: black url(/images/titlebar.png) repeat-x center left; background: black url(./images/titlebar.png) repeat-x center left; background: black url(../images/titlebar.png) repeat-x center left; my folders are like this /ddAccordion/css/styles.css /ddAccordion/images/ /ddAccordion/js/ /ddAccordion/ddAccordion.php any thoughts. thanks ricky Quote Link to comment https://forums.phpfreaks.com/topic/254479-file-path-trouble/ Share on other sites More sharing options...
gristoi Posted January 6, 2012 Share Posted January 6, 2012 you best get firebug installed in firefox or chrome then use net > images. this will give the a list of all the images that the browser is trying to load ( the absolute paths) from here you should be able to work out where it is looking for your files . (See the attached screenshot) Quote Link to comment https://forums.phpfreaks.com/topic/254479-file-path-trouble/#findComment-1304831 Share on other sites More sharing options...
ricky spires Posted January 6, 2012 Author Share Posted January 6, 2012 hello. sounds like a good idea but i cant get firebug to see any images on any site ? i have enabled Net and clicked images but nothing is showing on any web site i visit ? Quote Link to comment https://forums.phpfreaks.com/topic/254479-file-path-trouble/#findComment-1304852 Share on other sites More sharing options...
gristoi Posted January 6, 2012 Share Posted January 6, 2012 ok, so logically, if the images arent loading, is the style sheet? chech the css tab in the console and make sure the path is right Quote Link to comment https://forums.phpfreaks.com/topic/254479-file-path-trouble/#findComment-1304857 Share on other sites More sharing options...
ricky spires Posted January 6, 2012 Author Share Posted January 6, 2012 ok. i can view the css in firebug when i hover over the image code background: url("../images/titlebar.png") repeat-x scroll left center black; it says "failed to load given url" if i change it to url("pages/contElements/Navigation/Vertical/ddAccordion/images/titlebar.png") repeat-x scroll left center red it works. its a bit long but it might have to do i cant put php in to the css thanks Quote Link to comment https://forums.phpfreaks.com/topic/254479-file-path-trouble/#findComment-1304877 Share on other sites More sharing options...
ricky spires Posted January 6, 2012 Author Share Posted January 6, 2012 hi, is there any way to shortern my css image url ???? my images for the navigation are locate at the problem is my index page is at : http://localhost:8888/djsonrotation/admin/index.php and my navigation is located at: http://localhost:8888/djsonrotation/admin/pages/contElements/Navigation/Vertical/ddAccordion/ddAccordion.php in the ddAccordion.php i cant just put <link href="css/style.css" rel="stylesheet" type="text/css" /> i have to use this long code to find the css file http://localhost:8888/djsonrotation/admin/pages/contElements/Navigation/Vertical/ddAccordion/ddAccordion.php which i have now replaced with this <style type="text/css" rel="stylesheet"> <?php include(NAVIGATION.DS."styles.css"); ?> </style> in my css code to find an image i have to use this long url which is ugly background-image: url(pages/contElements/Navigation/Vertical/ddAccordion/images/titlebar-active.png); anyway is there any way to shortern things other than moving the navigation (ddAccordion) folder back to inside the root folder ???? should i maybe turn my css file in to a php file and do something like this background-image: url(<?php include(CSS_IMAGES.DS."titlebar-active.png"); ?>); ANY THOUGHTS thanks Quote Link to comment https://forums.phpfreaks.com/topic/254479-file-path-trouble/#findComment-1305046 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.