[PHP] Why wont this work?
news_publish.php *** )(.*?)(<\/NEWS>)/i","\\1$news\\2", $templine)); print ($templine); } fclose ($tempfile); } $template_dir="/php/work/boz"; $template_filename="news"; $news="SOME STUFF GOES HERE BUILD IT AS A VAR"; DoTemplate($template_dir,$template_filename); ?> ** news.html *** No Title This is some text Results in Parse error: parse error in /php/work/boz/news_publish.php on line 8 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Clarify: SEARCH AND replace between
Sorry I wasn't clear. I need to search for the combo in an html file. Thats why I asked for a regex. So I need to load in the html SEARCH for the tags and anything in between the tags throw out and REPLACE with the contents of a variable and then rewrite the file. My orginal message follows: > I've been trying this one for a bit and Im in a twist. > > I need to replace ANYTHING or even nothing between two tags > with the contents of a variable and just havent been > able to get the expression right for all cases. > > > As an example concept follows: > > > > Nothing between the tags variable is $varname="some junk" > > so after the function > some junk > > run it again after making variable $varname="some completly different junk" > > so now the tags would be > > some completly different junk > > and so on and so on. > > One other breaker Ive had, it needs to always replace no matter whats > between the tags, whats not between the tags or even if its 1000s of > characters. My code kept breaking when it was alot of characters. > > Any funtions or even just the right regex would be appreciated > > Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Replace ANYTHING between
I've been trying this one for a bit and Im in a twist. I need to replace ANYTHING or even nothing between two tags with the contents of a variable and just havent been able to get the expression right for all cases. As an example concept follows: Nothing between the tags variable is $varname="some junk" so after the function some junk run it again after making variable $varname="some completly different junk" so now the tags would be some completly different junk and so on and so on. One other breaker Ive had, it needs to always replace no matter whats between the tags, whats not between the tags or even if its 1000s of characters. My code kept breaking when it was alot of characters. Any funtions or even just the right regex would be appreciated Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]