Hello,
I’m trying to parse a URL and it has been looping indefinitely for me even when I’m at the root. Basically I want it to process this check if segment_2 exists and is not equal to history and there is no segment_3. Because of my use of preloads, I can’t nest the statements, but I’m not sure why this code isn’t working correct. Even when I’m at my root level with no segments, this statement still runs and causes the page to reload like crazy.
{!-- Segment 2 is Top Level: Verifying Category Exists --}
{if segment_2 !="" AND segment_2 !="history" AND segment_3 ==""}
{exp:query
sql="SELECT cat_id, cat_name
FROM exp_categories
WHERE cat_url_title = '{segment_2}'
LIMIT 1"}
{if no_results}
{redirect="latest"}
{/if}
{snip-html-head}
{preload_replace:content-url="news-category"}
{/exp:query}
{/if}