ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Display values from all channel entries, plus details for a specific entry, in same page?

July 02, 2012 4:00pm

Subscribe [4]
  • #1 / Jul 02, 2012 4:00pm

    Nick Roper

    132 posts

    Hi,
    I think I may have asked this before but here goes.

    I have a channel for training courses - there are 9 courses altogether.

    I use a (exp:channel:entries} loop to display a list of courses in a sidebar on our site, e.g..

    Coursename 1
    Coursename 2
    Coursename 3
    etc…

    Each of these is a link that will display a page showing information about the course. The URL for the link is built as follows:

    <li><a href="http://{title_permalink=" title="{course_blurb}">{title} »</a></li>

    So, the generated URI will be something like:

    /web-developer-training/course-details/php-developer-I

    where php-developer-I is the URL title for the entry

    This all works fine, but I also want that page to display the list of other courses in the sidebar. This now doesn’t work at it seems that content is limited to the single entry from the channel - so a list item for the selected course is shown but not any of the others.

    Is there a wat to achieve what I want - i.e. a listing of all course titles, plus specific details for a single course, on the same page?

    Thanks,

    Nick

     

  • #2 / Jul 02, 2012 7:54pm

    boldyellow

    89 posts

    If you are using Categories to organize the courses, you can display an entry and list other entries in the same category.

    In addition to the docs, Mike Boyink has a great screencast about categories.

    Hope that helps.

  • #3 / Jul 02, 2012 8:04pm

    Nick Roper

    132 posts

    Hi,

    Thanks for that.

    Yup, I am using categories but the problem is that I want the course listings to cover all categories, not just the courses from a particular category.

    I’ll checkout Mike’s screencast anyway - thanks for that.

    I’ve kind of kludged it for the moment by creating a template for each course. All each template does is to define a variable that represents the course’s url_title and then it embeds the main detail page template, passes the variable through and uses it to filter the channel entries. I can then use an unfiltered loop in the margin area to display titles of all courses.

    Got to be a nicer way of doing it though…

    Cheers,

    Nick

  • #4 / Jul 03, 2012 3:28pm

    Shane Eckert

    7174 posts

    Hey Nick,

    Can you show me the code you are using to call the categories for the sidebar?

    If you are not already doing so, add dynamic=“no” to the channel entries tag. That will make the tag pair ignore the url and show all categories.

    Please let me know if this helps.

    Cheers,

  • #5 / Jul 03, 2012 4:03pm

    Nick Roper

    132 posts

    Hi Shane,

    Sure here’s the code (or a snippet anyway):

    <h5>PHP Courses</h5>
    <p><ul><br />
      {exp:channel:entries channel="training_courses" search:course_category="php" orderby="course_sequence" sort="asc" }<br />
      <li><a href="http://{title_permalink=%27web-developer-training/course-details%27}">{title} »</a></li><br />
      {/exp:channel:entries}<br />
    </ul>

    There are then additional h5 & ul/li loops for other course categories.

    Cheers,

    Nick

  • #6 / Jul 03, 2012 4:15pm

    PhilBrienesse

    187 posts

    try adding dynamic=“no”

  • #7 / Jul 03, 2012 4:20pm

    Shane Eckert

    7174 posts

    Hey Nick,

    Exactley. Phil is echoing what I mentioned above. Can you add that and see what happens?

    Cheers,

  • #8 / Jul 03, 2012 4:58pm

    Nick Roper

    132 posts

    Sure, will try now…

  • #9 / Jul 03, 2012 5:14pm

    Nick Roper

    132 posts

    Yup, that works perfectly 😊

    Thanks folks !

  • #10 / Jul 05, 2012 12:58pm

    Shane Eckert

    7174 posts

    Hey Nick,

    Glad to hear it!!

    If you need anything else, please just let me know by opening a new thread.

    Cheers,

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases