Webmastersite.net
Register Log In

Making text appear conditionally - help
Not sure how to use the IF tag...

Comments on Making text appear conditionally - help

Errk!
Member

Usergroup: Customer
Joined: Nov 26, 2005
Location: MI, USA

Total Topics: 11
Total Comments: 35
Errk!
Posted Dec 15, 2005 - 9:50 PM:

I have set up a "featured" link type for sponsored links, and I want to have them preceeded by a simple "Sponsored Links:" before the first link. However, I do not want this text to appear if there are no sponsored links. How can I do this? Here's what I have:

<table width="100%" cellpadding="5" cellspacing="10">
<p><b>Featured Links:</b>
<!-- BEGIN FEATURED LINKS -->
<td {LINKWIDTH} valign="top" class="link">
<b><IF {LINKURL}>
<a href="{TRACKLINKURL}" {EXTERNALLINKS}>{LINKTITLE}</a>
<OTHERWISE>
{LINKTITLE}
</IF></b>
<font face="verdana" size="1" color="#9C9C9C"><b>{LINKURL}</b></font> {LINKNEW} {LINKISUPDATED} {LINKADMIN}
<IF {LINKISREAD}><img src="templates/default/images/viewed.png"></IF>
<IF {SWITCH_PAGERANK}><br><a href="http://www.huebit.ws/tools/page_rank.php" target="_blank"><img src="http://www.huebit.ws/pagerank_dispenser.php?url={LINKURL}&type=1&op=1" alt="Google Pagerank Tool" border="0"></a></IF>
<br><i>{LINKDESCRIPTION} </i>
<font size=1><IF {SWITCH_RATINGS} and {LINKRATING}><br>Rating: {LINKSTARS} ({LINKRATING}/{MAXVOTE} based on {LINKVOTES} votes)</IF>
<IF {SWITCH_HITS}><br>Hits Out: {LINKHITS} | Hits In: {LINKHITSIN}</IF> <br>Submitted {LINKDATE}<IF {LINKLASTEDIT} is greater than {LINKTIME}>, edited {LINKLASTEDITDATE}</IF>
<br><IF {SWITCH_RATINGS}><a href="vote.php?id={LINKID}">Rate</a> | </IF><IF {SWITCH_REPORTS}><a href="report.php?id={LINKID}">Report</a> | </IF><IF {THISMEMBERGROUPCANEMAIL}><a href="email.php?id={LINKID}">E-mail</a> | </IF><a href="javascript:window.external.AddFavorite('{LINKURL}', '{LINKBOOKMARKTITLE}')">Bookmark</a>
<IF {SWITCH_ALBUMS} and {THISMEMBERISREGISTERED}>| <a href="albums.php?add={LINKID}">Add to List</a></IF>
| <a href="{LINKDETAILSURL}">Details</a> <IF {SWITCH_COMMENTS}> | <a href="thread/{LINKID}">Comments (<IF {LINKCOMMENTSREAD}>{LINKNUMCOMMENTS}<OTHERWISE><b>{LINKNUMCOMMENTS}</b></IF>)</a> </IF>

<IF {THISMEMBERGROUPCANVIEWVOTES}><br><a href="showvotes.php?id={LINKID}">Show Individual Votes</a></IF> <IF {THISMEMBERISREGISTERED} and {THISMEMBERID} is {LINKOWNERID}> <IF {SWITCH_RATINGS}>| <a href="index.php?action=getvotingcode&id={LINKID}">Get voting code to place on your site</a></IF> <IF {SPONSORUSELINK} is yes><br><a href="link.php?action=sponsor&id={LINKID}">Move your link to the top: sponsor this category</a><br></IF>
</IF>

<IF {LINKFILEFIELD}><br>Attached files:<br>
<!-- BEGIN LINK ATTACHMENTS -->
<a href="download.php?id={LINKID}&attachid={ATTACHID}">{ATTACHFILETITLE}</a> ({ATTACHKB} KB, {ATTACHDOWNLOADS} downloads)<br>
<!-- END LINK ATTACHMENTS -->
</IF>

</font>
</td>
<!-- END FEATURED LINKS -->
</table>


I'm sure it's just a matter of putting an "IF" condition around the 2nd line, but I'm not sure how to format it or what it would look like completed. Can anyone help?
Paul
developer

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

Total Topics: 61
Total Comments: 7868
Paul
Posted Dec 16, 2005 - 4:09 AM:

<IF {FEATUREDTOTAL}></IF>
Errk!
Member

Usergroup: Customer
Joined: Nov 26, 2005
Location: MI, USA

Total Topics: 11
Total Comments: 35
Errk!
Posted Dec 16, 2005 - 4:10 PM:

Perfect - thanks, Paul.
Errk!
Member

Usergroup: Customer
Joined: Nov 26, 2005
Location: MI, USA

Total Topics: 11
Total Comments: 35
Errk!
Posted Dec 19, 2005 - 4:28 PM:

Can this same thing be done for the "description" line, so that there isn't just a blank line if the link doesn't have a description associated with it? If so, what would it look like?
Paul
developer

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

Total Topics: 61
Total Comments: 7868
Paul
Posted Dec 19, 2005 - 6:26 PM:

It works with anything. Please read scripts.webmastersite.net/w...inks/wsnmanual/articles/69 , and if you need a list of variables scripts.webmastersite.net/w...mplates/Template_Variables
Search thread for
Download thread as
  • 0/5
  • 1
  • 2
  • 3
  • 4
  • 5



This thread is closed, so you cannot post a reply.