logo
WSN Links PHP Directory Software
Features Showcase Reviews Demos Purchase Manual Support
 

Main.tpl Category Listing

Version:


Main.tpl Category Listing
mspergel
Member

Usergroup: Member
Joined: Mar 04, 2008
Total Topics: 5
Total Posts: 13
Posted 03/29/08 - 12:18 PM:
quote post
#1
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.


<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>


P.S. Should I be using a toplist instead?
babrees
Expert
Avatar

Usergroup: Customer
Joined: Aug 19, 2005
Location: England
Total Topics: 258
Total Posts: 819
Posted 03/29/08 - 10:45 PM:
quote post
#2
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




Paul
Administrator
Avatar

Usergroup: Administrator
Joined: Dec 21, 2001
Location: Northern California
Total Topics: 49
Total Posts: 5539
Posted 03/30/08 - 06:05 AM:
quote post
#3
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
<!-- 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.

Edited by Paul on 03/30/08 - 06:07 AM
mspergel
Member

Usergroup: Member
Joined: Mar 04, 2008
Total Topics: 5
Total Posts: 13
Posted 03/31/08 - 09:03 AM:
quote post
#4
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/wsn... . 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?

Paul
Administrator
Avatar

Usergroup: Administrator
Joined: Dec 21, 2001
Location: Northern California
Total Topics: 49
Total Posts: 5539
Posted 04/02/08 - 08:36 AM:
quote post
#5
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.

Edited by Paul on 04/02/08 - 08:38 AM
mspergel
Member

Usergroup: Member
Joined: Mar 04, 2008
Total Topics: 5
Total Posts: 13
Posted 04/02/08 - 10:46 AM:
quote post
#6
Yeah, I changed it back to the IF statement.

It was outputting {REGULARTEMP} and some other variables directly to the page.
Paul
Administrator
Avatar

Usergroup: Administrator
Joined: Dec 21, 2001
Location: Northern California
Total Topics: 49
Total Posts: 5539
Posted 04/04/08 - 07:33 PM:
quote post
#7
Created two category types (regular,test): http://www.webmastersite.net/screenshots/17160.jp...

Made two categories: "Example Category" (type regular) and "dfgdfgf" (type test).

Set template code: http://www.webmastersite.net/screenshots/11824.jp...

Resulting display (dfgdfgf is hidden): http://www.webmastersite.net/screenshots/32413.jp...

This is all as it should be.
mspergel
Member

Usergroup: Member
Joined: Mar 04, 2008
Total Topics: 5
Total Posts: 13
Posted 04/08/08 - 10:36 AM:
quote post
#8
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!
mspergel
Member

Usergroup: Member
Joined: Mar 04, 2008
Total Topics: 5
Total Posts: 13
Posted 04/08/08 - 10:51 AM:
quote post
#9
One more thing, when a category is hidden, it does remove the additional <tr>s.
Search thread for
Download thread as


You don't have permission to post.

Please login or register.

Admin Control Panel

   
Home    |    Features    |    Showcase    |    Reviews    |    Demos    |    Purchase    |    Manual    |    Support
© 2008 Paul Knierim. All rights reserved.