 | |  |
 |

jublack2000
User
May 29, 2008, 9:30 AM
Post #1 of 4
(370 views)
Shortcut
|
|
help with templateif statement
|
Can't Post
|
|
Hi there, I'm trying to create a templateIf statement that will allow me to display content only for certain categories on the (/admin.cgi?action=articleList) page. I've successfully created a new column next to the Action column. This new column is for "Availability Calendar" and it will have a hyperlink to "edit calendar" for articles. I have 4 main categories: Hotels, Inns, Villas and Apartments... and each of the those categories has lots of subcategories. I wish the "edit calendar" hyperlink to only show for articles posted in Villas (including subcats) and Apartments (including subcats). In the templates/admin/menus/article.html file, so far I've got this: <td class="$_bgColorClass$" align="center"> <!-- templateIf : $categoryNum$ eq "82" --> <a href="...">edit calendar</a> <!-- /templateIf --></td> It works... and the "edit calendar" only displays for articles posted in Category 82. My question is how to change this statement to include Category 82 (including subcats) and Category 83 (including subcats). In addition, an "else" statement would be cool too... that just outputs "n/a" for articles in Hotels and Inns. Thanks so much in advance for your help. Juliana
|
|
|  |
 |

Jake
Staff
/ Moderator

May 29, 2008, 8:46 PM
Post #2 of 4
(352 views)
Shortcut
|
|
Re: [jublack2000] help with templateif statement
[In reply to]
|
Can't Post
|
|
Hi Juliana, While it is possible to set something like this up using templateIf statements, it's generally easier and more manageable if you create a new category field for this link. You can do so by going to Admin -> Database Editor and then clicking "edit table & fields" for db_category. Just add in a new text field or text box here. After saving this, you could go to the "Categories" page and modify a certain category, where you would enter the code that's currently between the templateIf statement you wrote. Then all you need to do is add the new placeholder to your categoryIndex.html template where you'd like this to appear (ie. $category.calendar$). You can even enter in "N/A" here for categories that don't need to use it. Would something like this work for you? Let me know if I've overlooked something here or if you have any questions! ----------------------------------------------------------- Cheers, Jake Swanson - Product Specialist support@interactivetools.com
Hire me! Save time by getting our experts to help with your project. Template changes, advanced features, full integration, whatever you need. Whether you need one hour or fifty, get it done fast with Priority Consulting.
|
|
|  |
 |

jublack2000
User
May 29, 2008, 9:54 PM
Post #3 of 4
(351 views)
Shortcut
|
|
Re: [Jake] help with templateif statement
[In reply to]
|
Can't Post
|
|
Hi Jake, Thanks for your reply. This idea sounds interesting, but it seems like it would take a lot more time, because I will have to put the code in for so many categories. There are 2 top level categories, but over time there may be several hundred sub-categories, and I wouldn't want to have to put the template if code in for each category. If there was a template if statement that i could use, which would show the link for articles posted in the 2 top-level categories i referred to (Apartments and Villas) and all their sub-categories, that would be much easier I think. Just to clarify, I wish this link to appear on the articleList page in the admin control panel. The page that displays the list of articles on the site. Hopefully that makes sense. Looking forward to hearing what you think. Thanks.
|
|
|  |
 |

Jake
Staff
/ Moderator

May 30, 2008, 10:41 PM
Post #4 of 4
(336 views)
Shortcut
|
|
Re: [jublack2000] help with templateif statement
[In reply to]
|
Can't Post
|
|
Hi jublack2000, I think I originally misunderstood you question - I didn't realize that you were modifying the admin templates! Usually our support does not cover these types of modifications, however I can offer you some tips on getting this going. Basically you would need to set up a templateIf statement for each possible scenario, since there is no "else" function in Article Manager's template language. These should do the job:
<td class="$_bgColorClass$" align="center"> <!-- templateIf : $categoryNum$ eq "82" --> <a href="...">edit calendar</a> <!-- /templateIf --></td> <td class="$_bgColorClass$" align="center"> <!-- templateIf : $categoryNum$ eq "83" --> <a href="...">edit calendar</a> <!-- /templateIf --></td> <td class="$_bgColorClass$" align="center"> <!-- templateIf : $category.parentNum$ eq "82" --> <a href="...">edit calendar</a> <!-- /templateIf --></td> <td class="$_bgColorClass$" align="center"> <!-- templateIf : $category.parentNum$ eq "83" --> <a href="...">edit calendar</a> <!-- /templateIf --></td> <td class="$_bgColorClass$" align="center"> <!-- templateIf : $categoryNum$ ne "82" --> N/A <!-- /templateIf --></td> <td class="$_bgColorClass$" align="center"> <!-- templateIf : $categoryNum$ ne "83" --> N/A <!-- /templateIf --></td> <td class="$_bgColorClass$" align="center"> <!-- templateIf : $category.parentNum$ ne "82" --> N/A <!-- /templateIf --></td> <td class="$_bgColorClass$" align="center"> <!-- templateIf : $category.parentNum$ ne "83" --> N/A <!-- /templateIf --></td> Note that this will fail if you add subcategories two levels deep - this code will only work for the parent categories and their immediate subcategories. I hope that gets you on the right track. ----------------------------------------------------------- Cheers, Jake Swanson - Product Specialist support@interactivetools.com
Hire me! Save time by getting our experts to help with your project. Template changes, advanced features, full integration, whatever you need. Whether you need one hour or fifty, get it done fast with Priority Consulting.
|
|
|  |
 | |  |
|