منتدى استراحات زايد

منتدى استراحات زايد (http://vb.ma7room.com/index.php)
-   منتدى أخبار المواقع والمنتديات العربية والأجنبية (http://vb.ma7room.com/forumdisplay.php?f=183)
-   -   لائحة شروط العرض بالقوالب (http://vb.ma7room.com/showthread.php?t=252478)

محروم.كوم 10-25-2009 03:10 AM

لائحة شروط العرض بالقوالب
 
I have listed some really useful conditionals that are widely used throughout vB. Will keep adding more.

If Viewer is a Member
--------------------------------------------------
If you want to show a link only to registered members you would use this conditional.



كود PHP:



If Viewer is in the Following Usergroups Array. Enter the Usergroup Number(s) Seperated by a Comma
--------------------------------------------------
If you want to show an advertisement to viewers that are unregistered* registered members and awaiting email confirmation you would use the usergroup ids 1*2*3 within the array.



كود PHP:



If This Script Is or Is Not XXX
--------------------------------------------------
If this script is index (as used in the example below) then it will show the code within the conditional. You can use it to show a piece of code only on Forumhome if you have to put it in a template that is global such as the header. To find out what the script is per page open up the php file that loads the page like for instance showthread.php and look for


كود PHP:
define('THIS_SCRIPT'* 'showthread');


and the showthread part is what you would use.



كود PHP:



and here you can show information on every page but the index page by using this conditional



كود PHP:



For checking multiple scripts:



كود PHP:



OR we can use this way as well



كود PHP:



If this user equals or does not equal xxx
--------------------------------------------------
What this conditional will do is only show certain information if the person viewing the page has the same userid as defined within the conditional. So if you put userid 667 inside the conditional below and put a link inside the conditional tags only the user that has the userid 667 will see that link.



كود PHP:



and it works the opposite way as well if you do not want information to show for 667 but you want it to show for everyone else you would use



كود PHP:



OR we can also use this way



كود PHP:



Display Information To Guests Only
--------------------------------------------------
The following conditional will display information only to guests and no one else. This is helpful in displaying a welcome message that you only wish for guests to see.



كود PHP:



Display Information On a Per Forum Basis
--------------------------------------------------
This conditional allows you to display information on a per forum basis. This can be helpful if you wish to display different advertisements depending on what forum that the user is in. You would simply replace X with the forum id that you wish the information to appear in.



كود PHP:



OR this



كود PHP:



OR this



كود PHP:



and on the other hand you can use the ! to do the opposite and display the information in every forum but the id you list



كود PHP:



or if you have multiple forums you wish to include something with you can use an array such as this



كود PHP:



OR this



كود PHP:



If Usergroup Is or Is Not X
--------------------------------------------------
If the user is a member of the x usergroup then show the code



كود PHP:



and then you can use the ! to tell it to not show it to the x usergroup but show it to everyone else.



كود PHP:



If Users Birthday is Less Than or Greater Than XXXX-XX-XX Do Something
--------------------------------------------------
Just to show the power of vBulletin here is a cool conditional that will show information based on the birthday of the user. The one below will show "Too Young" if they were born after 01-01-1980.



كود PHP:
Too Young


and this one will show you "Too Young" if the user was born before 01-01-1980



كود PHP:
Too Young


If Thread is or is not in X Forum Execute Code
--------------------------------------------------
For instance if you want a piece of code to appear within thread in a particular forum you can do so with this conditional.


كود PHP:



If you want to show the piece of code on every new reply on every thread but 1 forum you can use this which says if thread is in forum x do not show the code but show it for all the other threads out side of forum x.


كود PHP:



and of course you can define multiple forum ids with the array


كود PHP:



Is user moderator of any forum?
--------------------------------------------------
If the user is a moderator execute code.


كود PHP:



Is user moderator of current forum?
--------------------------------------------------
If the user is a moderator of the current forum execute code


كود PHP:



Is user moderator of x Forum?
--------------------------------------------------
If the user is a moderator of x forum execute code.


كود PHP:



Note: can_moderate() may add queries to your page.

Is user the thread starter?
--------------------------------------------------
Is the user the thread creator? If so execute code.


كود PHP:



Is user the thread starter?
--------------------------------------------------
If the thread is closed execute code.


كود PHP:



Place Information After First Post
--------------------------------------------------
Useful for adding a advertisement or other information after the first post on every page.


كود PHP:



Place Information After x Post On Every Page
--------------------------------------------------
This will add your code directly after the post number you define on each page. If you put 2 in place of x the code will appear on every page after the second post.


كود PHP:



Using If Else in Templates
--------------------------------------------------
You can also use If Else conditionals within your templates. The below shows you how to correctly do this.

كود PHP:

Show Guest This Message

Show Everyone but guests this message





الساعة الآن 12:24 AM

Powered by vBulletin® Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.5.2 TranZ By Almuhajir


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 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227