Main
Index
Search
Posts
Who's
Online
Log
In

Home: Discontinued/Classic Products: Article Manager 2:
Placeholder for a category Item

 

 


LostCoder
User

Nov 7, 2006, 3:58 PM

Post #1 of 4 (830 views)
Shortcut
Placeholder for a category Item Can't Post

Hi. I am not sure if i am missing something here and was hoping someone might be able to provide some input.

Our categories are broken up in such a way that some of the categories are "Community Articles" while other categories are "Medically Reviewed".

In the database editor, under the category section i created a placeholder called "article_type" in which i specifified a Single Choice Pulldown menu with the following:

Medically Reviewed (Label) 1 (Value)

Community Articles (Label) 2 (Value)

I set this field as "user may not leave field blank"

Then, within my main article template, I added the following code:

<!-- templateIf : $category.article_type$ ne "1" -->
<strong>This is a Medically Reviewed Article</strong>
<!-- /templateIf -->
<!-- templateIf : $category.article_type$ ne "2" -->
<strong>This is a Community Article</strong>
<!-- /templateIf -->

I then went to each category and selected the appropriate Article Type. and republished.

The crazy thing, is that it is working on some articles and showing the appropriate text string, while other articles are showing the opposite text string!

Am I doing something wrong here?

I took a guess at the placeholder value of $category.article_type$ ---- is this correct? Or should i be using another placeholder?

Thank you in advance for your assistance.

Sincerely,

LC


Dave
Staff / Moderator


Nov 7, 2006, 4:10 PM

Post #2 of 4 (828 views)
Shortcut
Re: [LostCoder] Placeholder for a category Item [In reply to] Can't Post

My guess is that the placeholder is outputting the label and not the value. A neat trick to test what's going on when things aren't working the way you want is to display the placeholder value you are testing on the page (either in plain view or in a comment if you are on a live site).

Like this:
<!-- category.article_type = '$category.article_type$' -->

At the very least you'll be able to see what value it's comparing to to come up with it's results.

Let us know how it goes.

Dave Edis - Senior Developer
interactivetools.com
 


LostCoder
User

Nov 10, 2006, 11:22 AM

Post #3 of 4 (797 views)
Shortcut
Re: [Dave] Placeholder for a category Item [In reply to] Can't Post

Hi,

Thanks for the info.

I utilized just the following placeholder in my template

$category.article_type$ and was able to see that AM was actually interpreting the VALUE of the article_type.

I then realized that the TemplateIf 'ne' operator means "Not Equal" so what was actually happening was that i was asking the system to display x if article_type is not equal to 1, whereas I should have been saying display xi if article_type IS equal to 1.

Anyway, I was hoping that whenever someone has the time that you could possible define the following TemplateIf operators for future reference:

>=, ne, ==, <=, >, eq, !=,

Thanks!

LC


Damon
Staff / Moderator


Nov 10, 2006, 1:11 PM

Post #4 of 4 (792 views)
Shortcut
Re: [LostCoder] Placeholder for a category Item [In reply to] Can't Post

Hi,

The templateif documentaton includes a table that explains what the different operators mean and what they can be used for.

If you any other questions or would like additional information, please let me know. :)

--------------------------------------------------- 
Cheers
Damon Edis
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/