PHP in Templates and Template Conditionals - Printable Version +- MyBB Community Forums (https://community.mybb.com) +-- Forum: Extensions (https://community.mybb.com/forum-201.html) +--- Forum: Plugins (https://community.mybb.com/forum-73.html) +---- Forum: Plugin Support (https://community.mybb.com/forum-72.html) +---- Thread: PHP in Templates and Template Conditionals (/thread-31860.html) |
RE: PHP in Templates and Template Conditionals - dcamire11 - 2021-08-18 edit: Nvm, got it! RE: PHP in Templates and Template Conditionals - PARADOX987 - 2021-09-18 can't be it used for particular url ? like <if a href="/index.php" then> blaahhhh <else> hhhhaalb </if> RE: PHP in Templates and Template Conditionals - Omar G. - 2021-09-18
RE: PHP in Templates and Template Conditionals - Michael2014 - 2022-01-01 Is there a way to create an If else statement for member profiles, for example, if I am looking at my member profile, I will see "this", and if looking at someone else's member profile then I will see "that" I've been trying, but can seem to get it. any help? <if $GLOBALS['mybb']->user['uid] then>looking at my member profile sees "this"<else> looking at someone else's profile sees "that"</if> (2022-01-01, 05:41 AM)Michael2014 Wrote: Is there a way to create an If else statement for member profiles, for example, if I am looking at my member profile, I will see "this", and if looking at someone else's member profileĀ then I will see "that" Solved: Again, something inside me just takes over, and answers the question, so why do I even ask? <if $GLOBALS['mybb']->user['uid'] == $memprofile['uid'] then>looking at my member profile sees "this"<else> looking at someone else's profile sees "that"</if> But what if is a custom page? (2022-01-01, 05:41 AM)Michael2014 Wrote: Is there a way to create an If else statement for member profiles, for example, if I am looking at my member profile, I will see "this", and if looking at someone else's member profileĀ then I will see "that" wow, solved this again, so surprising, it just takes minutes once the higher mind takes over, to solve this for a custom page is to change $memprofile['uid'] then> to $uid then> RE: PHP in Templates and Template Conditionals - HLFadmin - 2023-02-02 Has anyone found the fix for using this plugin with PHP 8? Getting this error. Warning [2] Undefined array key 2 - Line: 92 - File: inc/plugins/phptpl.php PHP 8.0.27 (Linux) File Line Function /inc/class_error.php 153 errorHandler->error /inc/plugins/phptpl.php 92 errorHandler->error_callback [PHP] {closure} /inc/plugins/phptpl.php 109 preg_replace_callback_array /inc/plugins/phptpl.php(70) : eval()'d code 19 phptpl_parsetpl /forumdisplay.php 1547 phptpl_templates->get using a simple conditional in forumdisplay_threadlist template
RE: PHP in Templates and Template Conditionals - SvePu - 2023-02-02 Try this (untested):
RE: PHP in Templates and Template Conditionals - HLFadmin - 2023-02-02 No change. Thanks for looking. The plugin logic is too dense for me, so I can't begin to make a guess. RE: PHP in Templates and Template Conditionals - Laird - 2023-02-03 (2023-02-02, 01:14 PM)HLFadmin Wrote: Has anyone found the fix for using this plugin with PHP 8? Getting this error. It looks to me that the problem is that the regular expression on line 91 can match only "</if>", in which case the matches array $m will include entries only at index zero (</if> ) and one (/if ), and no entry will be set for index two. Without testing, it looks as though the fix, then, is to change line 192 from: to:
An empty second parameter to phptpl__if() is fine in this scenario because it only uses the first for /if s.
RE: PHP in Templates and Template Conditionals - HLFadmin - 2023-02-03 That's it. The fix is in and working. Thanks. Will consider testing more of the plugin features. In this case have only used it for a simple <if then> </if>. Maybe I spoke too soon. Forum display is fixed, but post display has gone wild. RE: PHP in Templates and Template Conditionals - Turmoil - 2023-02-21 Laird's fix worked for me too. Many Thanks |