Jump to content

Recommended Posts

ok im making a report converter for a game, it converts a report into bbcode to be pasted into the forums, but when i do it atm it all collects on the left side of the forum. SO my converter atm outputs the bb code into a table and i was wanting the right column of the tables cells to have [ center] tags around them so when the bbcode is copied and pasted into the forums it looks more formatted:)

 

Here is the current code to my table:

 


$bbword = explode("\n", trim($bbword));

echo '<table><td>'; // Start a table

$size = count($bbword);
$valBreak = '</td><td>'; // Set the value that will be put between the values
for($i = 0; $i < $size; ++$i) {
echo $bbword[$i];

// See if the next value starts with '-' and output it if it is
if(isset($bbword[$i+1]) && $bbword[$i+1][0] == '-') {
	echo ' ' . $bbword[$i+1];
	++$i; // Move the pointer up one since we've outputted 2 values this loop
}

// Output the between-item value if it isn't the last loop of the array
if(isset($bbword[$i+1])) {
	echo $valBreak;
}

// Swap the between-item value every other loop
$valBreak = ($valBreak == '</td><td>') ? '</td></tr><tr><td>' : '</td><td>';
}

echo '</td></tr></table>'; // End the table

 

so how would i be able to do it?

 

Thanks

 

~Crag

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.