Forum

Thread tagged as: Question, Problem, Runway

URL pattern in Category

Hi! I have been working on upgrading one of my sites from Perch 2 to Runway. I've updated to Runway on a staging site and imported all the stories from the region they previously were in to a a collection. Everything seems to be working great at this point, except that I am running into an issue in that the URL pattern changes incorrectly when jumping from page to page within a category.

It's a local news website with different categories. So for example, when I go to the church category, the URL is /aprunway17/category.php?cat=news/church/. What I want to happen when I click on the "Next" link is for "&page=2" to be added to the end of the URL. What actually happens is "/aprunway17/&page=2." I have looked everywhere I can think of to find the solution to this and tried everything I've found, and I'm stuck. What really baffles me is that I copied these pages and templates exactly from the live site that is currently running Perch 2 and it works as it should there.

I'm sure I am missing something so easy .... or at least I hope that is the case. Any help would be much appreciated!

Here is the relevant portion of category.php:

<?php    
perch_category(perch_get('cat'), array(
        'template' => 'category_single.html'
    ));
        ?>
            <br>
<?php

 perch_collection('Stories', array(
        'category' => perch_get('cat'),
    'sort' => 'postDateTime',
    'sort-order' => 'DESC',
    'template' => 'story_listing.html',
        'filter' => 'hide',
        'match' => 'neq',
        'value' => true,
    'paginate'=>true,
       'count'=>10
    ));


    ?>

Here is category_single.html:

<h1><perch:category id="catTitle" type="smarttext" label="title" required="true" /></h1>

<perch:category id="desc" type="textarea" label="Description" editor="markitup" html="true" markdown="true" size="s" />

    <perch:category id="catSlug" type="slug" for="catTitle" suppress="true" />

<perch:after>

       <perch:if exists="paging">
  <div class="paging">

    <perch:if exists="not_first_page">
      <a href="<perch:content id="prev_url" type="hidden" encode="false" />">PreviousPage</a>&nbsp;&nbsp;
    </perch:if> 
    Page <perch:content id="current_page" type="hidden" /> of <perch:content id="number_of_pages" type="hidden" />
    <perch:content id="page_links" encode="false" type="hidden" />
    <perch:if exists="not_last_page">
      &nbsp;&nbsp;<a href="<perch:content id="next_url" type="hidden" encode="false" />">NextPage</a>
    </perch:if>
  </div>
</perch:if>





</perch:after>

Here is story_listing.html:

<perch:before>
</perch:before>

   <perch:if exists="featuredimage">
<img src="<perch:content id="featuredimage" type="image" label="Featured Image" suppress="false" />" width="300" class="img-responsive" />
</perch:if>

   <perch:if exists="listimage">
<img src="<perch:content id="listimage" type="image" label="Gallery image for listing page" suppress="false" />"  width="300" class="img-responsive" />
</perch:if>

<h3><a href="detail.php?s=<perch:content id="slug" type="slug" />"><perch:content id="title" type="text" label="Title" required="true" title="true" /></a></h3>

<perch:content id="excerpt" type="textarea" label="Excerpt" markdown="true" html="true" editor="markitup" /><br>


<a href="detail.php?s=<perch:content id="slug" type="slug" />"><button type="button" class="btn btn-lg btn-default">Read More</button></a>

<br>
<br>




<perch:after><br>
<br>

 <perch:if exists="paging">
  <div class="paging">

    <perch:if exists="not_first_page">
      <a href="<perch:content id="prev_url" type="hidden" encode="false" />">Previous</a>&nbsp;&nbsp;
    </perch:if> 
    Page <perch:content id="current_page" type="hidden" /> of <perch:content id="number_of_pages" type="hidden" />
    <perch:content id="page_links" encode="false" type="hidden" />
    <perch:if exists="not_last_page">
      &nbsp;&nbsp;<a href="<perch:content id="next_url" type="hidden" encode="false" />">Next</a>
    </perch:if>
  </div>
</perch:if>
</perch:after>

Here is my diagnostic report:

