List Filtering Question

4 posts by 3 authors in: Forums > CMS Builder
Last Post: June 19, 2009   (RSS)

By greatjakes - June 18, 2009

hi, I have news list page that is sorted by date. Here is link to the mockup page: http://gjdemo.com/irving/news.htm
I want to display the years from the date field as links and filter the page by year when the link is clicked.(Ex: View All, 2009, 2008, 2007 and so on).
I was wondering if there is a way to achieve this without having to create different viewpages for each year? Thanks!

This is what I have for the list page -

<?php foreach ($newsRecords as $record): ?>
php echo date("m/d/y", strtotime($record['date'])) ?>
<a href="<?php echo $record['_link'] ?>"><?php echo $record['title'] ?></a>
<?php endforeach; ?>

Re: [greatjakes] List Filtering Question

By ross - June 18, 2009

Hi there.

Thanks for posting!

What stage are you at here? It's going to be best to break this down into smaller pieces.

I would start with getting a list of the years to appear down the left side. Once you get that going, we can figure out what the link should be.

Do you already have the years appearing? Let me know :).
-----------------------------------------------------------
Cheers,
Ross Fairbairn - Consulting
consulting@interactivetools.com

Hire me! Save time by getting our experts to help with your project.
Template changes, advanced features, full integration, whatever you
need. Whether you need one hour or fifty, get it done fast with
Priority Consulting: http://www.interactivetools.com/consulting/

Re: [ross] List Filtering Question

By greatjakes - June 19, 2009

Hi Ross,
I'm having difficulty getting the years to appear on the left side. Tried putting below code, but it doesn't list all the years -
<?php foreach ($newsRecords as $record): ?>
<?php echo date("Y", strtotime($record['date'])) ?>
<?php endforeach; ?>

Can't seem to figure out what code would make the list to appear correctl. I would appreciate it if you can help me figure out how to get this to work, Thanks.