I've seen plenty examples of using the uri segment like below, but it ain't working for me, anyone had same sort of issue?

{% set segment = craft.request.segment(2) %}
{% set pageCats = craft.categories('photoCategories').slug('segment') %}
{% set entries = craft.assets.group('photoUpload').relatedTo(pageCats).find() %}

{% for entry in entries %}
    {{ entry.stuff }}
{% endfor %}

It works if I hard code the segment name .slug('skateboards') and the segment does render when {{ segment }} on other areas of the same page.


Try removing the ' ' from segment in line 2


{% set pageCats = craft.categories('photoCategories').slug(segment) %}
  • yes, that worked, and i was sure i'd checked that too! – Samsull Jan 29 '15 at 14:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.