Smarty New Template Help

For questions and problems with the CMS core. This board is NOT for any 3rd party modules, addons, PHP scripts or anything NOT distributed with the CMS made simple package itself.
Locked
Kavrick

Smarty New Template Help

Post by Kavrick »

Hi - Just wondering if anyone can help me with a news template? I need to be able to group news by month (just like this http://www.dundeereit.com/NewsEvents-PressRel2006.html) and am not sure where to start.

Code samples or links would be greatly appreciated.

Cheers,

David
User avatar
Dr.CSS
Moderator
Moderator
Posts: 12711
Joined: Thu Mar 09, 2006 5:32 am

Re: Smarty New Template Help

Post by Dr.CSS »

You could put them in monthly categories and call the categories in each div...
Kavrick

Re: Smarty New Template Help

Post by Kavrick »

Wow - I wrote that late last night and wasn't nearly specific enough... Sorry about that Mark.

I've actually already got my news posts in categories by month... What I was hoping for was a way for the press release page to recognise the current month and start displaying the previous month's entries by working backwards from the current month.

I'm really just looking to simplify the admin of this page.

Is there a way for Smarty to grab the current month (based on server values) and then just display backwards from there?

Let me know if I'm not making any sense!

David
tsw
Power Poster
Power Poster
Posts: 1408
Joined: Tue Dec 13, 2005 10:50 pm

Re: Smarty New Template Help

Post by tsw »

iirc $smarty.now has current datetime and you can of course specify only moth with something like $smarty.now|date_format %m, but check the right syntax from smarty manual
Kavrick

Re: Smarty New Template Help

Post by Kavrick »

Thanks for the suggestions... Any good links to Smarty Tutorials?

David
cyberman

Re: Smarty New Template Help

Post by cyberman »

Kavrick

Re: Smarty New Template Help

Post by Kavrick »

Thanks for everyone's suggestions. I got it figured out and thought I'd share. Before anyone rips into me about using tables... I know. This was a time sensitive thing and I had to blast it up quick. I'll convert it to CSS later... I swear!  ;)

Since I have each press release categorized by Year, Month I created this little template and essentially made 12 calls to each individual monthly category.

The Template looks like this...

{foreach name="dategroup" from=$items item=entry}
{if $smarty.foreach.dategroup.first}



{$entry->category}





 
{$entry->formatpostdate}
{$entry->titlelink} {$entry->morelink}
 




{else}

 
{$entry->formatpostdate}
{$entry->titlelink} {$entry->morelink}
 




{/if}
{if $smarty.foreach.dategroup.last}

{/if}
{/foreach}

You can actually see the result here... http://www.instoragereit.ca/pressroom

As they add releases, they will show automagically based on the month! Yippeee

Anyway, not the cleanest solution but it works for now!
User avatar
Dr.CSS
Moderator
Moderator
Posts: 12711
Joined: Thu Mar 09, 2006 5:32 am

Re: Smarty New Template Help

Post by Dr.CSS »

Came out real nice..... but...

The pressroom page has 131 errors not valid... http://validator.w3.org/check?verbose=1 ... essroom%2F

and the article itself... 86... http://validator.w3.org/check?verbose=1 ... F6%2F32%2F
Locked

Return to “CMSMS Core”