Page 1 of 1

Adding IF ELSE statement to this line

Posted: Sun Mar 28, 2010 10:13 am
by Hardcore_Shad
Hi all! If I were to add an IF ELSE statement to this code, how could I do it?

I've tried variations to it but could only show the "else" part. :D I intended to place an image or word before the topic title link to show which ones were already "read and unread." So if the topic is new, it shows an image bearing the word "new" before the topic title and vice versa.

Code: Select all

<!-- BEGIN latest_announcements -->
						<a href="{latest_announcements.U_VIEW_TOPIC}" title="{latest_announcements.FULL_TITLE}">{latest_announcements.TITLE}</a><br />
			<!-- END latest_announcements -->
Thanks.

Re: Adding IF ELSE statement to this line

Posted: Sun Mar 28, 2010 11:50 pm
by DavidIQ
Something like:

Code: Select all

<!-- BEGIN latest_announcements -->
                  <!-- IF SOMETHING -->this something<!-- ELSE -->something else<!-- ENDIF -->
                  <a href="{latest_announcements.U_VIEW_TOPIC}" title="{latest_announcements.FULL_TITLE}">{latest_announcements.TITLE}</a><br />
<!-- END latest_announcements -->

Re: Adding IF ELSE statement to this line

Posted: Mon Mar 29, 2010 11:50 am
by Hardcore_Shad
Thanks David.

I was trying this but only the else statement showed, whether the topic is new or old. Am I formulating my IF statement correctly with S_UNREAD_TOPIC? That's actually the part which I need most help with. :?

Code: Select all

<!-- BEGIN latest_announcements -->
                  <!-- IF S_UNREAD_TOPIC --><a href="{latest_announcements.U_VIEW_TOPIC}" title="{latest_announcements.FULL_TITLE}"> Old !!! {latest_announcements.TITLE}</a><!-- ELSE --><a href="{latest_announcements.U_VIEW_TOPIC}" title="{latest_announcements.FULL_TITLE}"> New !!! {latest_announcements.TITLE}</a><!-- ENDIF -->
<!-- END latest_announcements -->

Re: Adding IF ELSE statement to this line

Posted: Mon Mar 29, 2010 12:05 pm
by DavidIQ
It should probably be "latest_announcements.S_UNREAD_TOPIC"

Re: Adding IF ELSE statement to this line

Posted: Mon Mar 29, 2010 1:01 pm
by Hardcore_Shad
Woot!

Let me try that out... :D Thanks!


--------------------------


Update: I coded it like this...

Code: Select all

<!-- IF .latest_announcements -->
		<td class="row1" width="33%" valign="top">
			<!-- BEGIN latest_announcements -->
                  <!-- IF latest_announcements.S_UNREAD_TOPIC --><a href="{latest_announcements.U_VIEW_TOPIC}" title="{latest_announcements.FULL_TITLE}"> NEW !!! {latest_announcements.TITLE}</a><!-- ELSE --><a href="{latest_announcements.U_VIEW_TOPIC}" title="{latest_announcements.FULL_TITLE}"> OLD !!! {latest_announcements.TITLE}</a><!-- ENDIF --><br />
<!-- END latest_announcements -->		</td>
		<!-- ENDIF -->
But only the "OLD" option is shown, even if the topics are new. May I have more assistance on how I could code this better pls? :D