Jump to content

nub: help please!


jack_

Recommended Posts

hey and thanks in advance. i have been working on some forums and I am attempting to limit the amount of quotes users can do to 2 per post. Relative quote formatting is:

 

			if ((substr_count($in, '[quote]') + substr_count($in, '[quote=')) == substr_count($in, '[/quote]')) {
			$search[] = '~\[quote=(.+?)]~i';
			$search[] = '~\[quote]~i';
			$search[] = '~\[/quote]~i';

			$replace[] = '<table style="width:90%; margin-left:5%; margin-right:5%;" border="0" cellpadding="3" cellspacing="0"><tr><td><b> Said:</b></td></tr><tr><td class="quote">';
			$replace[] = '<table style="width:90%; margin-left:5%; margin-right:5%;" border="0" cellpadding="3" cellspacing="0"><tr><td><b> Quote:</b></td></tr><tr><td class="quote">';
			$replace[] = '</td></tr></table>';
		}

		$in = preg_replace($search, $replace, $in);

 

I'm looking to include a function to loop through $search, allow the last and second to last occurences, but remove earlier ones, if possible then add it to $search[] and then $replace[], i'm pretty lost here. All of the search[]'s can occur at least twice, and i'm not sure how to only allow the last two quotes; pretty danged lost  ???. Any help would be appreciated, thank you!

 

(currently this works fine but it allows infinite quoting and pyramiding which is what i don't want.)

Link to comment
https://forums.phpfreaks.com/topic/147624-nub-help-please/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

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.