News:

Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu

Adding PHP Contents in the DOZEN PAGES Mod

Started by Nabil1, December 13, 2008, 05:43:42 PM

Previous topic - Next topic

Nabil1

Hi ,
I think something is missing in the Dozen Pages Mod, which is adding PHP contents so I added some Code and made it functional with php contents,  here is the additional Code which will make adding PHP Pages possible :

in DosenPages.template.php find :


function template_main()
{
global $context;

echo theme_linktree();

echo '
<div class="tborder" style="margin-top: 1ex;">
<div class="helpmenu titlebg" style="padding: 4px;">
', $context['dozen_pages_menu'], '
</div>
<div style="padding: 2ex;" id="helpmain" class="windowbg2">
', $context['dozen_pages_contents'], '
</div>
</div>
';
}


Replace with :

function template_main()
{
global $context,$pcontent;
$pcontent=$context['dozen_pages_contents'];

echo theme_linktree();
if (preg_match('/<?/',$pcontent)){
$pcontent=str_replace('<br />',"\n",$pcontent);
$pcontent=str_replace('&nbsp;',' ',$pcontent);
$pcontent=str_replace('&#039;',"'",$pcontent);
$fp=fopen("changable.php","w");
fputs($fp,$pcontent);
fclose($fp);
echo '
<div class="tborder" style="margin-top: 1ex;">
<div class="helpmenu titlebg" style="padding: 4px;">
', $context['dozen_pages_menu'], '
</div>';
echo '<div style="padding: 2ex;" id="helpmain" class="windowbg">';
include("changable.php");
echo '</div></div>'; } else {
echo '
<div class="tborder" style="margin-top: 1ex;">
<div class="helpmenu titlebg" style="padding: 4px;">
', $context['dozen_pages_menu'], '
</div>
<div style="padding: 2ex;" id="helpmain" class="windowbg2">
', $context['dozen_pages_contents'], '
</div>
</div>
';
}
};


add an empty php page in the root Directory of your forum call it 'changable.php' ,  it should have a file permission of 766 (or it depends on your server).
The addition of the php content should be with its start and end Signs
adding other Contents like [HTML] , [CODE ] ,etc. remain unchanged.

Oldiesmann

Michael Eshom
Christian Metal Fans

Advertisement: