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}
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?
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}.
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?
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.