Page 1 of 1

str_replace help...

Posted: Fri Mar 14, 2003 2:06 pm
by bmXermArk
i have a problem using the str_replace thing;

Code: Select all

include 'template.txt';
$text str_replace ('{title}', $title, $text)
echo $text;
my problem is that it doesnt replace {title} (wich is in the text file) with "$title" ($title being the title of the news)

can anyone help me?? :?:

(btw: why are all the checkboxes in this forum wonkey?!)

Posted: Fri Mar 14, 2003 2:32 pm
by hob_goblin
try

Code: Select all

include 'template.txt'; 
$text = str_replace ('{title}', $title, $text) 
echo $text;

Posted: Fri Mar 14, 2003 2:50 pm
by bmXermArk
sorry - thats what i had - i misstyped - so it dont work :?

Posted: Fri Mar 14, 2003 3:11 pm
by bionicdonkey
make sure $text & $title are defined correctly by echoing them.