Reply to Re: Change included code

Your name:

Reply:


Posted by Jerry Stuckle on 04/19/07 13:36

Jon Slaughter wrote:
> <german.rumm@gmail.com> wrote in message
> news:1176958924.412049.59540@b58g2000hsg.googlegroups.com...
>>>>>>>> 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.
>> If index.php is HTML file (no parsing needed), you can "include" by
>> calling
>> <?php echo file_get_contents('../index.php'); ?>
>> to modify path, simply use str_replace or RegExp on
>> file_get_contents() return value, like so:
>> <?php echo str_replace('path/to/stylesheet.css', 'new/path/to/
>> stylesheet.css', file_get_contents('../index.php'); ?>
>>
>> But it's really more clever to use absolute paths.
>>
>
> Thanks, I'll try it. The reason I can't use absolute paths is because the
> path on the remote server is different from the path that I have setup for
> apache and therefore it does no good to hard code it. My only option there
> is to setup apache to have the exact same dir structure as the remote
> server. Ofcourse that might be the best thing and I guess I'll do it but
> still need to know how to modify the file contents for other purposes.
>
> Thanks,
> Jon
>
>
>

Jon,

Did you even read my message earlier? The relative path does not need
to be dependent on the absolute path to your document root. They are
two entirely different things.

All of my sites use absolute paths for their include and require
statements. And all of them work both on test and production machines,
despite very different directory structures.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация