Page 1 of 1
[quote] [/quote]
Posted: Sun Feb 20, 2005 4:38 pm
by Jim_Bo
Hey,
How is the [quote]
Code: Select all
etc systems setup within forums?
A starting point or understanding how its done ..
Thanks
Posted: Sun Feb 20, 2005 4:46 pm
by feyd
research 'bbtags' or 'bbcode' ... it's been talked about a lot in the last few days. Evilwalrus has a few quick and dirty implementations of bbcode..
Posted: Sun Feb 20, 2005 4:46 pm
by smpdawg
I think this thread is very similar to what you are asking.
viewtopic.php?t=30734
Posted: Sun Feb 20, 2005 5:03 pm
by Jim_Bo
Hi,
At the expense of looking like an idiot ..
Is it ment to be implimented like so:
read.php = This is the page where the message whole is read ..
Code: Select all
$sql = mysql_query("SELECT sender, subject, message FROM pm WHERE id=$id") or die (mysql_error());
while ($row = mysql_fetch_array($sql)) {
$sender = $rowї"sender"];
$subject = $rowї"subject"];
$message = eregi_replace('\їquote]', '<b>Quote:</b><blockquote style="width: 100%; margin: 3px 8px 3px 16px; color: #000; background-color: #333; border: 2px solid #808080; font-size: 8pt;">', $message);
$message = eregi_replace('\ї/quote]', '</blockquote>', $message);
Is it ment to look something like this .. [quote]data between[//quote]
It then writes it into the quote format ..
P.S It doesnt work
Thanks
Posted: Sun Feb 20, 2005 5:08 pm
by John Cartwright
you are not passing the correct variable to eregi_replace
might want to take a look at
http://php.net/eregi_replace
it looks something like $message = eregi_replace( pattern, replace, source );
Posted: Sun Feb 20, 2005 5:11 pm
by feyd
$message wasn't set previously. The first replace should use $row['message'] as the source argument.
I'd advise switching to preg_* instead of ereg_*
Posted: Sun Feb 20, 2005 5:42 pm
by Jim_Bo
Hi,
Am I even on the right track ..
There is code in the database:
[quote]Test quote code[//quote] did it work?
without the double // in the 2nd quote ..
I call it back in the read.php page like so:
Code: Select all
$sql = mysql_query("SELECT sender, subject, message FROM pm WHERE id=$id") or die (mysql_error());
while ($row = mysql_fetch_array($sql)) {
$sender = $rowї"sender"];
$subject = $rowї"subject"];
$message = ereg_replace('\їquote]', '<b>Quote:</b><blockquote style="width: 100%; margin: 3px 8px 3px 16px; color: #000; background-color: #333; border: 2px solid #808080; font-size: 8pt;">', $rowї'message']);
$message = ereg_replace('\ї/quote]', '</blockquote>', $rowї'message']);
When I view the read.php page the message format still reads like so:
[quote]Test quote code[//quote] did it work?
Am I even on the right track with the way its been called back out of the database into the read.php page?
Thanks
Posted: Sun Feb 20, 2005 8:52 pm
by feyd
first off I said to use preg, not ereg.
second, I said only the first replace call needs to use $row['message'] as the source. The second still should use $message.. although I'm not a fan of processing the in and out seperately, but rather as a single unit.
How are you printing out the data?
Posted: Sun Feb 20, 2005 9:06 pm
by Jim_Bo
Hi,
I tried preg but got errors .. so I was gunna get it working and get an understanding of how it all works b4 trying to figure out preg_
Its being printed using <?php echo $row["message"]; ?> between html ..
Thanks
Posted: Sun Feb 20, 2005 9:08 pm
by feyd
that's why it's not showing any changes.. echo $message.