I have the following:
{assign_variable:my_var="test"}
{if my_var == "test"}
<h1>yes</h1>
{if:else}
<h2>no</h1>
{/if}
why does this not work?
(and by work I mean return yes)
-kevin
This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.
The active forums are here.
October 03, 2007 3:22pm
Subscribe [1]#1 / Oct 03, 2007 3:22pm
I have the following:
{assign_variable:my_var="test"}
{if my_var == "test"}
<h1>yes</h1>
{if:else}
<h2>no</h1>
{/if}
why does this not work?
(and by work I mean return yes)
-kevin
#2 / Oct 03, 2007 3:27pm
Hi, Kevin! Welcome to the forums.
Try it like this:
{assign_variable:my_var="test"}
{if "{my_var}" == "test"}
<h1>yes</h1>
{if:else}
<h2>no</h1>
{/if}#3 / Oct 03, 2007 5:26pm
ok, while that will work, let me expand on what I am really trying to do:
my url structure is as follows.
assume I am Using Category URL Titles In Links (not ID’s) and my Category URL Indicator is “region” and my weblog is “section1”
[I am also using redirects to remove index.php]
then from what I understand, the URLs for categories would be
domain.com/section1/region/category_title1
domain.com/section1/region/category_title2
domain.com/section1/region/category_title3
...
and my blogs would be
domain.com/section1/blogtitle1
domain.com/section1/blogtitle2
domain.com/section1/blogtitle3
...
first question, is the above correct?
if so, second question.
- on the category pages, I want to display something different then on a “blog” page.
so I guess I need to do something like the following
{if segment_2 == "region"}
category stuff
{if:else}
display blog detail
{/if}all that is fine to do, but I don’t like hardcoding stuff like that—especially if it is in a few templates AND I then go to change my ‘Category URL Indicator’ to something else…..
so what I thought I would do is the following:
{assign_variable:my_category_url_indicator="region"}
{if segment_2 == my_category_url_indicator}
category stuff
{if:else}
display blog detail
{/if}but the above does not work…..
I have just started learning EE, so I hope this isn’t too dumb of question.
-kevin
#4 / Oct 03, 2007 6:07pm
First question - did you read the documentation explaining URLs? Your URLs have nothing to do with the weblog, but everything to do with the template group and template name. Check out the docs page on Understanding EE URL.
Your category URL indicator, though, is site-wide, and is not likely to change often; I’ve never seen a situation where it does change… ever. This is a really important, fundamental decision that you should make now and stick with.