2

I have a sports site I'm building where each team is set up as a user within a 'team' member group. I have a channel called 'Schedule' that has only 2 fields; a user field to relate the schedule to a team and then a table for the list of games.

On the front-end if I have a profile page for each team (ie: http://www.example.com/{username}). I'm having trouble outputting the correct schedule based on the username in the URL?

2
  • Are you able to pull a User from the username? Have you set up this page in your Routes? Commented Jun 18, 2014 at 18:06
  • Let's have a look at your templates too! That would help us help you :) Commented Jun 18, 2014 at 18:10

1 Answer 1

1

Without knowing how your templates look, I can only give you a basic example:

{% set team    = craft.users.username(craft.request.lastSegment) %}
{% set entries = craft.entries.section('schedules').relatedTo(team) %}

This should give you all entries in the schedules channel which have a relation to the team username.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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