Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 Will nested IF statements work?
brad-t Offline
Member
***
Posts: 120
Joined: Apr 2011
Post: #1
Will nested IF statements work?
I'm using this in usercp_nav to display two different menus depending on which page you are viewing. The if statements for the CSS classes and inbox unread count were working before being nested in another IF -- is this a problem? Are nested IF disallowed?

Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<!-- User CP Menu -->

<if THIS_SCRIPT == "usercp.php" then>
<div class="cp_menu"><a href="/usercp.php"<if $mybb->input['action'] == '' ||  $mybb->input['action'] == 'changename' ||  $mybb->input['action'] == 'editsig' ||  $mybb->input['action'] == 'email'  || $mybb->input['action'] == 'password' then> class="current"</if>>Profile & Settings</a> <a href="/usercp.php?action=editlists"<if $mybb->input['action'] == 'editlists' then> class="current"</if>>Friends and Foes</a> <a href="/usercp.php?action=drafts"<if $mybb->input['action'] == 'drafts' then> class="current"</if>>Drafts</a> <a href="/usercp.php?action=subscriptions"<if $mybb->input['action'] == 'subscriptions' then> class="current"</if>>Following</a> <a href="/User-{$mybb->user['username']}" style="float: right;">Go to profile ➜</a></div></if>

<!-- Private Messages Menu -->

<if THIS_SCRIPT == "private.php" then>

<td valign="top" style="width: 200px; float: left; margin-right: 20px;">
<table border="0" cellspacing="0" cellpadding="0" class="insetbox messagenav" style="margin-bottom: 13px;">
	<tr>
		<td style="padding: 0px;">

<a href="/private.php?action=send" class="button bigbutton" style="display: block;">New Message</a><br />

<if $mybb->user['pms_unread'] == 0 then>
<a href="/private.php?fid=1" class="biglink <if $folder == 1 then>current</if>" style="display: block;">Inbox</a>

<else>
<a href="/private.php?fid=1" class="biglink <if $folder == 1 then>current</if>" style="display: block; font-weight: bold;">Inbox ({$lang->welcome_pms_usage})</a>
</if>

<a href="/private.php?fid=2" class="biglink <if $folder == 2 then>current</if>" style="display: block;">Sent</a>
<a href="/private.php?fid=3" class="biglink <if $folder == 3 then>current</if>" style="display: block;">Drafts</a>
<a href="/private.php?fid=4" class="biglink <if $folder == 4 then>current</if>" style="display: block;">Trash</a>
<br />
<div class="smalltext">
<a href="/private.php?action=tracking" style="display: block;">Track Messages</a>
<a href="/private.php?action=export" style="display: block;">Download Messages</a>
<a href="/private.php?action=empty" style="display: block;">Empty Folders</a>
</div>

</td></tr>

</table>
</td>
</if>

06-23-2012 05:09 AM
Find all posts by this user Quote this message in a reply

« Next Oldest | Next Newest »

Messages In This Thread
Will nested IF statements work? - brad-t - 06-23-2012 05:09 AM

 Standard Tools
Forum Jump: