Forum

Thread tagged as: Problem, Runway, Blog

Perch Blog - Archive By Year for second Blog

Hi,

I am utilising the Runway and the Perch Blog App. I have set-up another blog named News.

My templates are fairly standard, but I am witnessing an odd issue.

When I view posts within the archive by category, or tag, everything is fine, but when I try and return entries by date, I start to run into trouble.

Bizarrely, if I return results by month, everything is fine, but as soon as I try and return posts by year, I get the message that the 'Page cannot be found'.

Using:

<?php perch_blog_date_archive_months('news_months_year_link.html', 'news_months_month_link.html'); ?>

or

<?php perch_blog_date_archive_years(); ?>

to return the results makes no difference.

During diagnosis and trying different things (simplifying et al), the issue is further compounded by the fact that:

If I use:

<?php perch_blog_date_archive_years(); ?>I 

to return results with a template (year_link.html)

<perch:before>
<h3>Archive by Date</h3>
<ul>
</perch:before>
    <li><a href="/news/<perch:blog id="year" />"><perch:blog id="year" /> (<perch:blog id="year_qty" />)</a></li>
<perch:after></ul></perch:after>

I get a "Sorry, that page could not be found. THIS IS A 404 Error" message.

Yet, if I change the blog from my new 'news' one to the standard blog, i.e.

<li><a href="/blog/<perch:blog id="year" />"><perch:blog id="year" /> (<perch:blog id="year_qty" />)</a></li>

It returns a listing of ALL the entries from ALL of the blogs.

Oddly, if I use:

<?php perch_blog_date_archive_months('news_months_year_link.html', 'news_months_month_link.html'); ?>

to return results, it still fails when selecting the year, but will return posts for the 'news' blog by month !

Maybe I'm getting the concept wrong, but changing the path to news on say the categories template allows for the correct posts to be returned and within the archive.php pag, I have changed all tblog custom arrays to reflect the specific blog as well.

archive.php

perch_blog_custom(array(
                            'blog'       => 'news',
                            'filter'     => 'postDateTime',
                            'match'      => 'eqbetween',
                            'value'      => $date_from.','.$date_to,
                            'template'   => $template,
                            'count'      => $posts_per_page,
                            'sort'       => $sort_by,
                            'sort-order' => $sort_order,
                            ));

                    $posts_displayed = true;

Not sure what else to try ?

Thanks.

Diagnostics Report


Perch Runway: 3.0.8, PHP: 5.6.31, MySQL: mysqlnd 5.0.11-dev - 20120503 - $Id: 76b08b24596e12d4553bd41fc93cccd5bac2fe7a $, with PDO Server OS: Linux, cgi-fcgi Installed apps: content (3.0.8), assets (3.0.8), categories (3.0.8), perch_blog (5.6.1), perch_events (1.9.5), perch_forms (1.9), perch_shop_orders (1.2.3), perch_shop_products (1.2.3), perch_shop (1.2.3), perch_members (1.6.2), perch_twitter (3.7) App runtimes: <?php $apps_list = [ 'perch_blog', 'perch_twitter', 'perch_events', 'perch_forms', 'perch_members', 'perch_shop', ]; PERCH_LOGINPATH: /admin PERCH_PATH: /home/auk/public_html/admin PERCH_CORE: /home/auk/public_html/admin/core PERCH_RESFILEPATH: /home/auk/public_html/admin/resources Image manipulation: GD Imagick PHP limits: Max upload 12M, Max POST 12M, Memory: 64M, Total max file upload: 12M F1: 0c66c2e1f82f9e0b7617b2cb8270f2c7 Resource folder writeable: Yes DOCUMENT_ROOT: /home/auk/public_html HTTP_HOST: anticoagulationuk.org REQUEST_URI: /admin/core/settings/diagnostics/ SCRIPT_NAME: /admin/core/settings/diagnostics/index.php

Ahh, literally, as I was about to send I thought about routes. It seems the route:

blog/[year:year]

exists, but:

news/[year:year]

does not.

This should be automatically created when a new 'blog' is created ? Cannot remember if I had to set these up manually ???

Andrew Kennedy

Andrew Kennedy 0 points

  • 4 years ago

Yes, adding:

news/[year:year]

to my news archive page has done the trick.

Darn it, if I was just 5 more minutes from pressing send on the above, I could have saved myself a whole lot of typing.....and embarrassment.

I will leave the post on the forum, as hopefully it helps somebody else.

Double and then triple check set-up !!!!

Grrr Routes, I knew it !!!