scoob Posted April 22, 2005 Report Share Posted April 22, 2005 i think i have a way to make a functional [auction][/auction] tag & display, but i'm not entirely sure i'm on the right track as i've never worked with IPB directly. as i understand it, the BB codes are simply regex text replacements in the /sources/lib/post_parser.php file now, i don't pretend to know regex very well, either - but whoever wrote the current set of hand input scripts should be able to manage this. have the tag accept up to 40 (?) values (i know that it's possible to have almost 400 calls in an auction, but i think 40 covers any auctions we'll be posting...) ie. [auction=-,-,1H,1S,X,-,2C][/auction] have the replacement start with a static header: <table border="0" style="border-collapse: collapse; text-align: center" bordercolor="#111111" width="250" cellspacing="0" cellpadding="0"> <tr> <th width="25%" bgcolor="#CCCCCC">N</th> <th width="25%" bgcolor="#CCCCCC">W</th> <th width="25%" bgcolor="#CCCCCC">S</th> <th width="25%" bgcolor="#CCCCCC">E</th> </tr> then for each set of 4 values: <tr> <td bgcolor="#CCCCCC"></td> <td bgcolor="#CCCCCC"></td> <td bgcolor="#CCCCCC"></td> <td bgcolor="#CCCCCC"></td> </tr> filling in the values accordingly - null values left null so that unused rows aren't visible in the post. and then a simple </table> to finish it off. i can't think of a use for {content} but it could just put off to the side for comments like the current BB codes do already i guess. Quote Link to comment Share on other sites More sharing options...
Gerardo Posted April 22, 2005 Report Share Posted April 22, 2005 I did. Problem is, in those codes definitions the number of parameters is fixed, so you would need several codes for different bid auctions.OTOH, probably it can be done passing only one parameter, and parsing it, will think about it, no promises (for now). Quote Link to comment Share on other sites More sharing options...
scoob Posted April 22, 2005 Author Report Share Posted April 22, 2005 that's why you have it always write out 40 table cells - with the design i've outlined if the cells are blank (ie the unused cells after 3 passes) the cells aren't visible :) Quote Link to comment Share on other sites More sharing options...
Gerardo Posted April 23, 2005 Report Share Posted April 23, 2005 that implies [auction=-,-,1H,1S,X,-,2C,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,][/auction]yuck! Quote Link to comment Share on other sites More sharing options...
scoob Posted April 23, 2005 Author Report Share Posted April 23, 2005 that implies [auction=-,-,1H,1S,X,-,2C,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,][/auction]yuck! well i assumed you write one of them fancy popup forms so we'd never actually see that bit :) also 40's just a # i through out there, it might not be the best suited. Quote Link to comment Share on other sites More sharing options...
hotShot Posted April 23, 2005 Report Share Posted April 23, 2005 You can find a useful PHP-source for processing that kind of sting here. Quote Link to comment Share on other sites More sharing options...
Gerardo Posted April 23, 2005 Report Share Posted April 23, 2005 hotshot: Thanks! scoob: Well, you would see it when editing a post. Quote Link to comment Share on other sites More sharing options...
scoob Posted April 23, 2005 Author Report Share Posted April 23, 2005 yes, i suppose you would. but i submit that the usefulness of being able to post clean sensible auctions without having to use a series of ....... or spaces to line everything up will outweigh the unsightliness of the BB code in the eyes of the forum majority. i understand your work here is voluntary, Ger, so please don't think i'm unappreciative or anything :) in fact, i may actually have someone that can whip up the actual code additions to post_parse.php (i think that's what it's called from what i recall of my research) if they pull through i should know before the end of the weekend and provide you the code :D Quote Link to comment Share on other sites More sharing options...
scoob Posted April 25, 2005 Author Report Share Posted April 25, 2005 ok below is what they gave me - hope it makes sense to you! Open sources/lib/post_parser.php Find:var $allow_unicode = 1;Add Below:var $auc_values = array(); Find:$txt = preg_replace( "#\[code\](.+?)\[/code\]#ies", "\$this->regex_code_tag('\\1')", $txt );Add Below: //--------------------------------- // Take a bash at [AUCTION] //--------------------------------- $txt = preg_replace( "#\[auction=(.+?)\]#ies", "\$this->regex_auction('\\1')", $txt ); Find:$txt = preg_replace( "#<!--QuoteEnd-->(.+?)<!--QuoteEEnd-->#" , '[/QUOTE]' , $txt );Add Below://Auction $txt = preg_replace ("#<!--AucStart-->(.+?)<!--AucEnd-->#ies","\$this->unconvert_auc('\\1')",$txt); Find:return '[HTML]'.$html.'[/HTML]'; }Add Below:function unconvert_auc($text="") { $this->auc_values=array(); $text=preg_replace("/<!--AucValue:(.+?)-->/ies","\$this->auc_value('\\1')",$text); return "[AUCTION=".implode(",",$this->auc_values)."]"; } function auc_value($val) { $this->auc_values[]=$val; return ''; } Find: return "<!--html-->{$wrap['START']}<!--html1-->$html<!--html2-->{$wrap['END']}<!--html3-->"; }Add Below: /**************************************************/ // regex_auction: Auction Tag // /**************************************************/ function regex_auction($data="") { $array_data=explode(",",$data); $return='<!--AucStart--><table border="0" style="border-collapse: collapse; text-align: center" bordercolor="#111111" width="250" cellspacing="0" cellpadding="0"><tr><th width="25%" bgcolor="#CCCCCC">N</th><th width="25%" bgcolor="#CCCCCC">W</th><th width="25%" bgcolor="#CCCCCC">S</th><th width="25%" bgcolor="#CCCCCC">E</th></tr>'; $inrow=0; $dofirst=0; for($i=0;isset($array_data[$i]);$i++) { if ($inrow == 4) { $inrow=0; } if($inrow == 0) { if($dofirst) { $return.="</tr>"; } $dofirst=1; $return.="<tr>"; } $return.=" <td bgcolor=\"#CCCCCC\"><!--AucValue:{$array_data[$i]}-->{$array_data[$i]}</td>"; $inrow++; } $return.="</tr></table><!--AucEnd-->"; return $return; } Save & upload. P.S. You just use [auction=1,2,3,4] etc, there is no [/auction] needed. Quote Link to comment Share on other sites More sharing options...
scoob Posted June 3, 2005 Author Report Share Posted June 3, 2005 el bumperino Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.