There a few ways of doing this but the following is one of the easier
and quickest off the
top of my head.

If you know the name of the tag and the include this will work if you
don't or want it to
be dynamic you will need to have some reg for the following. (how are
you getting the $string)?

// $string holds your html page you wish to replace

ob_start();

include('links.php');

$links = ob_get_contents();

ob_end_clean();

str_replace('<!--linkTag--!>', $links, $string);

echo $string;


I hope this gives you a direction.




Timothy Hitchens (HiTCHO)
Open Source Consulting
e-mail: [EMAIL PROTECTED]

> -----Original Message-----
> From: jesse [mailto:[EMAIL PROTECTED]] 
> Sent: Wednesday, 22 January 2003 1:05 AM
> To: [EMAIL PROTECTED]
> Subject: [PHP] str_replace an include
> 
> 
> Hello all,
> 
> I'm trying to replace a tag with an include in a template 
> scenario.  For 
>   example:
> 
> str_replace("<!--linkTag--!>", include "links.php", $string);
> 
> This obviously doesn't work, but I'm wondering if anybody knows of a 
> good way to do this.
> 
> Thanks a bunch,
> 
> Jesse Lawrence
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to