SimplePortal

Customization => Custom Coding => Topic started by: AngelinaBelle on September 02, 2009, 10:02:07 AM

Title: Block or Page for agreement.txt
Post by: AngelinaBelle on September 02, 2009, 10:02:07 AM
Here's a simple custom php page to do a little of what the "The Rules" mod does -- the terms of service from agreement.txt
 
I'm going to add a link to the bottom of the template. When I move the forum up to SMF 2, I may look into a custom action to make it easy to add it to the button menu.

global $boarddir;
$FileName=$boarddir . '/agreement.txt';
if ($handle=fopen($FileName, 'r') )
{
//  echo "Opened file <b>$FileName</b>.\n";
  echo "<h2>Terms of Use</h2>\n";
  while (!feof($handle)) {
    echo doUBBC (fread($handle, 8192));
  }
  fclose($handle);
}
else echo "Could not open file <b>$FileName</b>. <br /> \n";
Title: Re: Block or Page for agreement.txt
Post by: ccbtimewiz on September 03, 2009, 12:00:50 PM
You could use glob() instead of fopen() and just array push it.
Title: Re: Block or Page for agreement.txt
Post by: AngelinaBelle on September 03, 2009, 07:48:35 PM
You could use glob() instead of fopen() and just array push it.

Hmm. file()? In fewer lines. Is performance better? It's expected to be a small file.

if ( $filearray=file($FileName) )
{
   foreach ($filearray as $value ) echo doUBBC($value);
}
else echo[color=black] "Could not open file <b>$FileName</b>. <br /> ";[/color]

 
----
edited "doUBBC" back in
SimplePortal 2.3.8 © 2008-2024, SimplePortal