Answers.Body: <p>Try removing the ' ' from segment in line 2</p>
  
  <p>e.g. </p>
  
  <pre><code>{% set pageCats = craft.categories('photoCategories').slug(segment) %}
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-01-29T14:28:32.093Z
Answers.Text: yes, that worked, and i was sure i'd checked that too!
Answers.UserDisplayName: Samsull
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-01-29T13:53:05.863Z
Answers.LastActivityDate: 2015-01-29T13:53:05.863Z
Answers.UserDisplayName: Dave Coggins
Body: <p>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?</p>
  
  <pre><code>{% 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 %}
  </code></pre>
  
  <p>It works if I hard code the segment name <code>.slug('skateboards')</code> and the segment does render when <code>{{ segment }}</code> on other areas of the same page.</p>
  
Tags: <categories><segments>
Title: Segment to filter through categories slug
ThreadText: # Segment to filter through categories slug
  
  (Asked by: username_0 on 2015-01-29)
  
  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.
  
  **Tags:** categories, segments
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2015-01-29. Score: 4
  
  Try removing the ' ' from segment in line 2
  
  e.g.
  
  ```
  {% set pageCats = craft.categories('photoCategories').slug(segment) %}
  
  ```
  
  > **Comments:**
  > **username_0**: yes, that worked, and i was sure i'd checked that too!  
  
  ---
  
  