Forum > Help Desk

Well I thought I was done :(

(1/2) > >>

Guest (Deleted):
I thought I had the play by post section done, but the fucking thing only grabs single lines.  I can't come up with a regex expression that will grab everything so it might be a while till it works.

You see the [noparse][announcement], [links] and [synopsis][/noparse] tags parse their contents into an HTML comment into the post.  When the first post reader reads it back it tages that text out of the comment and puts it where it belongs using the side blocks.

Well that's the theory.  I think I can safely say that writing regex expressions are the most difficult task a programmer ever has to do.

Maximum Fu:
Hey.  I know that can't be easy.  I want to thank you for putting in the effort so that we can have our fun.

It is much appreciated.

Guest (Deleted):
And I got it! :)

Here's the code - note it cost me about 20 sanity points.

if ($this->forum['showfirstpost']==1 AND $post['postid']==$this->thread['firstpostid'])
{
$game = array();
preg_match('/<!-- SYNOPSIS:((.|s)*?)-->/', $post['message'], $matches);
$game['synopsis'] = $matches[1];

preg_match('/<!-- LINKS:((.|s)*?)-->/', $post['message'], $matches);
$game['links'] = $matches[1];


preg_match('/<!-- ANNOUNCE:((.|s)*?)-->/', $post['message'], $matches);
$game['announce'] = $matches[1];

$this->templatename = 'postbit_first';
}

Knightcrawler:
AHHHHH!!!!!!!

Roll for sanity loss.

[dice=1]6[/dice]

Megamieuwsel:
Sanity check as well:
[dice=6]1[/dice]

Navigation

[0] Message Index

[#] Next page

Go to full version