1
Shine
Template: How to adjust news_archive.html? Using its spare space better!
  • 2005/6/16 11:49

  • Shine

  • Just can't stay away

  • Posts: 822

  • Since: 2002/7/22


I am trying to redesign the template of the news archive.
At the moment its lay-out a long list of months with news appear below eachother. A lot of spare 'space' isn't used. If you have a lot of years & months, the list is getting very long. If people click a month they don't realise the result appears below.
Being short: its momentary lay-out isn't very handy and overviewing.

Now what I'd prefer is:

Year (2004)
month, month, month,......
Year (2005)
month, month, month, .........
Year (2006)
month, month, month, .......

I've tried it with: (news_archive.html)
<table>
  <
tr>
    <
th><{$lang_newsarchives}></th>
  </
tr>

    <
tr class="even">
<{foreach 
item=year from=$years}>
    <
td><{$year.number}></td></tr>
    
<{foreach 
item=month from=$year.months}>
    <
tr><td><a href="./archive.php?year=<{$year.number}>&amp;month=<{$month.number}>"><{$month.string}> </a></td>
  </
tr>
  <{/foreach}>
 <{/foreach}>
  
      
</
table>

<{if 
$show_articles == true}>

But this doesn't work out. Some code things are still missing.
Who knows what, where and how?

Any help would be appreciated!

Grtz., Shine

2
Shine
Re: Template: How to adjust news_archive.html? Using its spare space better!
  • 2005/6/17 7:38

  • Shine

  • Just can't stay away

  • Posts: 822

  • Since: 2002/7/22


^ Bump ^

3
Mithrandir
Re: Template: How to adjust news_archive.html? Using its spare space better!

Try something like this:

<table>
  <
tr>
    <
th><{$lang_newsarchives}></th>
  </
tr>

    
<{foreach 
item=year from=$years}>
    <
tr class="even">
    <
td><{$year.number}></td>
    </
tr>
    <
tr class="odd">
    <
td>
<{foreach 
item=month from=$year.months}>
    <
a href="./archive.php?year=<{$year.number}>&month=<{$month.number}>"><{$month.string}> </a>&nbsp;
  <{/foreach}>
    </
td>
  </
tr>
 <{/foreach}>
  
      
</
table>

<{if 
$show_articles == true}>

4
Shine
Re: Template: How to adjust news_archive.html? Using its spare space better!
  • 2005/6/17 7:59

  • Shine

  • Just can't stay away

  • Posts: 822

  • Since: 2002/7/22


Thanks Mith,...Yes, one step further.
But as you can see the years and months are repeating. Which code needs to be added to solve that part?
Resized Image

Grtz., Shine

5
Mithrandir
Re: Template: How to adjust news_archive.html? Using its spare space better!

And there should only be 2004 and 2005?

Try enabling Smarty debug and see how the $year variable is populated

6
Shine
Re: Template: How to adjust news_archive.html? Using its spare space better!
  • 2005/6/17 8:24

  • Shine

  • Just can't stay away

  • Posts: 822

  • Since: 2002/7/22


Quote:
And there should only be 2004 and 2005?

Jep
As soon there is gonna be a new year it ads itself to the list. At the moment there are only the months 2004&2005.

Quote:
Try enabling Smarty debug and see how the $year variable is populated

Active, but to be honest........I don't really understand these messages let alone how to read it and solve the matter.
copying msg:
{$year} Array (2)
number => 2004
months 
=> Array (2)
  
=> Array (2)
    
string => Juni
    number 
=> 6
  5 
=> Array (2)
    
string => Mei
    number 
=> 

{$years} Array (2)
=> Array (2)
  
number => 2005
  months 
=> Array (1)
    
=> Array (2)
      
string => Juni
      number 
=> 6
=> Array (2)
  
number => 2004
  months 
=> Array (2)
    
=> Array (2)
      
string => Juni
      number 
=> 6
    5 
=> Array (2)
      
string => Mei
      number 
=> 5


Grtz., Shine

7
Mithrandir
Re: Template: How to adjust news_archive.html? Using its spare space better!

I can't see why the years are copying themselves unless you have it inside another foreach that is not in my code suggestion.

8
Shine
Re: Template: How to adjust news_archive.html? Using its spare space better!
  • 2005/6/17 9:30

  • Shine

  • Just can't stay away

  • Posts: 822

  • Since: 2002/7/22



Shame on me...........it was indeed my mistake. Although I'd commented out some original foreach lines, looks like he did read those lines still out. (hmz, strange..)

Yes,........it works like a charm. BIG Thanks

Grtz., Shine

9
JamesSAEP
Re: Template: How to adjust news_archive.html? Using its spare space better!
  • 2005/8/8 17:55

  • JamesSAEP

  • Just can't stay away

  • Posts: 732

  • Since: 2005/2/28


This works great!

See it HERE

10
LazyBadger
Re: Template: How to adjust news_archive.html? Using its spare space better!

Maybe months from Jan to Dec will be better, than reverse order?
Quis custodiet ipsos custodes?

Webmaster of
XOOPS2.RU
XOOPS Modules Proving Ground
XOOPS Themes Exhibition

Login

Who's Online

230 user(s) are online (161 user(s) are browsing Support Forums)


Members: 0


Guests: 230


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Apr 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits