How to show records for specified year and month only

17 posts by 2 authors in: Forums > CMS Builder
Last Post: January 12, 2008   (RSS)

Re: [grauchut] Does CMS Builder limit amount of content per page?

By Dave - January 10, 2008

We'd have to write you a little MySQL where query for that, but yes. You can have a viewer with an url like this:

list.php?year=2007&mon=1

or

list.php/2007/01/

And then filter the records with that so we only show records in January 2007.
Dave Edis - Senior Developer
interactivetools.com

Re: [Dave] Does CMS Builder limit amount of content per page?

Dave that would be great.
Glenn Rauchut (Owner) Emergency Designz

Re: [grauchut] Does CMS Builder limit amount of content per page?

By Dave - January 11, 2008

In your list viewer, below the line that says "$options = array();" add the following. Note: If your date field is called something other than 'date' then insert your fieldname instead.

// custom search filter
$where = "";
if (@$FORM['year'] && @$FORM['mon']) {
$escapedYear = escapeMysqlString($FORM['year']);
$escapedMon = escapeMysqlString($FORM['mon']);
$where = "YEAR(date) = '$escapedYear' AND MONTH(date) = '$escapedMon'";
}


Then update the where option like this:

$options['where'] = $where;

Then you'll be able to list records with certain dates like this: listViewer.php?year=2007&mon=12

Hope that helps!
Dave Edis - Senior Developer
interactivetools.com

Re: [Dave] Does CMS Builder limit amount of content per page?

After I add this how do I set it up say if I have a table with all 12 months in it and you click on December. How will it know to find all items with that month. I Know it would be linked by month but what code do I need for the link to work.
Glenn Rauchut (Owner) Emergency Designz

Re: [grauchut] Does CMS Builder limit amount of content per page?

I get this error

List Viewer (index): Invalid page number '06', there are only '1' pages!
Glenn Rauchut (Owner) Emergency Designz

Re: [grauchut] Does CMS Builder limit amount of content per page?

By Dave - January 12, 2008

Sorry, it's thinking the number on the end is the page number, try this:

list.php?year=2007&mon=1&page=1

or, if you want that viewer to always show _all_ the results for the specified date then you can hardcode it like this:

$options['perPage'] = '9999';
$options['pageNum'] = '1'

Dave Edis - Senior Developer
interactivetools.com

Re: [Dave] Does CMS Builder limit amount of content per page?

your the man thanks it works great. some day I might not bug ya about something [laugh]

How can I get the thumbnail size and width to change. I changed it in the modify section but it still appears the same size?
Glenn Rauchut (Owner) Emergency Designz

Re: [grauchut] Does CMS Builder limit amount of content per page?

By Dave - January 12, 2008

It changes the size of thumbnails for new uploads. Since it could take a long time to resize them all automatically if you had hundreds.

Do you have many images that you need to resize to the new size?
Dave Edis - Senior Developer
interactivetools.com

Re: [Dave] Does CMS Builder limit amount of content per page?

How can I get the height and width I choose in modify to be the size the thumbnails are on the page. say width 250 height 188.

Also the link works but it shows all incidents on the main page. I did a test with one for the year 2012 and I have the link set to 2007.
Glenn Rauchut (Owner) Emergency Designz