Posted by Jon Slaughter on 04/19/07 18:17
"Jerry Stuckle" <jstucklex@attglobal.net> wrote in message
news:PqydnUBT9YVe_rrbnZ2dnUVZ_gCdnZ2d@comcast.com...
> Jon Slaughter wrote:
>> "Jerry Stuckle" <jstucklex@attglobal.net> wrote in message
>> news:yfWdncgNMNFQbrvbnZ2dnUVZ_rCsnZ2d@comcast.com...
>>> Jon Slaughter wrote:
>>>> "Jerry Stuckle" <jstucklex@attglobal.net> wrote in message
>>>> news:MumdnVsZlqGEe7vbnZ2dnUVZ_uLinZ2d@comcast.com...
>>>>> Jon Slaughter wrote:
>>>>>> "Jerry Stuckle" <jstucklex@attglobal.net> wrote in message
>>>>>> news:D5-dnQ6alNLrQrvbnZ2dnUVZ_jednZ2d@comcast.com...
>>>>>>> Jon Slaughter wrote:
>>>>>>>> Can I modify code that I have included using
>>>>>>>>
>>>>>>>> <?php
>>>>>>>> include("../Index.php");
>>>>>>>> ?>
>>>>>>>>
>>>>>>>> The Index.php file contains links that need to be modified to work.
>>>>>>>> Index.php is basically an html file uses a linked css file and when
>>>>>>>> its included in the new file its referencing a css file in the
>>>>>>>> wrong spot. I need to add "../" to the css file reference in
>>>>>>>> Index.php to make it work.
>>>>>>>>
>>>>>>>> Thanks,
>>>>>>>> Jon
>>>>>>> Ensure your link is an absolute path relative to your website root.
>>>>>>> Then where you include index.php doesn't matter.
>>>>>>>
>>>>>> It would actually be a bit more trouble since any time I want to
>>>>>> upload to the server to test I will have to change the link. Would
>>>>>> be easier just to have php just add "../" to one spot instead
>>>>>> manually doing it every time I upload to the server.
>>>>> And why is that? I never have to change links when I upload to my
>>>>> servers.
>>>>>
>>>>
>>>> Um, because the directory structure differs on my server than my
>>>> computer? My server uses public_html to hold html files while my
>>>> computer doesn't. I suppose I could go mess with the apache config file
>>>> and change it though but it still doesn't solve my problem complete. I
>>>> still need to inject html files into containers in the html/php code.
>>>>
>>> So? Mine differs also - my test system is Windows and most of my hosts
>>> are Unix. And my directory here is much different than the one on the
>>> server. I just set up Apache to handle it. Much easier than trying to
>>> screw around with files like you are.
>>>
>>>> e.g. when I do
>>>>
>>>> <?php include ('SomeFile.php') ?>
>>>>
>>> <?php include ($_SERVER['DOCUMENT_ROOT'] . '/SomeFile.php'); ?>
>>>
>>> Use the features of the language.
>>>
>>
>> To bad this doesn't work. You don't seem to understand the issue. The
>> problem is that using the style sheet is not included properly.
>>
>> e.g., in the main html file I have
>>
>> <LINK REL=StyleSheet HREF="styles/main.css" TYPE="text/css">
>>
>> But when I include the main file the styles/main.css is referenced from
>> the directory of that file... but there is not styles/main.css from in
>> that directory of that file unless it happens to be the root.
>>
>> Got any more bright ideas?
>>
>>
>>
>
> Like I said - use
>
> <LINK REL=StyleSheet HREF="/styles/main.css" TYPE="text/css">
>
> And get your test environment straightened out.
>
Yes. You were right from the beginning. What I first thought you ment by
absolute paths was including the domain name which would just have been a
mess. When I realized that you can use / to refer a path from the root dir
and tired it did not work. It didn't work not because of that but because I
didn't change all the links to be absolute but only some... but I didn't
realize it. So I thought it must have been something else.
The good thing is, is now its working and now I know so next time I
shouldn't have this problem ;)
Thanks,
Jon
[Back to original message]
|