|  PHP expert |  | De meeste UBB-Problemen worden automatisch opgelost als je een stack-parser gebruikt. Een stack-parser gebruikt niet gewoon reguliere expressies om UBB te parsen, maar kijkt naar de structuur. 
 Als je dit hebt:
 
 
 
    
    
        
            
                
bla1
[font size="13"]bla2[/font]
bla3
 bla1[font size="13"]bla2[/font]bla3
   
 Dan wordt dit zo in een array geparsed:
 
 
 
    
    
        
            
                <?php
array(
0 => array('type' => UBB_TEXT, 'text' => 'bla1'),
1 => array('type' => UBB_NODE_OPEN, 'tag' => 'font', 'attributes' => array('size' => '13')),
2 => array('type' => UBB_TEXT, 'text' => 'bla2'),
3 => array('type' => UBB_NODE_CLOSE, 'tag' => 'font'),
4 => array('type' => UBB_TEXT, 'text' => 'bla13')
)
?> <?php0 => array('type' => UBB_TEXT, 'text' => 'bla1'),1 => array('type' => UBB_NODE_OPEN, 'tag' => 'font', 'attributes' => array('size' => '13')),2 => array('type' => UBB_TEXT, 'text' => 'bla2'),3 => array('type' => UBB_NODE_CLOSE, 'tag' => 'font'),4 => array('type' => UBB_TEXT, 'text' => 'bla13'))?>
   
 Op deze manier kun je de structuur controleren, en als er sluittags missen ze erbij zetten.
 |