
dwelling
User
Jan 24, 2012, 5:27 AM
Post #1 of 3
(702 views)
Shortcut
|
|
Another Blog Question - Archives
|
Can't Post
|
|
One more question pertaining to the blog I'm creating. :-) You can see the my sample page here: http://www.ihelpinc.net/Blog/category.php The main blog list is here: http://www.ihelpinc.net/Blog/index.php In order to create an archive function of the blog (to list blog posts by month and year, etc.), I used the suggestion given here: http://www.interactivetools.com/iforum/gforum.cgi?post=83311;search_string=blog;t=search_engine#83311. (THANKS DONNA!) :-) It works great. However, I seem to be experiencing an unwanted effect when selecting a date from the archive. ** When clicking an "archive" link (such as "January 2012"), not only does the page display a list of all blog posts from January 2012 (which is correct), but the "Recent Posts" list is also filtered. Obviously, we want the "Recent Posts" to always show the same recent posts and not be changed or filtered by selections made in the "Archive" or "Category" sections. Is there a way to close off the "Recent Posts" section to keep it from being affected by "Archive" or "Category" selections? Here is some of the code I'm using:
FROM PAGE TOP: // load records list($blog_contentRecords, $blog_contentMetaData) = getRecords(array( 'tableName' => 'blog_content', 'loadUploads' => '0', )); $blog_contentRecord = @$blog_contentRecords[0]; // get first record // load records list($blog_categoriesRecords, $blog_categoriesMetaData) = getRecords(array( 'tableName' => 'blog_categories', 'loadUploads' => '0', 'allowSearch' => '0', )); FROM PAGE BODY: <!-- RECENT POSTS MODULE --> <div id="BigRightBottom"> <h3 style="margin-left:-10px; color:#333;">RECENT POSTS</h3> <?php // load records list($blog_contentRecords, $blog_contentMetaData) = getRecords(array( 'tableName' => 'blog_content', 'limit' => '7', 'loadUploads' => '0', )); ?> <p style="margin: 0px 10px 0px 10px;"> <?php foreach ($blog_contentRecords as $record): ?> <a href="<?php echo $record['_link'] ?>"><?php echo $record['title'] ?></a><br /> <?php endforeach ?> </p> </div> <!-- /end RECENT POSTS MODULE --> <!-- BLOG ARCHIVE MODULE --> <div id="BigRightBottom"> <h3 style="margin-left:-10px; color:#333;">ARCHIVE</h3> <p style="margin: 0px 10px 0px 10px;"> <?php require_once "/home/content/66/8739966/html/cmsAdmin/lib/viewer_functions.php"; ?> <?php // get list of unique months and years with articles $query = "SELECT DATE_FORMAT(date, '%M %Y') as dateAndYear, YEAR(date) as year, MONTH(date) as month FROM cms_blog_content GROUP BY dateAndYear ORDER BY date DESC"; $result = mysql_query($query) or die("MySQL Error: ". htmlspecialchars(mysql_error()) . "\n"); while ($record = mysql_fetch_assoc($result)): ?> <a href="index.php?date_year=<?php echo $record['year'] ?>&date_month=<?php echo $record['month'] ?>"><?php echo $record['dateAndYear']; ?></a><br/> <?php endwhile ?> </p> </div> <!-- /end BLOG ARCHIVE MODULE --> Thanks for any assistance! Kindest regards, Jeremy
|