So I’m learning PHP, well I’m learning more complex standards of php as per phpfox.
An issue I’m having is with a few lines of code – I get what they ‘do’. But I don’t understand why they are structured that way. Could someone explain?
In the following line of code the if statements are cornered by {} and not in the usual:
if thing('condition') {
do stuff
}
Way that i’m familiar with. Why is this?
{if Phpfox::isUser() && !PHPFOX_IS_AJAX && $sCustomViewType === null}
{if (Phpfox::getUserBy('profile_page_id') > 0 && defined('PHPFOX_IS_USER_PROFILE'))
|| (isset($aFeedCallback.disable_share) && $aFeedCallback.disable_share)
|| (defined('PHPFOX_IS_USER_PROFILE') && !Phpfox::getService('user.privacy')->hasAccess('' . $aUser.user_id . '', 'feed.share_on_wall'))
|| (defined('PHPFOX_IS_USER_PROFILE') && !Phpfox::getUserParam('profile.can_post_comment_on_profile'))
}
{else}
Also what is the :: thing about? and when I see (not in this) a | by itself, what is that doing?
Thanks very much for any help 🙂
Looks like phpfox templates (uses smarty).
http://www.phpfox.com/kb/article/231/template-tags-in-phpfox/
So the part between the {if} and the {else} which you probably left out, is what gets generated (to html) if the condition in the if is true.
The :: thing is the call of a static method. Phpfox is a class with a static method. Those methods do not need a object and are called ClassName::method()