0

I am designing a site for a wedding show at the moment and I am struggling to get my head around displaying entries related to categories. Basically I have 28 categories Beauty Therapists, Bridalwear, Wedding Cars etc and each of these categories will have entries associated with them.

The page www.mysite.com/exhibitors/ displays all my categories. I'd like the link to the entries to be www.mysite.com/exhibitors/beauty-therapists/ and that link to display all the beauty therapists at the show. But at the moment I cannot get the entries to display on the page, in fact I can't even get the page to display.

I'm using the latest version off EE and Structure, I have Zoo Triggers installed also with exhibitors as my trigger keyword.

I can post code if needs be but it is probably something fairly simple, I am new(ish) to EE, have built about 6 sites now but this is the first to incorporate categories. Any help would be muchly appreciated.

Thanks. Stephen.

****** UPDATE 2 ********

This is now working correctly. Updated code below in case anyone else come across the same issues. I had to set the setting in Freebie 'Always parse pagination' to yes to make it work.

Happy days.

****** UPDATE 1 ********

I now have the categories displaying correctly and the entries associated with those categories displaying when the category is clicked, the issue I have now is that I would like to paginate these entries but the pagination is not working.

I should also note this install is in a 'development' folder on my server which is located at www.mysite.com/development.

Exhibitors template code:

{embed="includes/siteHeader"}

<body>

{embed="includes/siteTopDetails"}

{embed="includes/brandAndNav"} 

{embed="includes/pageHeading"}

{if freebie_1 == "exhibitors" && freebie_2 == ""}
<section class="mainPage">
    <div class="pageWidth">
        <div class="content noBottomPadding">
            <h3>Exhibitors at the Show</h3>
            <p class="featureText">Over 90 exhibitors ranging from Florists to Photographers to Cake Makers will showcase their products at the Ayrshire Wedding Show over the two days.</p>
        </div><!-- End content -->
    </div><!-- End pageWidth -->
    <div class="exhibitorsWidth">
        <div class="content noTopPadding">
            <div class="exhibitors">
                <ul>
                    {exp:channel:categories channel="exhibitor_individual" style="linear" show_empty="no"}
                    <li><a href="{structure:page:url}{category_url_title}">{category_name}</a></li>
                    {/exp:channel:categories}
                </ul>
            </div><!-- End exhibitors -->
        </div><!-- End content -->
    </div><!-- End exhibitorsWidth -->
</section><!-- End mainPage section -->
{/if}

{if freebie_1 == "exhibitors" && freebie_2 != ""}
<section class="mainPage">
    <div class="pageWidth">
        <div class="content noBottomPadding">
            <h3>{exp:freebie:category_name segment="2"}</h3>
        </div><!-- End content -->
    </div><!-- End pageWidth -->
    <div class="exhibitorsWidth">
        <div class="exhibitorsContent">
            <div class="exhibitorsHolder clear">
                {exp:channel:entries channel="exhibitor_individual" dynamic="no" limit="2" category="{exp:freebie:category_id segment='2'}" parse="inward" paginate="bottom" paginate_base="{structure:page:uri}/{exp:freebie:category_name segment='2'}"}
                <div class="exhibitorIndividual">
                    <hgroup>
                    <h4>{company_name}</h4>
                    <h5>Stand(s) {stand_number}</h5>
                    </hgroup>
                    <div class="exhibitorDetailsHolder">
                        <p class="exhibitorDetails"><strong>{exhibitor_name}</strong></p>
                        <p class="exhibitorDetails">{exhibitor_telephone_number}</p>
                        <p class="exhibitorDetails"><a href="http://{exhibitor_web_address}" target="_blank">{exhibitor_web_address}</a></p>
                    </div>
                    {if special_offer_heading}    
                    <a href="#" class="offerLink" data-reveal-id="specialOfferModal" data-animation="fade">Special Offer</a>
                    <!-- Special Offer Modal -->
                    <div id="specialOfferModal" class="reveal-modal">
                        <hgroup>
                            <h3>{special_offer_heading}</h3>
                            <h4>{special_offer_sub_heading}</h4>
                        </hgroup>
                        <p>{special_offer_text}</p>
                        <a class="close-reveal-modal">&#215;</a>
                    </div>
                    <!-- Special Offer Modal -->
                    {/if}
                </div><!-- End exhibitorIndividual -->
          {paginate}
         <div class="pagination">
         {pagination_links}
            <ul>
                {previous_page}
                        <li><a href="{pagination_url}" class="page-previous">Prev</a></li>
                {/previous_page}

                {page}
                        <li><a href="{pagination_url}" class="page-{pagination_page_number} {if current_page}active{/if}">{pagination_page_number}</a></li>
                {/page}

                {next_page}
                        <li><a href="{pagination_url}" class="page-next">Next</a></li>
                {/next_page}
            </ul>
        <p>Page {current_page} of {total_pages} pages</p>
         {/pagination_links}    
         </div><!-- End pagination -->
         {/paginate}
                {/exp:channel:entries}
            </div><!-- End exhibitorsHolder -->
        </div><!-- End exhibitorContent -->
        <div class="pageWidth">
            <div class="content noTopPadding noBottomPadding">
                <div class="backToExhibitors">
                    <p class="icon-back"><a href="/development/exhibitors">Back to Exhibitors</a></p>
                </div><!-- End backToExhibitors -->
            </div><!-- End content -->
        </div><!-- End pageWidth -->
    </div><!-- End exhibitorsWidth -->
    <div class="exhibitorsWidth">
        <div class="content noTopPadding">
            <h3>Exhibitor Categories</h3>
                <div class="exhibitorCategories">
                    <ul>
                        {exp:channel:categories channel="exhibitor_individual" style="linear" show_empty="no"}
                                <li><a href="{structure:page:url}{category_url_title}">{category_name}</a></li>
                                    {/exp:channel:categories}
                    </ul>
            </div><!-- End exhibitorCategories -->
        </div><!-- End content -->
    </div><!-- End exhibitorsWidth -->
