TP-Docs
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome to TinyPortal. Please login or sign up.

March 29, 2024, 12:05:29 PM

Login with username, password and session length
Members
Stats
  • Total Posts: 195,106
  • Total Topics: 21,213
  • Online today: 358
  • Online ever: 3,540 (September 03, 2022, 01:38:54 AM)
Users Online
  • Users: 0
  • Guests: 89
  • Total: 89

Format articles in a catagory into two columns?

Started by GhostRider2110, October 01, 2014, 01:51:54 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

GhostRider2110


Link to my forum: http://www.usscalemasters.org/forum/
SMF version: SMF ver. 2.0.8
TP version: TP ver. 1.1.0.7
Default Forum Language: English
Theme name and version: Modified BigSky

Not really a problem, but can this be accomplished. I have a block on the front page, "2014 Championship Announcements"
It is an upper panel block, defined as articles in a category.  Is there any way to format them in to columns?

As shown in the attached screen shot, they are in one column.  Would be neater if they could be lined up in 2
columns.

Thanks for any help..

See-ya
Mitch
Mitchell Baker AMA 7548 GSWA WB251 10th AF USSMA 358
Webmaster Terre Haute R/C Club http://www.thrcc.org
US Scale Master Midwest Region Manager http://www.ussma-midwest.org
Proud member of the 1/8th Air Force http://www.oneeighthairforce.org
CoffeeCup Software Ambassador Get 20% Off

IchBin

I believe the  TPortal_categorybox() is the function you are looking for in Themes/default/TPsubs.template.php. I think that function handles the layout for the category and articles listings for that block type. 

Something like this should not create a new line unless there are two items. Then it puts in the break tag.  If you want it to look different you'll just have to add some bits into the echo statement where the HTML parts are.
function TPortal_categorybox()
{
    global $context, $txt, $scripturl;

if(isset($context['TPortal']['blockarticle_titles'][$context['TPortal']['blocklisting']])){
echo '<div class="middletext" ', (sizeof($context['TPortal']['blockarticle_titles'][$context['TPortal']['blocklisting']])>$context['TPortal']['blocklisting_height'] && $context['TPortal']['blocklisting_height']!='0') ? ' style="overflow: auto; width: 100%; height: '.$context['TPortal']['blocklisting_height'].'em;"' : '' ,'>';
$count = 1;
foreach($context['TPortal']['blockarticle_titles'][$context['TPortal']['blocklisting']] as $listing){
if($listing['category'] == $context['TPortal']['blocklisting'])
echo '<b><a href="'.$scripturl.'?page='.$listing['shortname'].'">'.$listing['subject'].'</a></b> ' , $context['TPortal']['blocklisting_author']=='1' ? $txt['by'].' '.$listing['poster'] : '';
if ($count % 2 == 0) {
echo '<br />';
}
$count++;
}
echo '</div>';
}
}


Gives you something to work with anyway. :) Just remember if you change this code in this file, any upgrade or file refresh will wipe out your changes.

GhostRider2110

Thanks Ich, that helps.  Here is the code I added:

// category listing blocktype
function TPortal_categorybox()
{
    global $context, $txt, $scripturl;

        if(isset($context['TPortal']['blockarticle_titles'][$context['TPortal']['blocklisting']])){
                echo '<div class="middletext" ', (sizeof($context['TPortal']['blockarticle_titles'][$context['TPortal']['blocklisting']])>$context['TPortal']['blocklisting_heig
ht'] && $context['TPortal']['blocklisting_height']!='0') ? ' style="overflow: auto; width: 100%; height: '.$context['TPortal']['blocklisting_height'].'em;"' : '' ,'>';
                $count = 1;
                foreach($context['TPortal']['blockarticle_titles'][$context['TPortal']['blocklisting']] as $listing){
                        if($listing['category'] == $context['TPortal']['blocklisting'])
                                echo '<b><a href="'.$scripturl.'?page='.$listing['shortname'].'">'.$listing['subject'].'</a></b> ' , $context['TPortal']['blocklisting_author']=
='1' ? $txt['by'].' '.$listing['poster'] : '';
                if ($count % 2 == 0) {
                        echo '<br />';
                } else {
                        echo '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
                }
                $count++;
                }
                echo '</div>';
        }
}


Is better attached is how it looks now.  Would be nice to be able to event the columns out.  Will play with it, any suggestions appreciated.

--Mitch
Mitchell Baker AMA 7548 GSWA WB251 10th AF USSMA 358
Webmaster Terre Haute R/C Club http://www.thrcc.org
US Scale Master Midwest Region Manager http://www.ussma-midwest.org
Proud member of the 1/8th Air Force http://www.oneeighthairforce.org
CoffeeCup Software Ambassador Get 20% Off

GhostRider2110

Hmmm the code I added messes up any left or right panel block.  Anyway to check to see which panel it is going in then determine if to use the different formatting?  --Mitch
Mitchell Baker AMA 7548 GSWA WB251 10th AF USSMA 358
Webmaster Terre Haute R/C Club http://www.thrcc.org
US Scale Master Midwest Region Manager http://www.ussma-midwest.org
Proud member of the 1/8th Air Force http://www.oneeighthairforce.org
CoffeeCup Software Ambassador Get 20% Off

IchBin

Off the top of my head, I'm unsure if which panel is available in the code somewhere so you can check that.

Might be able to do something like this to make the layout work.
http://blog.andyhume.net/responsive-containers/

GhostRider2110

Thanks, I'll play around with it some.. if you or anyone else thinks of something else, I would appreciate it...

See-ya
Mitch
Mitchell Baker AMA 7548 GSWA WB251 10th AF USSMA 358
Webmaster Terre Haute R/C Club http://www.thrcc.org
US Scale Master Midwest Region Manager http://www.ussma-midwest.org
Proud member of the 1/8th Air Force http://www.oneeighthairforce.org
CoffeeCup Software Ambassador Get 20% Off