You are here: Re: Change included code « PHP Programming Language « IT news, forums, messages
Re: Change included code

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

german.rumm@gmail.com wrote:
>>>>>>> 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.
>
>
>

Which includes another query to the webserver - and is very inefficient.
There's no reason to do this when the file is on the local filesystem.

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

 

Navigation:

[Reply to this 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

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