Forum

Thread tagged as: Question

Category list

I have created a set of categories, and I would like to display item in a category list with a photo and title. As of now, I can add a tag/slug to a page, and displaying it with a link. But the link return with 404.

I read the instructions in category/categories, but kind of hit the wall.

Can anyone get me to the right direction. A sample page and template perhaps?

This is what I have so far in my template.

<perch:categories id="destinations" label="Tag" set="destinations" required="true">
  <perch:before>
  <h3>Test title</h3>
  <ul>
  </perch:before>
  <li><a href="/category/<perch:category id="catPath" />"><perch:category id="catTitle" /></a></li>
  <perch:after>
  </ul>
  </perch:after>
</perch:categories>

My page template

                                <?php perch_content_create('Subpages left content', array(
                                'template' => 'subpages/subpages_left_column.html',
                                'multiple' => false,
                                'edit-mode' => 'listdetail',
                                'sort' => 'date',
                                'sort-order' => 'DESC',
                                'searchable' => false,
                                'filter' => 'slug',
                                'match' => 'eq',
                                'value' => perch_get('s'),
                                'count' => 1,
                                ));
                                perch_content_custom('Subpages left content', array(
                                'skip-template' => false,
                                'template'=>'subpages/subpages_left_column.html'
                                ));
                                $pagetitle = perch_pages_title(true);
                                PerchSystem::set_vars(['title_returned' => $pagetitle,
                                ]);
                                perch_content_custom('Subpages left content', array(
                                'page'=>'/destinations/*',
                                'template'=>'widgets/rating_product_title.html',
                                ));
                                ?>
                                <?php
                                perch_comments('subpages', [
                                'template' => 'comment.html',
                                'sort-order' => 'DESC',
                                ]);
                                perch_comments_form('subpages', 'Destinations');
                                ?>
Edward Johansen

Edward Johansen 0 points

  • 3 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

But the link return with 404.

What's the URL you're getting, and what URL have you set up a page for?

The URL displayed is /category/destinations/beaches/

Drew McLellan

Drew McLellan 2638 points
Perch Support

Do you have a route set up to handle that URL?

Not really. How can I set up a route?

Drew McLellan

Drew McLellan 2638 points
Perch Support

Can you post your diagnostics report?

Diagnostic report

Perch Runway: 3.0.14
Production mode: Production (100)
Installed apps: content (3.0.14), assets (3.0.14), categories (3.0.14), perch_comments (1.2.1)
DB driver: PDO
DB tables: perch3_backup_plans (0), perch3_backup_resources (0), perch3_backup_runs (0), perch3_categories (2), perch3_category_counts (0), perch3_category_sets (1), perch3_collection_index (0), perch3_collection_items (0), perch3_collection_revisions (0), perch3_collections (0), perch3_comments (1), perch3_comments_votes (0), perch3_content_index (897), perch3_content_items (86), perch3_content_locks (0), perch3_content_regions (12), perch3_menu_items (9), perch3_navigation (0), perch3_navigation_pages (0), perch3_page_routes (0), perch3_page_templates (10), perch3_pages (5), perch3_resource_log (1349), perch3_resource_tags (0), perch3_resources (276), perch3_resources_to_tags (0), perch3_settings (23), perch3_user_passwords (0), perch3_user_privileges (31), perch3_user_role_buckets (0), perch3_user_role_privileges (2), perch3_user_roles (2), perch3_users (1)
Users: 1
App runtimes:
<?php
    $apps_list = array(
        'perch_comments',

    );
