str_replace help...

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
bmXermArk
Forum Newbie
Posts: 3
Joined: Fri Mar 14, 2003 2:06 pm

str_replace help...

Post 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?!)
User avatar
hob_goblin
Forum Regular
Posts: 978
Joined: Sun Apr 28, 2002 9:53 pm
Contact:

Post by hob_goblin »

try

Code: Select all

include 'template.txt'; 
$text = str_replace ('{title}', $title, $text) 
echo $text;
bmXermArk
Forum Newbie
Posts: 3
Joined: Fri Mar 14, 2003 2:06 pm

Post by bmXermArk »

sorry - thats what i had - i misstyped - so it dont work :?
bionicdonkey
Forum Contributor
Posts: 132
Joined: Fri Jan 31, 2003 2:28 am
Location: Sydney, Australia
Contact:

Post by bionicdonkey »

make sure $text & $title are defined correctly by echoing them.
Post Reply