Simple Machines Community Forum

SMF Development => Feature Requests => Applied or Declined Requests => Topic started by: Nabil1 on December 13, 2008, 05:43:42 PM

Title: Adding PHP Contents in the DOZEN PAGES Mod
Post by: Nabil1 on December 13, 2008, 05:43:42 PM
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.
Title: Re: Adding PHP Contents in the DOZEN PAGES Mod
Post by: Oldiesmann on December 14, 2008, 10:42:36 PM
Please post in the topic for this mod: http://www.simplemachines.org/community/index.php?topic=271527.0