Customizing SMF > SMF Coding Discussion
Split Boards into Columns
SuperZambezi:
Not exactly what I need, but thanks anyway. :P
Any more help would be greatly appreciated. ;D
SoLoGHoST:
--- Quote ---...I would only like this for a single category, not the entire forum.
--- End quote ---
Therein, lies the problem. If you hack your BoardIndex.template.php, you will need to know the category id and base it off of that. You can do this with an if... else... statement. If you just hack your BoardIndex.template.php file without this if... else... statement, than it will take into effect on all of your categories. Also, there are 3 columns for each board by default. You need to be a bit more specific on what you actually want. Cause if you split your 6 boards in that category so that 2 boards show up for 1 row, than we are actually talking about 6 columns per row (since 3 columns exist per board automatically... 1. The Board name, 2. Post/Topic count, and 3. Last Post info for that board). Do you want the 2 last columns of a board to show up underneath of the Board name column? If not, and you do want all 6 columns (3 for each board name), than I don't think it would look good in all cases, just my opinion. Cause smaller screen resolutions and/or browser windows, might squash the content of those boards.
Anyways, just my 2 cents. I think you need to think about how you really want the boards to show in that category, get the category id value, and than you can hack the BoardIndex.template.php file. It's really not that hard to move the content around, since it's encased within <tr> and <td> elements of a table. So all you have to do is make it look like this:
--- Code: ---<table>
<tr><td>First Board Content</td><td>Second Board Content</td></tr>
<tr><td>Third Board Content</td><td>Fourth Board Content</td></tr>
<tr><td>Fifth Board Content</td><td>Sixth Board Content</td></tr>
</table>
--- End code ---
You basically use the existing table for this, and just add in the <tr> and <td> elements as needed.
SuperZambezi:
I see what you mean. Trying to do all 6 columns in one row would be a bit much. So lets say I was going to do what you suggested by having the last two columns underneath the board name column. How would I begin to start an if... then... statement for that? Say for board "1" and board "2". Can I see an example?
And thanks for the help, by the way. :P
SoLoGHoST:
You can already see an example in BoardIndex.template.php. Open up that file, and BAM, there's your example!
Change the <tr> and <td> elements according to how you want it laid out.
It should look like this, within the table element for that category, or all categories (if you edit it without suppling a category id value):
--- Code: ---<tr><td>Board #1 - Name</td><td>Board #2 - Name</td></tr>
<tr><td>Board #1 - Post/Topic count</td><td>Board#2 - Post/Topic count</td></tr>
<tr><td>Board #1 - Last Post info for that board</td><td>Board #2 - Last Post info for that board</td></tr>
--- End code ---
This is basic HTML... you can also give the <td> elements a width of 50% each to make sure they take up the available space and you can also give them an align="center" and valign="middle" to help out with placing them if you need it positioned in the center of the <td> element horizontally and vertically.
To perform an if on the category id value, just use the $category['id'] variable within BoardIndex.template.php when looping within all categories - foreach ($context['categories'] as $category):
--- Code: ---if ($category['id'] == {your category id value})
... do the HTML code above for each board in the $category...
else
... do the normal output
--- End code ---
You may also want to show Child Boards for all Boards, so you may want to add another line to the HTML Code: <tr><td>Board #1 - Child Boards List</td><td>Board #2 - Child Boards List</td></tr>
This should point you in the right direction and get you started...
Navigation
[0] Message Index
[*] Previous page
Go to full version