MyBB Hacks

Full Version: PHP in Templates / Complex Templates
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
At the top right of the first post.
How can I display Usergroups Owner, Leaders, Number of Members and Join ?
Hi All,

I'm new to using this plugin.  When I use this plugin on the latest version of MyBB, I get this error when trying to use a custom global template I've created:

Parse error: syntax error, unexpected 'ob_start' (T_STRING) in /{PATH_REMOVED}/global.php(872) : eval()'d code on line 9

In the header template for one of my themes, I have the following:

Code:
<template random_logo>


I created a global template called random_logo with the following contents:

Code:
<?php 
     $randomInt=rand(1,3); 
     $imgToUse="images/logo_" . $randomInt . ".png"; 
     // echo $imgToUse; 
?>
<a href="{$mybb->settings['bburl']}/index.php"><img src="{$imgToUse}>" alt="{$mybb->settings['bbname']}" title="{$mybb->settings['bbname']}" /></a>


What am I doing wrong?

hello , i don't know whether this Plugin still supported and updating or not , but please if you can make it able to use while statement it will be amazing , tried using while statement but failed with many things the only thing that will work if i use the code i want bbut instead of while i use "if" but it won't do things looped
here is the code i wanna use !!

PHP Code:
  <tbody>
    <tr>
	<?php
       while($r = mysqli_fetch_assoc($result)){ 
     ?>
      <th scope="row">{$r['id']}</th>
      <td>{$r['name']}</td>
      <td>{$r['size']}</td>
      <td>{$r['type']}</td>
      <td><a href="{$r['location']}">View</a></td>
      <td><a href="#" onclick="deleteItem({$r['id']})">Delete</a></td>
<?php } ?>

    </tr>
  </tbody>


(11-17-2018 11:23 AM)own3mall Wrote: [ -> ]Hi All,

I'm new to using this plugin.  When I use this plugin on the latest version of MyBB, I get this error when trying to use a custom global template I've created:

Parse error: syntax error, unexpected 'ob_start' (T_STRING) in /{PATH_REMOVED}/global.php(872) : eval()'d code on line 9

In the header template for one of my themes, I have the following:

Code:
<template random_logo>


I created a global template called random_logo with the following contents:

Code:
<?php 
     $randomInt=rand(1,3); 
     $imgToUse="images/logo_" . $randomInt . ".png"; 
     // echo $imgToUse; 
?>
<a href="{$mybb->settings['bburl']}/index.php"><img src="{$imgToUse}>" alt="{$mybb->settings['bbname']}" title="{$mybb->settings['bbname']}" /></a>


What am I doing wrong?


i guess it doesn't support using the codes
<?php
?>
try the codes you want without those it will work , tried many times
looks like while already works with the plugin (eg.)
(12-29-2018 01:48 PM).mouni Wrote: [ -> ]looks like while already works with the plugin (eg.)

i've tried it , but not working
German:
Hätte mir jemand eine Lösung, wie ich in den Hilfedateien von MyBB V1.8.22 auch PHP wie z.B.:

PHP Code:
<?php include ("dateiname.php"); ?>

einbinden kann?

English.
If someone would have given me a solution, as I did in the help files of MyBB V1.8.22 also PHP like :

PHP Code:
<?php include ("filename.php"); ?>

As long as your syntax is correct, it should works.
The syntax works correctly in the templates. Not in the help pages (misc). But in the help pages isn't work. What can/must i do?
I've tried it in misc_help template, it works.
Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
Reference URL's