Adding IF ELSE statement to this line

Need help with your forum? Ask away. Remember though that there's always http://www.phpbb.com/community

Moderator: Experts

Post Reply
Hardcore_Shad
Posts: 15
Joined: Mon Mar 22, 2010 7:06 am

Adding IF ELSE statement to this line

Post 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.
DavidIQ
Site Admin
Posts: 619
Joined: Thu Sep 07, 2006 4:31 pm
Location: Earth
Contact:

Re: Adding IF ELSE statement to this line

Post 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 -->
Hardcore_Shad
Posts: 15
Joined: Mon Mar 22, 2010 7:06 am

Re: Adding IF ELSE statement to this line

Post 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 -->
DavidIQ
Site Admin
Posts: 619
Joined: Thu Sep 07, 2006 4:31 pm
Location: Earth
Contact:

Re: Adding IF ELSE statement to this line

Post by DavidIQ »

It should probably be "latest_announcements.S_UNREAD_TOPIC"
Hardcore_Shad
Posts: 15
Joined: Mon Mar 22, 2010 7:06 am

Re: Adding IF ELSE statement to this line

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