MyBB Community Forums

Full Version: Another PHP in template request ...
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I know, I've read all the post on the subject, but I need help formating the code ...

I need to insert php code because I found a PNG-24 Alpha transparency script in PHP.

I need this code inserted at the beginning of each page :
<?php ob_start(); ?>

And this one at the end of every page :
    include_once 'replacePngTags.php';
    echo replacePngTags(ob_get_clean());

Plus I need to point to a php file named replacePngTags.php that I put in the "jscripts" folder.

So where do I put the PHP (in global.php ?) ?
How do I code it to make it in 2 variables ?
In which template do I put them (header & footer ?) ?
And what will be the path of my php file (jscripts/replacePngTags.php) ?

Thanks in advance !
There is a javascript for this. No need for php code.
I know there is a javascript for this, but I want to implement this one ...
The javascript doesn't fix background images and if someone has javascript disable, it just doesn't work ...

The only thing I want to know is how to create the variables in PHP and in which PHP file to put it ...
include_once 'replacePngTags.php';
$pngtags = replacePngTags(ob_get_clean());
to global.php at the beginning somewhere.

Then you add {$pngtags} to headerinclude or header or where you want it.
Ok, well it doesn't work ...
Pretty sure it's because everything is at the beginning of the code ...

I need two variables one with this inside :
<?php ob_start(); ?>

And one with this inside :
    include_once 'replacePngTags.php';
    echo replacePngTags(ob_get_clean());

On the Web Site they say that the 1st one needs to be at the beginning and the other one at the end.
With only one variable, I can only put everything at the top or everything at the end and it doesn't work (tried both).
Oh I see now.
Revert the other modifications.

Inside inc/functions.php
echo $contents;
add above:
include_once MYBB_ROOT.'replacePngTags.php';
$contents = replacePngTags($contents);
Can't find it ... !
I see some return $contents; but no echo !
Look again please. It's there.
inside inc/functions.php
Around line 77.
Ok sorry found it ...

Here is the error :

Fatal error: Call to undefined function replacePngTags() in C:\Documents and Settings\Marc Laberge\My Documents\WampServer\www\QcFL\MyBB\inc\functions.php on line 77
Sorry for confusing you. (Updated code)