</section><!-- End mainPage -->
{/if}


{embed="includes/siteFooter"}

</body>
</html>
2
  • It sounds like you need a 3rd party addon to get the category id from the 2nd segment to use as a parameter in your entries tag. Please post the code as it will help
    – Siebird
    Jul 11 '13 at 15:17
  • OK, that's great thanks. Will update my question to show my code. Jul 11 '13 at 15:37
1

Currently with your template setup, there is no way for EE/Structure to tell which template to route to once segment_2 is available. I've never used Zoo Trigger's before, so this answer is specific using the 3rd party addon - Freebie:

Take control of your URLs — define segments that you want EE to ignore completely. Use 'freebie' segments to trigger template behavior, build dynamic archives inside Structure, or just build special URLs for analytics purposes. Freebie allows you to use segments in powerful, flexible ways without the hassle of dealing with strict URL parsing (like Structure's).

In order for this to work, a conditional is needed to determine what type of page is present based of the URL, so if segment_2 is empty, to show the category listing, if not, show entries specific to present category. The first step is to set a breaking segment in Freebie's settings: exhibitors. Now anything after this segment will be ignored by EE, thus allowing you to use 1 template to control the content. Update the 'Exhibitor' template with the code below once Freebie is installed & setup.

{if freebie_2 == ""} {!-- If segment_2 or freebie_2 is empty, show category listing --}

    <section class="mainPage">
        <div class="pageWidth">
            <div class="content noBottomPadding">
                <h3>Exhibitors at the Show</h3>
                <p class="featureText">Over 90 exhibitors ranging from Florists to Photographers to Cake Makers will showcase their products at the Ayrshire Wedding Show over the two days.</p>
            </div><!-- End content -->
        </div><!-- End pageWidth -->
        <div class="exhibitorsWidth">
            <div class="content noTopPadding">
                <div class="exhibitors">
                    <ul>
                        {exp:channel:categories channel="exhibitors" style="linear"}
                        <li><a href="{category_url_title}">{category_name}</a></li>
                        {/exp:channel:categories}
                    </ul>
                </div><!-- End exhibitors -->
            </div><!-- End content -->
        </div><!-- End exhibitorsWidth -->
    </section><!-- End mainPage section -->

{if:else} {!-- If freebie_2 is present, show single entry category listing --}

    <section class="mainPage">
        <div class="pageWidth">
            <div class="content noBottomPadding">
                <h3>{exp:freebie:category_name segment="2"}</h3>
            </div><!-- End content -->
        </div><!-- End pageWidth -->
        <div class="exhibitorsWidth">
            <div class="exhibitorsContent">
                <div class="exhibitorsHolder clear">
                    {exp:channel:entries channel="exhibitor_individual" category="{exp:freebie:category_id segment="2"}" disable="member_data"}
                    <div class="exhibitorIndividual">
                        <hgroup>
                        <h4>{company_name}</h4>
                        <h5>{stand_number}</h5>
                        </hgroup>
                        <div class="exhibitorDetailsHolder">
                            <p class="exhibitorDetails"><strong>{exhibitor_name}</strong></p>
                            <p class="exhibitorDetails">{exhibitor_telephone_number}</p>
                            <p class="exhibitorDetails"><a href="http://{exhibitor_web_address}" target="_blank">{exhibitor_web_address}</a></p>
                        </div>
                        {if special_offer_heading}    
                        <a href="#" class="offerLink" data-reveal-id="specialOfferModal" data-animation="fade">Special Offer</a>
                        <!-- Special Offer Modal -->
                        <div id="specialOfferModal" class="reveal-modal">
                            <hgroup>
                                <h3>{special_offer_heading}</h3>
                                <h4>{special_offer_sub_heading}</h4>
                            </hgroup>
                            <p>{special_offer_text}</p>
                            <a class="close-reveal-modal">&#215;</a>
                        </div>
                        <!-- Special Offer Modal -->
                        {/if}
                    </div><!-- End exhibitorIndividual -->
                    {/exp:channel:entries}
                </div><!-- End exhibitorsHolder -->
            </div><!-- End exhibitorContent -->
        </div><!-- End exhibitorsWidth -->
    </section><!-- End mainPage -->

{/if}
5
  • Thanks for this but unfortunately it is still not working. I'll keep digging around to see if I can find a solution. Jul 12 '13 at 13:16
  • Can you update your question with what's happening now? Is the 'Exhibitors' entry in Structure mapped to the correct template?
    – Siebird
    Jul 14 '13 at 12:47
  • OK, I will do. I now have this working but I am looking to paginate my entries that are associated to the categories, but now this not working... Jul 15 '13 at 13:00
  • Hi Siebird. I have this working now, updated code above. I had to set Freebie to always parse pagination for it to work correctly. I really appreciate your time and effort helping me out. Thanks. Jul 15 '13 at 19:30
  • No problem. Looking at your code, you can remove the advanced conditionals (ie. {if freebie_1 == "exhibitors" && freebie_2 != ""}) to just {if freebie_2 == ""} & {if freebie_2 != ""} since you have that template mapped directly to the exhibitors entry in structure.
    – Siebird
    Jul 15 '13 at 19:47

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.