?>
Scheduled tasks for perch_comments: delete_spam_comments (1440 mins)
Editor plug-ins:
H1: fcaff1308dee356f3127acd5bfabdd7b
L1: 696f824b0a12ded600a38ed45eaee28a
F1: 3b606135b33e6a102526838f4152a807
headerColour: #000000
content_singlePageEdit: 1
helpURL:
siteURL: /
hideBranding: 1
content_collapseList: 1
lang: en-gb
installedAt: 3.0.13
update_3.0.13: done
update_runway_3.0.14: done
headerScheme: dark
update_runway_3.0.13: done
latest_version:
on_sale_version:
dashboard: 0
sidebar_back_link: 1
hide_pwd_reset: 0
keyboardShortcuts: 0
siteOffline: 0
content_hideNonEditableRegions: 1
content_frontend_edit: 0
content_skip_region_list: 0
assets_restrict_buckets: 1
PERCH_DEVELOPMENT: 10
PERCH_STAGING: 50
PERCH_PRODUCTION: 100
PERCH_SITEPATH: /var/www/vhosts/httpdocs
PERCH_SCHEDULE_SECRET: YcvVU6cow2ybREkf
PERCH_DB_USERNAME: pdestinations
PERCH_DB_SERVER: localhost
PERCH_DB_DATABASE: pdestinations_
PERCH_DB_PREFIX: perch3_
PERCH_EMAIL_FROM: eduardo@myenail
PERCH_EMAIL_FROM_NAME: Edward
PERCH_LOGINPATH: /pdadmin
PERCH_PATH: /var/www/vhosts/mywebsite.com/httpdocs/pdadmin
PERCH_CORE: /var/www/vhosts/mywebsite.com/httpdocs/pdadmin/core
PERCH_SSL: 1
PERCH_RESFILEPATH: /var/www/vhosts/mywebsite.com/httpdocs/pdadmin/resources
PERCH_RESPATH: /pdadmin/resources
PERCH_RWD: 1
PERCH_HTML5: 1
PERCH_TZ: UTC
PERCH_HTML_ENTITIES: 1
PERCH_SITE_BEHIND_LOGIN: 1
PERCH_DEBUG: 1
PERCH_RUNWAY: 1
PERCH_ERROR_MODE: DIE
PERCH_DATE_LONG: %d %B %Y
PERCH_DATE_SHORT: %d %b %Y
PERCH_TIME_SHORT: %H:%M
PERCH_TIME_LONG: %H:%M:%S
PERCH_RUNWAY_ROUTED:
PERCH_STRONG_PASSWORDS:
PERCH_ASSET_VERSION: f704e7442d11292c99b5
PERCH_PREVIEW_ARG: preview
PERCH_TEMPLATE_PATH: /var/www/vhosts/mywebsite.com/httpdocs/pdadmin/templates
PERCH_TEMPLATE_FILTERS:
PERCH_DEFAULT_DOC: index.php
PERCH_DEFAULT_EXT: .php
PERCH_PRODUCTION_MODE: 100
PERCH_XHTML_MARKUP:
PERCH_STRIPSLASHES:
PERCH_PROGRESSIVE_FLUSH: 1
PERCH_PARANOID:
PERCH_FORCE_SECURE_COOKIES:
PERCH_DEFAULT_BUCKET: default
PERCH_TRANSLATION_ASSIST:
PERCH_PASSWORD_MIN_LENGTH: 6
PERCH_MAX_FAILED_LOGINS: 10
PERCH_AUTH_LOCKOUT_DURATION: 1 HOUR
PERCH_VERIFY_UPLOADS:
PERCH_PRIV_ASSIST:
PERCH_CUSTOM_EDITOR_CONFIGS:
PERCH_ENABLE_EXIF: 1
PERCH_AUTH_PLUGIN:
PERCH_DB_CHARSET: utf8
PERCH_DB_PORT:
PERCH_DB_SOCKET:
PERCH_APPS_EDITOR_PLUGIN: markitup
PERCH_APPS_EDITOR_MARKUP_LANGUAGE: markdown
Hosting settings
PHP: 7.1.15
Zend: 3.1.0
OS: Linux
SAPI: cgi-fcgi
Safe mode: not detected
MySQL client: mysqlnd 5.0.12-dev - 20150407 - $Id: 38fea24f2847fa7519001be390c98ae0acafe387 $
MySQL server: 5.5.56-MariaDB
Free disk space: 61.05 GB
Extensions: Core, date, libxml, openssl, pcre, zlib, bz2, calendar, ctype, hash, filter, ftp, gettext, gmp, SPL, iconv, pcntl, readline, Reflection, session, standard, SimpleXML, sockets, mbstring, tokenizer, xml, cgi-fcgi, mysqlnd, bcmath, curl, dba, dom, enchant, fileinfo, gd, imagick, imap, intl, json, ldap, exif, mcrypt, mysqli, odbc, PDO, pdo_mysql, PDO_ODBC, pdo_pgsql, pdo_sqlite, pgsql, Phar, posix, pspell, redis, soap, sqlite3, sysvmsg, sysvsem, sysvshm, tidy, xmlreader, xmlrpc, xmlwriter, xsl, zip, ionCube Loader, Zend OPcache
GD: Yes
ImageMagick: Yes
PHP max upload size: 128M
PHP max form post size: 128M
PHP memory limit: 256M
Total max uploadable file size: 128M
Resource folder writeable: Yes
Session timeout: 24 minutes
Native JSON: Yes
Filter functions: Yes
Transliteration functions: Yes
PATH: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin
PP_CUSTOM_PHP_INI: /var/www/vhosts/system/mywebsite.com/etc/php.ini
PP_CUSTOM_PHP_CGI_INDEX: plesk-php71-fastcgi
SCRIPT_NAME: /pdadmin/core/settings/diagnostics/index.php
REQUEST_URI: /pdadmin/core/settings/diagnostics/?extended
QUERY_STRING: extended
REQUEST_METHOD: GET
SERVER_PROTOCOL: HTTP/1.0
GATEWAY_INTERFACE: CGI/1.1
REMOTE_PORT: 42822
SCRIPT_FILENAME: /var/www/vhosts/mywebsite.com/httpdocs/pdadmin/core/settings/diagnostics/index.php
SERVER_ADMIN: verzosa@hotmail.com
CONTEXT_DOCUMENT_ROOT: /var/www/vhosts/mywebsite.com/httpdocs
REQUEST_SCHEME: https
DOCUMENT_ROOT: /var/www/vhosts/mywebsite.com/httpdocs
REMOTE_ADDR: 82.2.78.216
SERVER_PORT: 443
SERVER_ADDR: 212.48.70.61
SERVER_NAME: mywebsite.com
SERVER_SOFTWARE: Apache
HTTP_COOKIE: cmsa=1; PHPSESSID=ptrd4er3o3smn8lv8147mcccfl
HTTP_ACCEPT_LANGUAGE: en-GB,en-US;q=0.9,en;q=0.8
HTTP_ACCEPT_ENCODING: gzip, deflate, br
HTTP_REFERER: https://mywebsite.com/pdadmin/core/settings/diagnostics/
HTTP_ACCEPT: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8
HTTP_USER_AGENT: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.186 Safari/537.36
HTTP_UPGRADE_INSECURE_REQUESTS: 1
HTTP_CONNECTION: close
HTTP_X_ACCEL_INTERNAL: /internal-nginx-static-location
HTTP_X_REAL_IP: 82.2.78.216
HTTP_HOST: mywebsite.com
HTTPS: on
PERL5LIB: /usr/share/awstats/lib:/usr/share/awstats/plugins
SCRIPT_URI: https://mywebsite.com/pdadmin/core/settings/diagnostics/
SCRIPT_URL: /pdadmin/core/settings/diagnostics/
UNIQUE_ID: WrE8igIvapYamqoXnylNQAAAAJI
FCGI_ROLE: RESPONDER
PHP_SELF: /pdadmin/core/settings/diagnostics/index.php
REQUEST_TIME_FLOAT: 1521564810.6758
REQUEST_TIME: 1521564810
Drew McLellan

Drew McLellan 2638 points
Perch Support

Ok, so you'd create a master page to display content based on the category and then add a route such as

category/[slug/slug:catPath]

Don't you have a full tutorial on how to create this. With sample pages and templates. I have tried this: https://docs.grabaperch.com/video/v/portfolio-with-categories/ but I cannot simply get it to work.

Drew McLellan

Drew McLellan 2638 points
Perch Support

We don't have a full tutorial for every task someone might need. Where are you running into problems?