PLEASE BACK UP ALL THE FILES YOU MODIFY FIRST!
PART ONE: mainfile.php modifications
1) Open your mainfile.php
2) Find the function "build_box"
3) Right before the statement:
!!! CODE !!!
} elseif ($special == BLOCK_TYPE_QUOTE) {
add this code:
/* CUT BELOW */
!!! CODE !!!
} elseif ($special == INCLUDE_FILE) {
$content .= "<div class='includes'>n";
include_once("$content1");
$content .= "</div>n";
themesidebox($title1, $content);
/* END CUTTING */
PART TWO: blocksconst.inc.php modifications
1) Add this code to the bottom of the "Blocktype constants"
/* CUT BELOW */
!!! CODE !!!
define("INCLUDE_FILE",24);
/* END CUTTING */
PART THREE: admin/blocks/blocks.php modifications
NOTE: Your line numbers may vary, just look at the code for the appropriate statement(s) if they do.
1) Line 81:
Change this line:
!!! CODE !!!
for ($i = 0; $i <= 23; $i++) {
To this:
!!! CODE !!!
for ($i = 0; $i <= 24; $i++) {
2) Line 210:
Add this code after line 209:
!!! CODE !!!
} elseif ($bbspecial == 24) {
echo translate("Include a File");
3) Line 366:
Change this line:
!!! CODE !!!
for ($i = 0; $i
To this:
!!! CODE !!!
for ($i = 0; $i <= 24; $i++) {
4) Line 469:
Add this code after line 468:
!!! CODE !!!
} elseif ($number == 24) {
$what = translate("Include A File");
PART FOUR: Uploading
1) Save your modified files and upload them to the appropriate directories.
PART FIVE: Your File (MUST BE PHP)
1) Since this is a sideblock, all the content being output to the screen needs to be in a specific format in order for the themesidebox function to interpret the content appropriately.
This is how you will write all your output content:
!!! CODE !!!
$content .= "<p>Testing Sideblock Includes</p>";
A normal MPN PHP file would output content in this manner:
!!! CODE !!!
echo "<p>Testing Sideblock Includes</p>";
You can have any combination of HTML, JavaScript, PHP, however the content to be output MUST be in the above format or it won't work.
Here's a very simple example of a php file to do this using the above statement.
/* CODE */
!!! CODE !!!
<?php
$content .= "<p>Testing Sideblock Includes</p>";
?>
/* END CODE */
If you already have a PHP file and you want to convert it, you can simply do a search and replace.
Search for:
Replace with:
Note: There may be additional echo statements to replace!!
2) Save your file as a php file (yourfile.php) and upload it to your root directory (MPN default install root directory is "html").
PART SIX: Calling your file into the block
1) Go to the blocks administration (admin.php/blocks)
2) Select "Include A File" from the blocktype dropdown form
3) Enter the title for your block
4) In the content box enter ONLY the file name of your file or the path to the file
(examples: myfile.php OR myfolder/myfile.php)
5) Save the block and your done!
Kiril