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
Hi all, sorry for my english, I speak spanish.. I want to do some like this in the menu of header template:

PHP Code:
 <div class="menu">
	<ul>
		<li><a href="index.php" <?php if ($_SERVER['PHP_SELF'] == '/index.php') { ?>class="active"<?php }?>>Foro</a></li>
		<li><a href="pagina2" <?php if ($_SERVER['PHP_SELF'] == '/portal.php') { ?>class="active"<?php } ?>>{$lang->toplinks_portal}</a></li>
		<li><a href="pagina3.php" <?php if ($_SERVER['PHP_SELF'] == '/private.php') { ?>class="active"<?php } ?>>Mensajes</a></li>								
	</ul>
</div>
 


I try to put the part of the conditional so, but it not work

PHP Code:
<?php<if $_SERVER['PHP_SELF'] == '/portal.php' then> ?>class="active"<?php </if>?>


How should be placed?
Help me please

Remove the "<?php" and "?>" parts in the second piece of code above.
Is there a way to allow php scripts to be ran in only one template only?

..for this plugin, upon activation, how does it allow php to be run in all templates?

And can we use the same method to only allow php to be run in one template only?
(10-07-2012 03:18 AM)Lilly Wrote: [ -> ]Is there a way to allow php scripts to be ran in only one template only?
What's the point in doing that?
Probably the same as here.
If so, I fail to understand the "obvious reason".
I might guess that the person thinks it increases security or something?  It most certainly doesn't.
Hello,I am using 1.9 version of this plugin,as I can see there is a change here like <if , <elseif , </func> etc.
And on 1.9 I use simple PHP syntax,if I will upgrade will I have to manually find my php codes and change them?
I don't believe so.
PHP in Templates randomly started throwing this error at me.

[attachment=917]

The most recent thing I did was add this code to my header_welcomeblock_moderator template:

PHP Code:
<?php
require_once("inc/functions_indicators.php");
$staff_unread = fetch_unread_count(16);
$contus_unread = fetch_unread_count(24);
$unreadmod = $staff_unread + $contus_unread;
?>


Though I fail to see how that could cause this issue, especially since I deleted it afterwards. The issue vanishes when PHP in Templates is deactivated, however doing so causes my index page to be blank.

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