|
|
|
|
![]() ![]() |
Jun 24 2007, 10:47 PM
Post
#1
|
|
|
Sparkx Group: [HOSTED] Posts: 366 Joined: 11-October 06 From: Dana Point, CA, USA Member No.: 16,496 myCENTs:44.66 |
OK well I am making a new php program and I am trying to add bbcode to it. Anyway I was going to replace each thing by it self, but that could cause errors. Anyway is there a way to make a variable be anything? Here is an example:
CODE This is the bbcode: [color=00FF00]Hey[/color] In my php: $bbcode = array("[color=".$a."]"); $html = array( "<font color='#".$a."'>"); $topic_content = str_replace($bbcode, $html, $posted_bbcode); So I want $a to be any variable but the same variable as used before. Do you get what I am saying? It is a little confusing but basicly what is the best way to make bbcode? It may not even involve the str_replace but this was the easyiest way to explain what I wanted. Thanks for everyone that helps, Sparkx |
|
|
|
Jun 24 2007, 11:20 PM
Post
#2
|
|
|
the Q Group: [HOSTED] Posts: 1,094 Joined: 13-July 05 From: Lithuania, Vilnius Member No.: 7,059 myCENTs:70.96 |
It can be done in several ways, but as for your problem, I think you could just use a regular expression, even though I like to avoid them, I never got into regular expressions, just found them or asked for them on IRC channels, you would need to use preg_replace(); read on it on the php manual
|
|
|
|
![]() ![]() |
Similar Topics
| Topics | Topics | |
|---|---|---|
|
|
|
|
Lo-Fi Version | Time is now: 22nd November 2008 - 04:14 PM |