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.

Related Entries by URL_Segment

November 17, 2013 9:51pm

Subscribe [1]
  • #1 / Nov 17, 2013 9:51pm

    AirWatch

    26 posts

    Let me explain my set up and then what I’m trying to do. I am sure there is an easy/creative solution but I’m not seeing it right now.

    SHORT VERSION: How do I show entries related to the the URL_TITLE in the last segment?

    I have a channel called Products. Each product is a channel entry. Products are sorted into 4 categories. Cat1, Cat2, Cat3, Cat4.

    Product 1 - Cat1
    Product 2 - Cat2
    etc..

    In another channel called TV - where I create new channel entries for videos. I relate this to the Product channel so for each video about a product, I can link back to the Product channel entry.

    My TV template is as follows:

    {exp:channel:entries channel="tv" orderby="title" category="{segment_3_category_id}" sort="asc" dynamic="off" orderby="title"}
     {parents channel="products" field="tv_video_parent"}
      {if parents:no_results}NOTHING FOUND{/if}{title}
      (<a href="http://{comment_url_title_auto_path}">{parents:title}</a> {count} {parents:count})
     {/parents}
     {/exp:channel:entries}
    
    {exp:channel:entries channel="tv" orderby="title" category="{segment_3_category_id}" sort="asc" dynamic="off" orderby="title" sort="asc"}<article class="columns-03">
       <!-- iframe class="youtube-player" type="text/html" width="100%" height="auto" src="http://www.youtube.com/embed/{tv_youtube_id}" allowfullscreen frameborder="0">
       </iframe -->
       {title}
       {parents channel="products" field="tv_video_parent"}
                    <strong>{title}</strong> 
             {/parents}
       <a href="/{segment_1}/amps/{tv_video_parent:categories}{category_url_title}{/tv_video_parent:categories}/{tv_video_parent:url_title}/{url_title}/">_    //img.youtube.com/vi/{tv_youtube_id}/0.jpg_   </a>
       <div class="artist-info">
        <ul>
         <li><h3>{title}</h3><p></li><br />
         {if artist_band}<li>Band: {artist_band}</li>{/if}<br />
         <li><br />
          Category:<br />
          {tv_video_parent}<br />
           <a href="/{segment_1}/{tv_video_parent:url_title}/{url_title}/">_        {tv_video_parent:title}_       </a><br />
          {/tv_video_parent}<br />
         </li><br />
       </div><br />
      </article>{/exp:channel:entries}<br />
    </section>

    I have a sidebar with the list of channel entries from the Product channel so to allow users to sort videos by a product. When they click on this sidebar menu, the video channel should display all the videos related to that specific channel entry.

    Someone clicks on Product 1, all videos related to Product 1 should display. If this sounds confusing, it is the nature of related/reverse related entries - but I would answer any further questions and would appreciate pointers. I’ve stared at this too long.

    Thanks!

  • #2 / Nov 18, 2013 7:09am

    AirWatch

    26 posts

    Nevermind. Had a good night’s sleep and woke up with the answer. All is good this Monday morning.

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

ExpressionEngine News!

#eecms, #events, #releases