Forum

Thread tagged as: Problem, Error, Configuration

Categories

Hello

Got myself in a bit of a pickle again with my categories and filtering and some help would be greatly appreciated!

Using Portfolio / detail / categories.

Have a page /galleries.php which lists a set of different albums (categories) When click on one of categories I need it to list all my portfolio items in that category and not all of them.

Tried a few things but cannot work out where I am going wrong.

galleries.php

<?php perch_categories(array(
                        'set'=> 'albums',
                        'template' => 'category_album.html',

                    )); 

     ?>

category_album.php...

<perch:before><ul class="glist albumdisplay"></perch:before>
<li style="list-style:none !important">
    <a href="/portfolio.php?s=<perch:category id="catPath" suppress="true" />">
<img src="<perch:category id="catImage" type="image" required="true" label="Select an album image" order="2" />" height="200px" style="max-width:330px" crop="true" quality="100" alt="<perch:category id="catTitle" label="Album Title" order="1" />" />
</a>
    <h4 style="margin-top:0px;"><a href="/portfolio.php/albums?s=<perch:category id="catSlug" />"><perch:category id="catTitle" type="smarttext" /></a></h4>
</li>
<perch:after></ul></perch:after>

portfolio.php

<?php
    perch_content_create('Portfolio', array(
      'template'   => 'portfolio_item.html',
      'multiple'    => true,
      'edit-mode' => 'listdetail',
    ));

    perch_content_custom('Portfolio', array(
      'template' => 'portfolio_listing.html',
    ));
    ?>

Thankyou.

Denise Courtney

Denise Courtney 0 points

  • 6 years ago
Rachel Andrew

Rachel Andrew 394 points
Perch Support

So what is happening when you use the code you have?

Have you turned on debug so you can see what Perch is returning from the database for any query?

Hi Rachel

Its out putting all items rather than just those in the category selected.

Debug Message SELECT u.*, r.* FROM perch2_users u, perch2_user_roles r WHERE u.roleID=r.roleID AND u.userEnabled=1 AND u.userID=1 AND u.userHash='ad3a5e89fbd083d38ea390fae79d23bd' LIMIT 1 UPDATE perch2_users SET userHash='e556aee1fe1c65217b51707b529b57f7' WHERE userID=1 SELECT p.privKey FROM perch2_user_privileges p SELECT * FROM (SELECT DISTINCT settingID, settingValue FROM perch2_settings WHERE userID=1 OR userID=0 ORDER BY userID DESC) AS settings GROUP BY settingID SELECT * FROM perch2_category_sets WHERE setID=8 LIMIT 1 SELECT c.*, (SELECT COUNT(*) FROM perch2_categories WHERE catParentID=c.catID) AS subcats FROM perch2_categories c WHERE setID=8 ORDER BY catTreePosition ASC Queries: 7 Memory: 3.3226

Drew McLellan

Drew McLellan 2638 points
Perch Support

/portfolio.php?s=<perch:category id="catPath" suppress="true" />

remove suppress="true" or it won't output.