Re: [northernpenguin] Display Results of Two filters on the Same List Page
Hi Ragi,
I'm a little confused as to the issue. I took a look at your page. As I selected articles from the sidebar, I didn't notice any change in the articles in the sidebar. Is that right, or is that the problem?
One thing I noticed in your code that is probably causing confusion is the reuse of variables.
For example, starting on line 20 you have this code:
list($recent_news_articlesRecords, $recent_news_articlesMetaData) = getRecords(array(
'tableName' => 'recent_news_articles',
'loadUploads' => '0',
'where' => 'datediff(publishDate, curdate()) > -365',
));
Then below on line 51 you have this code:
list($recent_news_articlesRecords, $recent_news_articlesMetaData) = getRecords(array(
'tableName' => 'recent_news_articles',
'where' => 'datediff(publishDate, curdate()) > -365',
));
Since they both use the name $recent_news_articlesRecords the second query will overwrite anything that was in the first query. Since the first instance the of variable was never used, the entire first query isn't needed.
A little while later on line 71 you have this:
list($recent_news_articlesRecords, $recent_news_articlesMetaData) = getRecords(array(
'tableName' => 'recent_news_articles',
'where' => whereRecordNumberInUrl(),
Although this is a different query, it still uses the variable name $recent_news_articlesRecords. This will overwrite everything from the second query. This can make it very difficult to figure out what the variable actually stores at any given time. If you require multiple queries, it's a good practice to use different variable names so you can always tell which one you're referencing.
If you could also give some more clarification to the nature of this problem, I can take a closer look.
Hope this helps.
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com
Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/