Not Solved PHP in Templates and Template Conditionals
#1
Not Solved
This is a relatively small plugin, but seems that a number of people wanted such a thing, so... here it is.

This plugin will allow you to use:
  • PHP in templates, using <?php ... ?> tags
  • Shortcut template conditionals, using <if ... then>...<elseif ... then>...<else>...</if>
  • Some shortcut string functions (see below), eg <func htmlspecialchars>...</func>
  • Call another template, using <template ...>, eg <template header>


Here's an example of some of the functions that this can be used for - for example, you may use this code in your postbit:

{$post['user_details']}

<if $post['fid5'] then>
Your game tag is <func htmlspecialchars_uni>{$post['fid5']}</func>
<elseif $post['fid6'] and $mybb->user['cancp'] then>
This user's lucky number is <func intval>{$post['fid6']}</func>
<else />Some other profile field: {$post['fid7']}</if>

<?php echo "Hi from PHP"; ?>


More info & Download
(it's easier to keep one location up to date Toungue)
Reply


Messages In This Thread
PHP in Templates and Template Conditionals - by Yumi - 2008-05-27, 11:34 AM
RE: Template conditionals - by expat - 2015-01-31, 05:28 AM

Forum Jump:


Users browsing this thread: 5 Guest(s)