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} showing up in content when "File extension" field is called.

Development and Programming

AJP's avatar
AJP
311 posts
17 years ago
AJP's avatar AJP

I have a code snippet (below) that’s giving me an issue. The code works fine with category_id==8, but if it ==7, then my browser displays:

{categories} {/categories}

It only throws an error if the field {news_file} is set. I’m sure I’m missing something somewhere. If anybody has any ideas, that’d be super.

{exp:weblog:entries weblog="{my_weblog}" orderby="entry_date" sort="desc" limit="5"}

.......

{categories}
{if category_id=="7"}
    {if news_file !="" OR news_link !=""}
    
        {if news_file != ""}<a href="http://{news_file}class=file_link">Download the full article</a>{/if}
        {if news_file != "" AND news_link !=""}
{/if}
        {if news_link}<a href="http://{news_link}class=web_link">Read the full article</a>{/if}
    
    {/if}
{/if}
{if category_id=="8"}<a href="/news/archive/{url_title}">Read More</a>{/if}
{/categories}
       
Lisa Wess's avatar
Lisa Wess
20,502 posts
17 years ago
Lisa Wess's avatar Lisa Wess

Hi, AJ - what version and build of ExpressionEngine are you on?

       
AJP's avatar
AJP
311 posts
17 years ago
AJP's avatar AJP

I’m on 1.6.0, Build: 20070918.

       
Lisa Wess's avatar
Lisa Wess
20,502 posts
17 years ago
Lisa Wess's avatar Lisa Wess

Hi, AJP, can you try this:

{exp:weblog:entries weblog="{my_weblog}" orderby="entry_date" sort="desc" limit="5"}
{title}

{categories}
{if category_id == "7"}This is category 7
{/if}
{if category_id == "8"}This is category 8
{/if}
{/categories}
<hr >
{/exp:weblog:entries}

on a blank template, and let’s see if it works?

       
AJP's avatar
AJP
311 posts
17 years ago
AJP's avatar AJP

I have two entries in my weblog, one in each category.

And the above code correctly echos both statements.

       
Lisa Wess's avatar
Lisa Wess
20,502 posts
17 years ago
Lisa Wess's avatar Lisa Wess

Ok, then at this point what you need to do is slowly add bits into this template until you find the exact code that is breaking the categories tag. I suspect that a nested if is not closed or some such. But that should help you resolve the issue.

       
AJP's avatar
AJP
311 posts
17 years ago
AJP's avatar AJP

Well, through further debugging, it seems to be that any where in the {categories} variable pair where I call the custom field {news_file}, it throws the “{categories} {/categories}” error. Renaming the field doesn’t solve it. I can display it no problem outside of the {categories} pair.

I’m using MarkHuot’s File extension. I’m thinking that may be the problem.

If I use my other variable {news_link}, a text input field, it has no problem within {categories}.

       
AJP's avatar
AJP
311 posts
17 years ago
AJP's avatar AJP

As a temporary workaround, I’ve just made all entries have a standard “Read More” link and take care of the File/Link display issues on the single entry page.

       
Lisa Wess's avatar
Lisa Wess
20,502 posts
17 years ago
Lisa Wess's avatar Lisa Wess

There was a bug with custom fields clashing inside the categories variable pair, but the build you’re on has that fixed (and had been for a few builds); so since it’s only happening on fields that use that extension, it seems that may indeed be the problem.

Did you want me to shift this down to extensions?

       
AJP's avatar
AJP
311 posts
17 years ago
AJP's avatar AJP

Sure thing. I’d love to get it working. 😊

       

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.