News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu

Child Boards and 3 vertical columns

Started by madman71, March 17, 2009, 03:30:35 PM

Previous topic - Next topic

madman71

There are a few tutorials that show how to align childboard in a vertical fashion.  I've tried many and some didnt work or partially worked.

I tried the BoardIndex.template file that was offered here for download
http://www.simplemachines.org/community/index.php?topic=288183.0
It almost worked 100%  (Some of the board were aligned to the left and not centered)


So im asking if someone can take a look at my attached BoardIndex.template.php and kindly help me get 3 vertical columns.  It would be great if someone could help me get the same CB layout found in the link that i provided above, but that's not necessary.  I only want 3 columns :)

The reason i think ive been unsuccessful is becasue im sure i have other mods installed that are keeping me from getting it right.

I hope someone can help me.

thanks



Antechinus

Give me the whole theme in a zip so I can test the thing.

madman71

The attached is my theme folder SullenMaddness.

These are the actual files from my server.

thank you, thank you, thank you

Antechinus

Cool. Got it. Give me a day or so to sort this.


madman71

Not sure if it's of any value to you, but your original board index temp. that you offered in the other thread  almost works.  Perhaps i can PM you a screen shot to show you what i mean.  Some boards are left align some are in the proper place.

just let  me know if you like a shot.

Antechinus

Umm, I just took a look at your files and this is for 1.1. RC2. That's prehistoric. I don't even have that on my server. I'm not going to install it either because I'm not in favour of supporting obsolete versions that have known security issues. The upgrades are released for good reason. Please use them.

If you want a version for 1.1.8 I'm fine with that.

madman71

ohh, but my forum software is up to date with 1.1.8 or 1.1.9


madman71

If you can just tell me what code to FIND and replace, i can handle it from there :)

Antechinus

Ok, I'll have a look at it if it'll run on 1.1.8.


onepiece

Your theme doesn't have a 'BoardIndex' template. So you'll need to edit default theme file.

Themes/default/BoardIndex.template.php

Code (Find) Select
<span class="smalltext"><b>', $txt['parent_boards'], '</b>: ', implode(', ', $children), '</span>

Code (Replace) Select
<strong>', $txt['parent_boards'], '</strong>:<br />
<table>
<tr>';

foreach ($children as $key => $child)
{
if ($key % 3 == 0 && $key != 0)
echo '
</tr>
<tr>';

echo '
<td style="padding-left: 10px;">', $child, '</td>';
}

echo '
</tr>
</table>

Antechinus

Hey that's much cleaner than the way I was doing it. Nice work.

onepiece

Thanks. You could make it even cleaner but I'm not very fond of lists.

Code (Find) Select
', implode(', ', $children), '</span>

Code (Replace) Select
</span><br /><ul style="width: 50%; list-style-type: none; margin: 0;"><li style="float: left; width: 10em;">' . implode('</li><li style="float: left; width: 10em;">', $children) . '</li></ul>

Antechinus

That would be better because it'd save laying out a whole table. Lists are fine as long as they're stable. Depends how they're used.

I was doing it with td's but the way I was writing it was a bit more long winded. I think he'll want an extra td though. People seem to prefer it if the Child Boards text is beside the first child board name, rather than having it sitting on top with a <br />. It's no more functional but it tends to look better.

The other thing I was doing was editing the rowspan for on/off.gif (set to 1 always) and the colspan for the tr that holds the childboards (set to 3) so it spans right across. Handy for three columns of child boards on narrower screens. I also added another on/off.gif that only records new posts in the child boards, and recoded the one for the parent boards so that it only records parent board posts. Ends up being quite nifty if I do say so myself.

Antechinus

#15
Tenma, you can see the way I was doing it in the files attached here, which were made for this theme.

This was for two columns but of course doing it in three is just as easy. ;)


Madman 71, I couldn't get your theme to run on my local host (massive fatal errors due to whatever mods you have) nor could I get the original download of the theme to run on 1.1.8.

ETA: Well I could have got them running if I was prepared to re-code them completely but I thought that was a bit much.

onepiece

That looks cute, good job.

You can use madman71's theme by removing these codes from index.template.php.

echo "<center><br /><h2><i>Random images from the galleries</i></h2>";
include_once 'SSI.php';
ssi_attachmentsBanner('echo', 6);
echo "</center>";


The rest is not fatal.

Antechinus

Well to be honest I was doing umpteen other things as well and as soon as I saw "fatal error" I thought stuff this for a joke. Thanks for the tip though.

madman71

Thank you to you both!!!


Tenma, your code worked!


Im so happy that i get 3 columns now.


I really appreciate both of you for assisting me.

thanks agian

madman71

And if anyone is interested i have found this:

if you take this part of Tenma's code:
($key % 3 == 0 && $key != 0)

and change the "3" to any number, that will change how many columns you get.  I just changed it to 4 and it gave me 4 columns :)


such a short & simple piece of code :)

Advertisement: