![]() |
|
|||
|
How can I make a php script that like, wherever I put like... %T in the page, it would replace it with whatever the file name is.
So for example if the page was: http://www.site.com/blah/is-a-sexy-guy.html and in that page it said "Shaun %T!" Then anyone who when to it, it would say "Shaun is a sexy guy!" |
|
|||
|
would you mind telling us not very php experienced webbies how you did that? i would like to learn this kind of stuff. (oh boy does it have many applications!)
oh gee the plastic min-baloons fell out of the pencils cup. :o |
|
|||
|
|
|
|||
|
This first example is simple...
In the str_replace() function, you have 3 terms. the first, %body%, is the term or terms that you want replaced. The second, black, is what you want to replace the first term with. The third is the code where you want the string replacement to occur... Code:
Code:
Code:
Code taken from [url=http://us4.php.net/manual/en/function.str-replace.php:alkwxme6]php.net[/url:alkwxme6]. Descriptions and explanations by me. Headnerd, you can grab this if you want for your site. |
![]() |
| Thread Tools | |
| Display Modes | |
|
|