Perch Runway: 3.0.8, PHP: 5.4.45, MySQL: 5.6.35, with PDO
Server OS: Linux, cgi-fcgi
Installed apps: content (3.0.8), assets (3.0.8), categories (3.0.8), perch_events (1.9.3), perch_comments (1.2), perch_backup (1.2), perch_mailchimp (3.0.1)
App runtimes: <?php $apps_list = array( 'perch_comments', 'perch_events', 'perch_mailchimp', );
PERCH_LOGINPATH: /aprunway17/perch
PERCH_PATH: /home/jstahr99/public_html/aprunway17/perch
PERCH_CORE: /home/jstahr99/public_html/aprunway17/perch/core
PERCH_RESFILEPATH: /home/jstahr99/public_html/aprunway17/perch/resources
Image manipulation: GD Imagick
PHP limits: Max upload 128M, Max POST 64M, Memory: 256M, Total max file upload: 64M
F1: 0c66c2e1f82f9e0b7617b2cb8270f2c7
Resource folder writeable: Yes
SCRIPT_NAME: /aprunway17/perch/core/settings/diagnostics/index.php
REQUEST_URI: /aprunway17/perch/core/settings/diagnostics/
DOCUMENT_ROOT: /home/jstahr99/public_html
HTTP_HOST: move.stahrfamilydesign.com

Thank you again for any help you can offer!

Janel Stahr

Janel Stahr 0 points

  • 4 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

Have you moved your master pages into templates/pages or are you still working with files out in the site?

Still working with files in the site. I'll give that a shot today and see if that helps.

Hi, Drew. That doesn't seem to change anything. Do ALL my pages need to be moved to master pages?

I am only moving to Runway because of the excessive amount of stories in the region. I think it would be better suited for Runway. But that's literally the only thing that is causing/will cause an issue.

If I type in "/aprunway17/category.php?cat=news/church/&page=2" it works as expected. It's only the Next and Previous links in the paging that aren't working correctly.

Use

<perch:showall />

in one of your templates to see if it's pulling the prev and next pages correctly

Drew McLellan

Drew McLellan 2638 points
Perch Support

No, you shouldn't need to change all pages. I would have expected the URL to be correctly generated on a properly routed page.

I'll have to test and see what it does if I create a route with a file extension in the path. That's obviously fairly uncommon, so could be the factor.

Lexi McGee said:

Use

<perch:showall />

in one of your templates to see if it's pulling the prev and next pages correctly

Thanks, Lexi. I did try that. I get "?page=2" on the Next link (which goes nowhere) and nothing on the Previous link when I look at the later pages in the category .... which is all odd because earlier today I was getting "&page=2." That's what I'm going to need AFTER it pulls the category.

Drew McLellan said:

No, you shouldn't need to change all pages. I would have expected the URL to be correctly generated on a properly routed page.

I'll have to test and see what it does if I create a route with a file extension in the path. That's obviously fairly uncommon, so could be the factor.

Drew, I've looked at the info on routing and URL patterns and tried several things. I guess maybe I'm not understanding how to set that up to get both the category and the page number. I'm sorry .... I read and tried, and tried and read, for 2 days before I even posted here!

Drew McLellan

Drew McLellan 2638 points
Perch Support

No, I think that should be fine, it's something I need to look into.

Hi, Drew! Any luck with this? No pressure! I just don't want this to get marked as closed too soon :)

Drew McLellan

Drew McLellan 2638 points
Perch Support

It's only been a day, so no, I've not looked into it yet.

Hi, Drew. Sorry to bother you again ... just checking in to see if there's been any progress on this. Thanks.

Hi, Drew. It's been about a month and I haven't heard anything back. Have you had a chance to look into this? I'd really love to switch this client over to Runway, but I need this to be resolved first. Please let me know. Thank you.

Drew McLellan

Drew McLellan 2638 points
Perch Support

Are all your pages now fully routed?

No. I have not done anything else with it. I had mentioned above that after reading all I could find on routing, I didn't understand how to do both the category and the page number.

Is it possible that there was an issue upgrading from Perch 2 to Perch Runway 3? Maybe I should have upgraded to Perch 3 first before Runway 3?