How to do {example}?

Status
Not open for further replies.

Qodex

Member
Feb 9, 2012
374
36
Hey guys,

I was wondering how do I set a param. I have looked on Google and PHP.net but I can't anything. I want it when I go echo {example} for instance I want it to go 'Hello'.

Thanks
 

Livar

Now 35% cooler!
Oct 15, 2010
846
86
First of all, it's not as simple as that my friend, it requires a template system, there are many but the best is:

 

Quackster

a devbest user says what
Aug 22, 2010
1,764
1,241
Code:
<?php

$contents = file_get_contents('file');
$contents = str_replace("{param}", "param lulz", $contents);

echo $contents;

?>

There.
 

Markshall

Русский Стандарт
Contributor
Dec 18, 2010
2,637
2,389
I remember posting a tutorial on it, . However, this uses '[param]' not '{param}' but it will take you no more than 3 seconds to change that.
 

TesoMayn

Boredom, it vexes me.
Oct 30, 2011
1,482
1,482
Yes, very easy, as has linked you to a simple system I posted, but his link is broken, so here.

 

TesoMayn

Boredom, it vexes me.
Oct 30, 2011
1,482
1,482
Change
PHP:
$this->template = str_replace("[$var]", $content, $this->template);

to

PHP:
$this->template = str_replace("{$var}", $content, $this->template);
 
Status
Not open for further replies.

Users who are viewing this thread

Top