i have created this function
<?php
function bbcode($code)
{
$str = preg_replace("/\[center\](.*?)\[\/center\]/","<center>\\1</center>",$code);
$str = preg_replace("/\[b\](.*?)\[\/b\]/","<b>\\1</b>",$code);
$str = preg_replace("/\<center\>(.*?)\<\/center\>/","<center>\\1</center>",$code);
echo $str;
}
bbcode("
[center]1[/center]
");
echo "2";
?>
But all this does is echo the string , in this case
[center]1[/center]
but it should echo out 1 centered. like below , any one have any ideas, is my function wrong?
1
Is this how i call from a function?
<?php
function bbcode(code)
{
$str = preg_replace("/\[center\](.*?)\[\/center\]/","<center>\\1</center>",$str);
$str = preg_replace("/\[b\](.*?)\[\/b\]/","<b>\\1</b>",$str);
$str = preg_replace("/\<center\>(.*?)\<\/center\>/","<center>\\1</center>",$str);
}
echo bbcode([b]cake[/b])
?>
ok, last problem, i want to use this on lots of pages , from a forum, to members profiles.
how would i do this without writing it on every page , i was think something like
function bbcode(code)
{
$str = preg_replace("/\[center\](.*?)\[\/center\]/","<center>\\1</center>",code);
$str = preg_replace("/\[b\](.*?)\[\/b\]/","<b>\\1</b>",code);
}
then to call, i would do
bbcode(cake); ?? is that correct
forum, bbcode , i am planning on limiting what html they can use, to <center>,<b> etc. but i don't know how to search the string for it , strbck is the closet function i have seen
ok, thanks for that , now how can i search to see if the string contains any html code.
e.g
<center>
?
or do i not nead to , i want it so that if they enter
<center> or [center ]
it centers the text
I don't know where to start and i like this forum more than google,
but as far as i know / have read , i need to query the db but not like normal, using different terms, what are they?
Thanks,
Your Friendly neighbour hood Blade
yes, have an if statement in the iframe, where u set the url, and change the url based on the id number
e.g.
if($idnumber == 1)
{
echo "link to page";
}
so first off, you want the code to count how many days until the header needs to be changed and then after this amount of days you want to display the text("You must now add a new Header")?
Can u please paste the code with the header in aswell.
We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.