Gotta question: I'm restricting the category listing on main.tpl to just regular category types with an IF statement. However, when I do that, WSNLinks is still adding the additional <tr> and </tr> elements for the other category types (although, there's nothing in them). Do you have any suggestions on how I could remove those? Sorry to nitpick, it's just I'm just trying to make it xhtml compliant and the validator has problems with <tr> and </tr> with nothing in it.
<table align="center" width="80%"> <!-- BEGIN CATSBODY --> <!-- BEGIN REGULAR --> <IF {CATTYPE} is regular> <td {CATWIDTH} valign="top" class="category"> <a href="{CATURL}" class="categoryname">{CATCATOTHERNAME}</a> ({CATNUMLINKS}) {CATHASNEW} {CATADMIN}<br /> <!-- BEGIN SUBSUB --> <a href="{CATURL}">{CATNAME}</a>, <!-- END SUBSUB --> <IF {SWITCH_FORUMVIEWS} or {SWITCH_ONLINEFORUM}><br /></IF> <IF {SWITCH_FORUMVIEWS}>{CATVIEWS} views</IF><IF {SWITCH_FORUMVIEWS} and {SWITCH_ONLINEFORUM}>, </IF> <IF {SWITCH_ONLINEFORUM}>{CATNUMONLINE} viewing</IF> </td> </IF> <!-- END REGULAR --> <!-- END CATSBODY --> </table>
I haven't used category types before, but would have presumed that you don't need an IF statement to show just regular as you only have BEGIN REGULAR there, and not BEGIN OTHERTYPE
In order to show particular category types but not others, you have to explicitly write out the section for the others and then leave it blank. This is so that people who don't know that they need to edit the template when they add a new category type don't see their categories vanishing.
If you have a category type named 'example', place
<!-- BEGIN EXAMPLE --> <!-- END EXAMPLE -->
above or below your REGULAR section, but still within the CATSBODY area in order to make the example type invisible.
Presumably you want 'mix category types' set to no in your category settings.
Yesterday, I got it to work for a quick second and looked at the html, but it still was adding the additional <tr>s.
The odd thing is it then started to kind of break afterwards. Check it out: http://www.educational-software-directory.net/wsnlinks/ . It's outputting some variables (?) onto the page, but I've checked and rechecked and rechecked and the code looks good.
<table align="center" width="80%"> <!-- BEGIN CATSBODY --> <!-- BEGIN REVIEWS --><!-- END REVIEWS --> <!-- BEGIN ORGANIZATIONS --><!-- END ORGANIZATIONS --> <!-- BEGIN PUBLICATIONS --><!-- END PUBLICATIONS --> <!-- BEGIN REGULAR --> <td {CATWIDTH} valign="top" class="category"> <a href="{CATURL}" class="categoryname">{CATNAME}</a> ({CATNUMLINKS}) {CATHASNEW} {CATADMIN}<br /> <!-- BEGIN SUBSUB --> <a href="{CATURL}">{CATNAME}</a>, <!-- END SUBSUB --> <IF {SWITCH_FORUMVIEWS} or {SWITCH_ONLINEFORUM}><br /></IF> <IF {SWITCH_FORUMVIEWS}>{CATVIEWS} views</IF><IF {SWITCH_FORUMVIEWS} and {SWITCH_ONLINEFORUM}>, </IF> <IF {SWITCH_ONLINEFORUM}>{CATNUMONLINE} viewing</IF> </td> <!-- END REGULAR --> <!-- END CATSBODY --> </table>
I also couldn't find where to NOT mix category types. I know where the setting is to mix link types or not though. Where is it?
Got it to work! Hmm, it looks like when I exclude a category type I've created from the code it breaks and outputs the variables directly to the page. I needed to include ALL the category types I've created. (I had a category (which was also a type) that was hidden, so I thought not to include it in the list) I guess that was my mistake.
Comments on Main.tpl Category Listing
Member
Usergroup: Member
Joined: Mar 04, 2008
Total Topics: 5
Total Comments: 13
Hi Paul,
Gotta question: I'm restricting the category listing on main.tpl to just regular category types with an IF statement. However, when I do that, WSNLinks is still adding the additional <tr> and </tr> elements for the other category types (although, there's nothing in them). Do you have any suggestions on how I could remove those? Sorry to nitpick, it's just I'm just trying to make it xhtml compliant and the validator has problems with <tr> and </tr> with nothing in it.
P.S. Should I be using a toplist instead?
Expert
Usergroup: Customer
Joined: Aug 19, 2005
Location: England
Total Topics: 391
Total Comments: 1303
I haven't used category types before, but would have presumed that you don't need an IF statement to show just regular as you only have BEGIN REGULAR there, and not BEGIN OTHERTYPE
developer
Usergroup: Administrator
Joined: Dec 20, 2001
Location: Diamond Springs, California
Total Topics: 61
Total Comments: 7868
You should remove the conditional.
In order to show particular category types but not others, you have to explicitly write out the section for the others and then leave it blank. This is so that people who don't know that they need to edit the template when they add a new category type don't see their categories vanishing.
If you have a category type named 'example', place above or below your REGULAR section, but still within the CATSBODY area in order to make the example type invisible.
Presumably you want 'mix category types' set to no in your category settings.
Member
Usergroup: Member
Joined: Mar 04, 2008
Total Topics: 5
Total Comments: 13
Hi Paul,
Yesterday, I got it to work for a quick second and looked at the html, but it still was adding the additional <tr>s.
The odd thing is it then started to kind of break afterwards. Check it out: http://www.educational-software-directory.net/wsnlinks/ . It's outputting some variables (?) onto the page, but I've checked and rechecked and rechecked and the code looks good.
I also couldn't find where to NOT mix category types. I know where the setting is to mix link types or not though. Where is it?
developer
Usergroup: Administrator
Joined: Dec 20, 2001
Location: Diamond Springs, California
Total Topics: 61
Total Comments: 7868
My mistake, category types are always unmixed (when declared in template).
<tr> output may be unavoidable.
I don't see a problem at that URL.
Member
Usergroup: Member
Joined: Mar 04, 2008
Total Topics: 5
Total Comments: 13
Yeah, I changed it back to the IF statement.
It was outputting {REGULARTEMP} and some other variables directly to the page.
developer
Usergroup: Administrator
Joined: Dec 20, 2001
Location: Diamond Springs, California
Total Topics: 61
Total Comments: 7868
Created two category types (regular,test): http://www.webmastersite.net/screenshots/17160.jpg
Made two categories: "Example Category" (type regular) and "dfgdfgf" (type test).
Set template code: http://www.webmastersite.net/screenshots/11824.jpg
Resulting display (dfgdfgf is hidden): http://www.webmastersite.net/screenshots/32413.jpg
This is all as it should be.
Member
Usergroup: Member
Joined: Mar 04, 2008
Total Topics: 5
Total Comments: 13
Got it to work! Hmm, it looks like when I exclude a category type I've created from the code it breaks and outputs the variables directly to the page. I needed to include ALL the category types I've created. (I had a category (which was also a type) that was hidden, so I thought not to include it in the list) I guess that was my mistake.
Thanks Paul!
Member
Usergroup: Member
Joined: Mar 04, 2008
Total Topics: 5
Total Comments: 13
One more thing, when a category is hidden, it does remove the additional <tr>s.