• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Need help with an if/else statement

Caelum

Well-known member
#1
So, I'm trying to get something working, but I've no idea whether it's even possible in XF. Some help would be appreciated.

What I'm trying to do:
  • If user is currently on a page that has ID X (or with URL X, whatever works)...
    • Output: <a href="#" class="moo">Some page</a>
  • Else...
    • Output: <a href="#" class="moo2">Some page</a>
My knowledge of PHP is sorely lacking at best, so I've no idea how to do this properly. If anyone feels like sharing a working code snippet, that'd be awesome. If this is even possible. :p
 
#4
I know this is old - but what about if we aren't using it in a template what if it's part of an addon and we are trying to differentiate between new thread and new post.

At the moment I have:
Code:
public static function posting($class, &$extend)
    {
        if ($class == 'XenForo_DataWriter_DiscussionMessage_Post')
        {
            $extend[] = 'HLO_Credits_Post';
        }
        else
        if ($class == 'XenForo_DataWriter_DiscussionMessage_Thread')
        {
            $extend[] = 'HLO_Credits_Thread';
        }
Put it doesn't seem to seperate them - eg: when I post a new thread I am getting the points for both. I know that I am over looking something basic but after coding for the last 12 hours and reading my mind has just gone blank.

Was mainly hoping you would have somewhere to link me to to read.