Perch support

Question about perch_blog_custom

I have split my blog into 2 categories to allow for 2 separate sections (one is news and another is more a traditional blog) and i'm trying to make the archive list in the right hand column show only the items from that particular category... but for some reason when i try some custom code in there, i just get empty results.

What i'm trying to achive is the same as this:
<?php perch_blog_date_archive_months(); ?>

But instead only listing one specific category.

I tried this:

<?php
$opts = array(
'category'=>'news',
'sort'=>'postDateTime',
'sort-order'=>'DESC',
'template'=>'blog/months_year_link.html'
);
perch_blog_custom($opts);
?>

Which returns absolutely nothing! (well i get the heading taht is in that template file but no links)

Any pointers?
Dan Owen
24 Jun 2012, 07:42 PM
Can you add the following to the bottom of your page and let me know what it outputs?

<?php PerchUtil::output_debug(); ?>
Drew McLellan
22 hours, 53 mins since original post
Hi Drew,

I certainly can! The output was this:

DIAGNOSTICS:
SELECT contentKey, contentHTML
FROM perch_contentItems
WHERE contentPage='/website/world/news/index.php' OR contentPage='*'
SELECT SQL_CALC_FOUND_ROWS DISTINCT p.*
FROM perch_blog_posts p, perch_blog_posts_to_categories p2c, perch_blog_categories c WHERE postStatus='Published' AND postDateTime<='2012-06-25 17:49:00' AND p.postID=p2c.postID AND p2c.categoryID=c.categoryID AND categorySlug IN ('news') ORDER BY postDateTime DESC LIMIT 0, 5
SELECT FOUND_ROWS() AS `count`
SELECT c.*
FROM perch_blog_categories c, perch_blog_posts_to_categories p2c
WHERE c.categoryID=p2c.categoryID
AND p2c.postID='10'
SELECT c.*
FROM perch_blog_categories c, perch_blog_posts_to_categories p2c
WHERE c.categoryID=p2c.categoryID
AND p2c.postID='9'
SELECT c.*
FROM perch_blog_categories c, perch_blog_posts_to_categories p2c
WHERE c.categoryID=p2c.categoryID
AND p2c.postID='8'
SELECT c.*
FROM perch_blog_categories c, perch_blog_posts_to_categories p2c
WHERE c.categoryID=p2c.categoryID
AND p2c.postID='7'
SELECT year(postDateTime) as year, COUNT(*) AS year_qty
FROM perch_blog_posts
WHERE postStatus='Published'
AND postDateTime<='2012-06-25 17:49:00'
GROUP BY year
ORDER BY year DESC
SELECT DISTINCT
year(postDateTime) AS year,
month(postDateTime) AS month,
CONCAT(year(postDateTime),"-",month(postDateTime),"-01") AS postDateTime,
COUNT(*) AS month_qty
FROM perch_blog_posts p
WHERE year(postDateTime) = '2012'
AND p.postStatus='Published'
AND p.postDateTime<='2012-06-25 17:49:00'
GROUP BY year, month
ORDER BY month DESC
Dan Owen
23 hours, 7 mins since original post
Hmm, no errors.

What does your template look like?
Drew McLellan
1 day since original post
Yeah, its a bit odd!
I could have sworn i sorted this before but i cant remember for the life of me what i did.

So the actual news page is here:
http://www.clickteam.com/website/world/news/

As you can see, it lists a few months on the right (using this code: <?php perch_blog_date_archive_months(); ?>) but the problem is that all news items are from this month and its showing archive links to the other category (http://www.clickteam.com/website/world/klikdisc/)

The template i figured it should use for that year/months archive is templates/blog/months_year_link.html and the contents of that are:

<perch:before>
<h3>Archive by Date</h3>
<ul>
</perch:before>
<li><a href="archive.php?year=<perch:blog id="year" />"><perch:blog id="year" /></a>
<perch:blog id="months" encode="false" />
</li>
<perch:after></ul></perch:after>

As i mentioned, i tried this:

<?php
$opts = array(
'category'=>'news',
'sort'=>'postDateTime',
'sort-order'=>'DESC',
'template'=>'blog/months_year_link.html'
);
perch_blog_custom($opts);
?>

But when i do that all i get on the right is "Archive by Date" and no links.
Dan Owen
1 day, 1 hour since original post
This topic is closed