Jump to content

file path trouble


ricky spires

Recommended Posts

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

 

 

Link to comment
Share on other sites

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)

post-109226-13482403157577_thumb.png

Link to comment
Share on other sites

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 :)

Link to comment
Share on other sites

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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.