Announcement: Be excellent to each other.


Caravel Forum : Caravel Boards : Development : Anybody know PHP?
New Topic New Poll Post Reply
Poster Message
admin
Level: Legendary Smitemaster
Rank Points: 8
IP: Logged
icon Anybody know PHP?  
I\'m wondering if anybody wants to help me with some PHP coding on tForum. If not, I will get around to doing it myself, but I thought it might be worth asking.

I got an e-mail list working yesterday. If you have a certain setting turned on, you\'ll receive an e-mail for each post on the forum, like ye olde Yahoo groups. To get it working perfectly, a routine needs to be written to replace UBB codes with plain-text equivalents.

Here is a sample message sent through e-mail:
admin posted:
{quote}{b}eytanz wrote{/b}:
In HTML, it would be possible to do so by using white-on-white writing to make highlighting the spoiler necessary; but HTML is disabled, and UBB has no such code. Anyone have any suggestions?{/quote}

Well, let us see if this works.  I have a secret: {secret}But I\\\'m not gonna say.{/secret}



So if anyone is interested, let me know.

There are actually quite a few nifty things that could be done with the messages board. Imagine being able to insert a picture of any DROD room into your message. Or having polls that can be displayed as messages with form input. Message boards rock ass!

-Erik
02-07-2003 at 05:10 PM
View Profile Send Private Message to User Show all user's posts Quote Reply
Schik
Level: Legendary Smitemaster
Avatar
Rank Points: 5381
Registered: 02-04-2003
IP: Logged
icon Re: Anybody know PHP? (+7)  
I\'m no PHP pro, but I\'ve dabbled...

If you want to do a simple search and replace for some strings, this is pretty easy:

<?php
$str = \"admin posted:\\n {quote}{b}eytanz wrote{/b}:\\nIn HTML, it would be possible to do so by using white-on-white writing to make highlighting the spoiler necessary; but HTML is disabled, and UBB has no such code. Anyone have any suggestions?{/quote}\\n\\nWell, let us see if this works. I have a secret: {secret}But I\\\'m not gonna say.{/secret}\\n\";

$patterns[0] = \"/{quote}/\";
$replacements[0] = \"\\\"\";

$patterns[1] = \"/{\\/quote}/\";
$replacements[1] = \"\\\"\";

$patterns[2] = \"/{b}/\";
$replacements[2] = \"*\";

$patterns[3] = \"/{\\/b}/\";
$replacements[3] = \"*\";

$str = preg_replace( $patterns, $replacements, $str);

print $str;

?>

All this does is replace {quote} and {/quote} with a \", and replace {b} and {/b} with a *. More can be easily added, but for things like hidden - what do you want to do? Remove it altogether?



____________________________
The greatness of a nation and its moral progress can be judged by the way it treats its animals.
--Mahatma Gandhi
02-07-2003 at 07:42 PM
View Profile Send Private Message to User Send Email to User Show all user's posts High Scores Quote Reply
Scott
Level: Smitemaster
Rank Points: 578
Registered: 02-12-2003
IP: Logged
icon Re: Anybody know PHP? (0)  
How do you post a picture?
03-05-2003 at 01:32 AM
View Profile Send Private Message to User Show all user's posts Quote Reply
ErikH2000
Level: Legendary Smitemaster
Avatar
Rank Points: 2794
Registered: 02-04-2003
IP: Logged
icon Re: Re: Anybody know PHP? (0)  
Scott wrote:
How do you post a picture?
Well... you don\'t. The software doesn\'t support it. It would be cool if it did!

You can use produces:



You can also use [siteimage] to use an image on DROD.net. But there is currently no way for users to upload images. For example, [siteimage]pinkthreatsmall.gif[/siteimage] produces:

[siteimage]pinkthreatsmall.gif[/siteimage]

I\'ve written PHP code to receive an image and store it on another project, but I don\'t have time now to get it working for the forum. Maybe in the future we will have something for that.

-Erik


____________________________
The Godkiller - Chapter 1 available now on Steam. It's a DROD-like puzzle adventure game.
dev journals | twitch stream | youtube archive (NSFW)
03-05-2003 at 01:47 AM
View Profile Send Email to User Show all user's posts This architect's holds Quote Reply
New Topic New Poll Post Reply
Caravel Forum : Caravel Boards : Development : Anybody know PHP?
Surf To:


Forum Rules:
Can I post a new topic? No
Can I reply? No
Can I read? Yes
HTML Enabled? No
UBBC Enabled? Yes
Words Filter Enable? No

Contact Us | CaravelGames.com

Powered by: tForum tForumHacks Edition b0.98.8
Originally created by Toan Huynh (Copyright © 2000)
Enhanced by the tForumHacks team and the Caravel team.