Main
Index
Search
Posts
Who's
Online
Log
In

Home: Discontinued/Classic Products: Article Manager 2:
Using Category Number to trigger a templateIf

 

 


nigelparry.net
User

Aug 3, 2009, 4:58 PM

Post #1 of 6 (2795 views)
Shortcut
Using Category Number to trigger a templateIf Can't Post

On one site, I have a Parent Category and several Subcategories, all published from the same Publishing Rule, using the "publish multiple index files including subcategories" option, using the same articleLists template.

I am trying to get Subcategory names to show ONLY on the Parent Category Index page, not on the Subcategory Index pages where they are redundant.

The Parent Category Number is 12 yet neither of these options listed below works. Have I got the Placeholder, $categorynums$, wrong? That was the Placeholder that turned up producing the number 12 when I added the "Show All Placeholders" command to the template:


Code
<!-- templateIf: $categorynums$ eq "12" -->Insert Content Here<!-- /templateIf --> 

<!-- templateIf: $categorynums$ == "12" -->Insert Content Here<!-- /templateIf -->

_____________________

For more information about Nigel Parry and nigelparry.net 
websites please see http://nigelparry.net

nigelparry.net: award-winning communications 
solutions for clients with something to say

Website & print design
Internet, public relations & media consulting


Donna
Staff / Moderator


Aug 4, 2009, 4:35 PM

Post #2 of 6 (2763 views)
Shortcut
Re: [nigelparry.net] Using Category Number to trigger a templateIf [In reply to] Can't Post

Hi Nigel,

Yup, you've got it -- the placeholder should be $category.num$, not $categorynum$.

You can always use the placeholder list command to see all of the placeholders available on a given page (and what their values are). See more details here: http://www.interactivetools.com/docs/doc.cgi?/articlemanager2/templates/template_placeholderlist.html

Give that a try and let me know how it works. :)

Donna

--
support@interactivetools.com


nigelparry.net
User

Aug 5, 2009, 10:51 AM

Post #3 of 6 (2753 views)
Shortcut
Re: [Donna] Using Category Number to trigger a templateIf [In reply to] Can't Post

That's what I did, and the placeholder list had $categorynums$ listed, not even $categorynum$...!

Thanks for this, I gave it a shot but with no joy.


Code
<!-- templateIf: $category.num$ == "12" -->

was what I used, but it didn't work. :-(
_____________________

For more information about Nigel Parry and nigelparry.net 
websites please see http://nigelparry.net

nigelparry.net: award-winning communications 
solutions for clients with something to say

Website & print design
Internet, public relations & media consulting

(This post was edited by nigelparry.net on Aug 5, 2009, 10:56 AM)


Donna
Staff / Moderator


Aug 5, 2009, 11:15 AM

Post #4 of 6 (2750 views)
Shortcut
Re: [nigelparry.net] Using Category Number to trigger a templateIf [In reply to] Can't Post

$category.num$ is the default -- this might have changed if you've made any modifications to your category fields, though.

Try putting the placeholder into your template without the templateIf -- just so you can see what the output is.

One other option you could use is $category.depth$ -- if it's a parent category, the depth should be 0. So, you could use this:

<!-- templateIf: $category.depth$ == "0" -->
...your extra code...
<!-- /templateIf -->

Are you getting any error messages, or is just nothing showing up at all?

Donna

--
support@interactivetools.com


nigelparry.net
User

Aug 5, 2009, 11:44 AM

Post #5 of 6 (2748 views)
Shortcut
Re: [Donna] Using Category Number to trigger a templateIf [In reply to] Can't Post

There were no category field names harmed in this implementation of Article Manager. :-)

I see what's happening now. This templateIf is happening in the Article List cells so the value is not changing depending whether the article is appearing on a parent or subcategory. The result is that the same thing happens on both pages.

What I'm trying to do is have the subcategory name (to the right of the date) appear on the Parent page: http://imeu.net/news/palestine-photos.shtml

But not on any of the subcategory index pages, eg. http://imeu.net/news/photos-politics.shtml

As I'm doing this within the article list cells, all references to parent category/category number are the same value no matter what index page the article is appearing on, the parent or the subcategory.

So, what I need is some way that the article cell knows it's appearing on the parent index page listing and not on its own index page (where of course you don't want the subcategory name to be appearing by every single article).

I could do it with two templates, but I'm trying to minimize template splitting these days. Any ideas? :-)
_____________________

For more information about Nigel Parry and nigelparry.net 
websites please see http://nigelparry.net

nigelparry.net: award-winning communications 
solutions for clients with something to say

Website & print design
Internet, public relations & media consulting


Donna
Staff / Moderator


Aug 6, 2009, 11:52 AM

Post #6 of 6 (2741 views)
Shortcut
Re: [nigelparry.net] Using Category Number to trigger a templateIf [In reply to] Can't Post

ah hah! I see now...

Unfortunately, you're right -- since the article row is the same regardless, all of the data is going to be the same, so there isn't really anything to differentiate them. You can try popping the template placeholder list command in both and see if there are any differences, but at this point I'm pretty sure the two templates option is going to be your best bet.

Donna

--
support@interactivetools.com