Thread Rating:
  • 1 Votes - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 Very new at PHP
ZiNgA BuRgA Offline
Fag
*******
Posts: 3,357
Joined: Jan 2008
Post: #21
RE: Very new at PHP

PHP Code:
<if $thread['closed'] then>
<span style="color:red;">[Cerrado]</span>
</if>


My Blog
06-19-2011 10:34 PM
Find all posts by this user Quote this message in a reply
Sama34 Offline
Senior Member
****
Posts: 490
Joined: May 2011
Post: #22
RE: Very new at PHP
But i want a closed thread to have '[Closed]' on it and closed+sticky threads to have just 'Sticky:'

If I use than then a closed thread that is also sticky will say 'Sticky: [Closed]' instead of just 'Sticky:'

mmm, thinking about it maybe it doesn't matter that much...

Support PM's will be ignored. Yipi
Plugins: Announcement Bars - Custom Reputation - Mark PM As Unread
(This post was last modified: 06-19-2011 11:07 PM by Sama34.)
06-19-2011 11:07 PM
Visit this user's website Find all posts by this user Quote this message in a reply
leefish Offline
Hamster
*****
Posts: 1,009
Joined: Apr 2010
Post: #23
RE: Very new at PHP
maybe this would work:

Code:
1
2
3
4
5
6
<if $thread['sticky'] then>
<img src="my_awesome_sticky_icon.gif" alt="Too bad you can't see this awesome sticky icon!" />
<elseif  $thread['closed'] then>
<span style="color:red;">[Cerrado]</span>
<else>{$icon}
</if>



[Image: leelink.gif]
MYBB1.6 & XThreads
06-19-2011 11:49 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Sama34 Offline
Senior Member
****
Posts: 490
Joined: May 2011
Post: #24
RE: Very new at PHP
^ Thanks, I just change it to this:

PHP Code:
1
2
3
4
5
6
7
<if $thread['sticky'] then>
{$prefix}
<elseif  $thread['closed'] then>
<span style="color:red;">[Cerrado]</span>
<else>
{$prefix}
</if>


{$icon} was for the icon and no the prefix n.nU

I think it worked. Thanks leefish Smile


Support PM's will be ignored. Yipi
Plugins: Announcement Bars - Custom Reputation - Mark PM As Unread
06-20-2011 02:51 PM
Visit this user's website Find all posts by this user Quote this message in a reply
leefish Offline
Hamster
*****
Posts: 1,009
Joined: Apr 2010
Post: #25
RE: Very new at PHP
Oh, I misread that in the thread, but I'm glad you found the logic useful Smile


[Image: leelink.gif]
MYBB1.6 & XThreads
06-21-2011 12:18 AM
Visit this user's website Find all posts by this user Quote this message in a reply
brad-t Offline
Member
***
Posts: 120
Joined: Apr 2011
Post: #26
RE: Very new at PHP
I'll just respond here so I don't need to make a new thread for such a dumb question: how can I display an element only if a user is on a specific page (e.g. index.php)?

Basically I want to include elements in the header only on specific pages such as index.php. Would also like to hide some elements if the user is logged in.
03-08-2012 02:33 AM
Find all posts by this user Quote this message in a reply
leefish Offline
Hamster
*****
Posts: 1,009
Joined: Apr 2010
Post: #27
RE: Very new at PHP

Code:
<if $mybb->usergroup['gid'] == 1 then>
guest stuff
<else>
member stuff
</if>



Code:
<if THIS_SCRIPT == "index.php" then>
Stuff for index
<else>
other stuff
</if>


Should work for template conditionals



[Image: leelink.gif]
MYBB1.6 & XThreads
03-08-2012 04:59 AM
Visit this user's website Find all posts by this user Quote this message in a reply
brad-t Offline
Member
***
Posts: 120
Joined: Apr 2011
Post: #28
RE: Very new at PHP
Thank you!
03-13-2012 05:18 AM
Find all posts by this user Quote this message in a reply
leefish Offline
Hamster
*****
Posts: 1,009
Joined: Apr 2010
Post: #29
RE: Very new at PHP
Something I have been trying to get to work for a while and I thought I would share it:

I use this on profiles where I have some tabs, the content of the tab is determined by a plugin, and is only populated if certain criteria is met, but the tab is a jQuery tab on the page. Rather than there being a tab visible with no content I remove the tab with the below code.

Code:
<if !in_array($memprofile['usergroup'],array(1,2,5,7,10)) then>
Stuff visible on profile only if profile owner's usergroup is NOT in the above array
</if>



[Image: leelink.gif]
MYBB1.6 & XThreads
(This post was last modified: 03-18-2012 11:04 PM by leefish.)
03-18-2012 10:33 PM
Visit this user's website Find all posts by this user Quote this message in a reply
ZiNgA BuRgA Offline
Fag
*******
Posts: 3,357
Joined: Jan 2008
Post: #30
RE: Very new at PHP
You may wish to use a 'whitelist' type exclusion rather than a 'blacklist'.  The former is more restrictive, but isn't subject to you forgetting to add more items to the blacklist when you create a new group.

My Blog
03-19-2012 09:07 AM
Find all posts by this user Quote this message in a reply

« Next Oldest | Next Newest »

 Standard Tools
Forum Jump: