We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

categories, status groups and related entries, oh my

Development and Programming

stubear's avatar
stubear
114 posts
16 years ago
stubear's avatar stubear

I have a problem with a site I’m building and I thought I’d also post the question here to make sure there are no issues related to Playa 2 in my code. I basically have two weblogs I’m trying to relate, a client list and a portfolio. My client list has the title and title url fields along with a third custom primary project Playa 2 field. I don’t need the many to many relationship with this specific field but I’m using Playa 2 elsewhere on the site and the filter and sorting capabilities of Playa 2 are helpful so I decided to use it here. Anyway, the primary project field simply allows me to associate a project with a client so I can generate a list of clients and link to the ones that have a primary project entry. What I’d like to also have happen is to have EE check the status of the primary project and include the link only if the project status is open. This is to avoid having a broken link should I decide to archive a project at some point but want to still list the client. Now, I could try to remember that I had a link on my client page but it would be nice to have this process automated. To do this I tried adding a nested conditional that checks the status of the primary project. The code below sort of works but the one thing it refuses to do apparently is process the else in the nested conditional. The list is generated properly and the categories all work as expected. If the primary project entry is empty then the client is listed without a link (the outer {if:else}) but if the primary project is not empty and the project status is not open then the client is not listed at all. What I want to know first is this something that might be caused by Playa (my guess is this is highly unlikely but I have to I have to ask) and the next question is if this is not caused by Playa, why is it not working and what might I do to resolve the problem? Thanks.

<div id="left_nav">
    {exp:weblog:categories weblog="client_list" staus="open" show_empty="no"}<a href="http://{path=">{category_name}</a>{/exp:weblog:categories}
</div>
<div id="content">
    <ul>
    {exp:weblog:entries weblog="client_list" orderby="title" sort="asc" status="open"}
        {if primary_project}
            {primary_project}
            {if status=="open"}
                <li><a href="http://{path=work/{categories}{category_name}{/categories}/{url_title}}">{reverse_related_entries weblog="client_list"}{title}{/reverse_related_entries}</a></li>
            {if:else}
                <li>{reverse_related_entries weblog="client_list"}{title}{/reverse_related_entries}</li>
            {/if}
            {/primary_project}
        {if:else}
            <li>{title}</li>
        {/if}
    {/exp:weblog:entries}
    </ul>
</div>
       
1ArmBandit's avatar
1ArmBandit
25 posts
16 years ago
1ArmBandit's avatar 1ArmBandit

I don’t think any results will be returned if status is not open.

       

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.