TEENFRONT Posted May 14, 2007 Share Posted May 14, 2007 Hi Im half way through making an article manager for a new site im launching. If i type ##TITLE## into a text box, when i display the artcile, how do i turn the placeholder ##TITLE## into $title of the article. i looked at str_replace but i dont think thats what i need... i need something that searched through the text of a var and if it finds anything within ##*## to convert the * into the $var. I dont know where to start, cheers if anyone can help! Quote Link to comment https://forums.phpfreaks.com/topic/51400-convert-title-to-title/ Share on other sites More sharing options...
boo_lolly Posted May 14, 2007 Share Posted May 14, 2007 look into regex, used with strreplace() Quote Link to comment https://forums.phpfreaks.com/topic/51400-convert-title-to-title/#findComment-253117 Share on other sites More sharing options...
chigley Posted May 15, 2007 Share Posted May 15, 2007 <?php $title = "foobar"; $string = "##TITLE##<br />Welcome to my article!"; $output = str_replace("##TITLE##", $title, $string); echo $output; ?> Quote Link to comment https://forums.phpfreaks.com/topic/51400-convert-title-to-title/#findComment-253444 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.