Auto-Columns On Archive Links Page?

Discuss news styles, css code, and other Coranto customizations in here...the possibilities are endless, so have at it!

Moderator: Spunkmeyer

Auto-Columns On Archive Links Page?

Postby BDP » Thu Mar 04, 2004 8:01 pm

Has anyone coded a method that will automatically, after XX number of months, say, 20, start a new table column to allow the archives page to not get so long vertically? I imagine some sort of IF code and a counter could be done to accomplish this but I have no idea how or where to put such a thing.

With years and years of archives, I just think it looks dumb having the links page be one long column of like 40 months.
BDP
 
Posts: 116
Joined: Wed Apr 16, 2003 5:10 pm

Postby SrNupsen » Thu Mar 04, 2004 8:53 pm

There's an addon called News Columns (available from the addons page) that allows you to put all items output from a profile into table cells. However, this divides news equally between columns, so you'll have :


Item #1 Item #2 Item #3
Item #4 Item #5 Item #6

...and so on.

SrNupsen
-----------------------------------------------------------------------------------------------------
Coranto is free software. I am available for custom work or troubleshooting.

http://www.sundaune.no - transkripsjon, webdesign, nettsider, tekstbyrå
http://www.vagbladet.no - satire, politikk, kultur, sport, nettavis
-----------------------------------------------------------------------------------------------------
SrNupsen
 
Posts: 2229
Joined: Tue Jan 09, 2007 6:46 pm
Location: Nesodden, outside Oslo, Norway

Re: Auto-Columns On Archive Links Page?

Postby havikk » Thu Mar 04, 2004 9:06 pm

BDP wrote:Has anyone coded a method that will automatically, after XX number of months, say, 20, start a new table column to allow the archives page to not get so long vertically? I imagine some sort of IF code and a counter could be done to accomplish this but I have no idea how or where to put such a thing.

With years and years of archives, I just think it looks dumb having the links page be one long column of like 40 months.


You could probably use some perl code to accomplish that. Maybe a simple style like:

Code: Select all
<perlcode>
if ($keepCount) {
# 20 is the number of posts you want before a new column, change it
# accordingly to your own preference.
   if ($keepCount - 20 == 0) {
      $keepCount = $keepCount%20;
</perlcode>
</td>
<td colspan="1" valign="top" nowrap>
<perlcode>
   }
} else {
$keepCount = 0;
</perlcode>
<td colspan="1" valign="top" nowrap>
<perlcode>
}
$keepCount++;
</perlcode>
<a href="<Field: FileName>"><Field: ArchiveDate></a><br>


then within your archive template you would need
Code: Select all
<html>
<head><title>ARCHIVES</title></head>
<body>
<table>
<tr>
<Field: Content>
</td>
</tr>
</table>
</html>


Something like that should work, may have a bug or two as I just wrote it off the top of my head.
Last edited by havikk on Fri Mar 05, 2004 3:25 am, edited 2 times in total.
havikk
 
Posts: 79
Joined: Mon Nov 10, 2003 8:36 pm

Postby BDP » Fri Mar 05, 2004 1:20 am

Thanks, I'll give it a try!

Can you tell me where that goes (the perl code) and in what file?

I guess I can find it if I really search but if you know, it'd save me time. :)
BDP
 
Posts: 116
Joined: Wed Apr 16, 2003 5:10 pm

Postby bozoka45 » Fri Mar 05, 2004 3:16 am

PerlCode goes directly into a Coranto style, through the administration panel.
User avatar
bozoka45
 
Posts: 1159
Joined: Sun Mar 23, 2003 8:38 pm
Location: New Orleans

Postby havikk » Fri Mar 05, 2004 3:24 am

oh and make sure in the TD tags you also include valign="top" .. i'll update my previous post to reflect this.

i also added nowrap in the TD tags so it will all stay on one line.
havikk
 
Posts: 79
Joined: Mon Nov 10, 2003 8:36 pm

Postby BDP » Mon Mar 08, 2004 1:13 am

Hey,

Thanks for this code. I don't mean to be a dummy, as I am sure it's something easy, but I cut and paste exactly what you wrote, and it just pasted the literal code onto the page (it's not recognizing your <perlcode> tags and stuff). Do I need to change something literally before I put it in the style?

Thanks again.
BDP
 
Posts: 116
Joined: Wed Apr 16, 2003 5:10 pm

Postby havikk » Mon Mar 08, 2004 3:36 pm

You have to put that perlcode in the news style that the archive profile uses, not the template.
havikk
 
Posts: 79
Joined: Mon Nov 10, 2003 8:36 pm

Postby BDP » Mon Mar 08, 2004 6:23 pm

I did have that right, but you know what it was?

PerlCode needs those captial p and c in there. perlcode in lowecase didn't work!

Like I said, something simple. Always assume I know nothing. ;)

It's working great! Thanks for this mod!
BDP
 
Posts: 116
Joined: Wed Apr 16, 2003 5:10 pm


Return to Customization

Who is online

Users browsing this forum: No registered users and 1 guest

cron