Webmastersite.net
Register Log In

Main.tpl Category Listing

Comments on Main.tpl Category Listing

mspergel
Member

Usergroup: Member
Joined: Mar 04, 2008

Total Topics: 5
Total Comments: 13
Posted Mar 29, 2008 - 12:18 PM:

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

Usergroup: Customer
Joined: Aug 19, 2005
Location: England

Total Topics: 391
Total Comments: 1303
babrees
Posted Mar 29, 2008 - 10:45 PM:

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
developer

Usergroup: Administrator
Joined: Dec 20, 2001
Location: Diamond Springs, California

Total Topics: 61
Total Comments: 7868
Paul
Posted Mar 30, 2008 - 6:05 AM:

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.
mspergel
Member

Usergroup: Member
Joined: Mar 04, 2008

Total Topics: 5
Total Comments: 13
Posted Mar 31, 2008 - 9:03 AM:

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.



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

Usergroup: Administrator
Joined: Dec 20, 2001
Location: Diamond Springs, California

Total Topics: 61
Total Comments: 7868
Paul
Posted Apr 02, 2008 - 8:36 AM:

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.
mspergel
Member

Usergroup: Member
Joined: Mar 04, 2008

Total Topics: 5
Total Comments: 13
Posted Apr 02, 2008 - 10:46 AM:

Yeah, I changed it back to the IF statement.

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

Usergroup: Administrator
Joined: Dec 20, 2001
Location: Diamond Springs, California

Total Topics: 61
Total Comments: 7868
Paul
Posted Apr 04, 2008 - 7:33 PM:

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.
mspergel
Member

Usergroup: Member
Joined: Mar 04, 2008

Total Topics: 5
Total Comments: 13
Posted Apr 08, 2008 - 10:36 AM:

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 Comments: 13
Posted Apr 08, 2008 - 10:51 AM:

One more thing, when a category is hidden, it does remove the additional <tr>s.
Search thread for
Download thread as
  • 0/5
  • 1
  • 2
  • 3
  • 4
  • 5



Sorry, you don't have permission to post posts. Log in, or register if you haven't yet.