I'd like to have this in place before releasing the beta so that the problems with the beta will be mostly focused on SQL issues, not install issues.
-Nuttzy
Even I could have told you thatNuttzy99 wrote:I've learned it doesn't need to be an absolute roadblock.
Code: Select all
<h2>{{EM_Install_Info}}</h2>
<form method="post" name="lang" action="{{U_FORM}}">
<table width="100%">
<tr>
<td>{{EM_Select_Language}}</td>
<td> :: </td>
<td><select name="language">
{{LANG_OPTIONS}}
</select> <input type="submit" value="{{GO}}" class="liteoption" /><td>
</tr>
<tr>
<td>{{EM_Database_type}}</td>
<td> :: </td>
<td><b>{{SQL_LAYER}}</b></td>
</tr>
<tr>
<td>{{EM_phpBB_version}}</td>
<td> :: </td>
<td><b>{{PHPBB_VERSION}}</b></td>
</tr>
<tr>
<td>{{EM_EasyMOD_version}}</td>
<td> :: </td>
<td><b>{{EM_VERSION}}</b></td>
</tr>
<tr>
<td>{{L_EM_STATUS}}</td>
<td> :: </td>
<td><b>{{STATUS}}</td>
</tr>
</table>
</form>
Code: Select all
// my own cheese-o-matic template system
function display_template( $template_file, $variables)
{
$template = fopen( $template_file, 'r') ;
while (!feof( $template))
{
$line = fgets( $template, 4096) ;
$prev_endpos = 0 ;
$pos = strpos( $line, '{{')+2 ;
$endpos = strpos( $line, '}}', $pos)-1 ;
// for some reason I couldn't get strpos to work correctly for me (even using === syntax)
$start_var = (substr( $line, 0, 2) == '{{') ? true : false ;
if (($pos > 2) || ($start_var))
{
while (($pos > 2) || ($start_var))
{
$start_var = false ;
$var = substr($line, $pos, $endpos-$pos+1) ;
echo substr( $line, $prev_endpos, (($pos-2)-$prev_endpos)) . $variables[$var] ;
$prev_endpos = $endpos+3 ;
$pos = strpos( $line, '{{', $prev_endpos)+2 ;
$endpos = strpos( $line, '}}', $pos)-1 ;
}
echo substr( $line, $prev_endpos) ;
}
else
{
echo $line ;
}
}
fclose( $template) ;
}
Code: Select all
<?php
/***************************************************************************
* ligth_template.php
* ------------------
* begin : 19/12/2003
* copyright :
* email :
*
* version : 1.0.0
*
* This one will mimic the templating system of phpBB, but without the switches
*
***************************************************************************/
/***************************************************************************
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
***************************************************************************/
class Light_Template {
var $_tpl_key = array();
var $_tpl_val = array();
var $files = array();
var $root = '.';
// constructor
function Light_Template( $dir = '.' )
{
if ( !is_dir($dir) )
{
die("Template->constructor: Error - dir $dir does not exist");
}
$this->root = $dir;
}
// destructor
function destroy()
{
$this->_tpldata = array();
}
// store tpl names and handlers
function set_filenames($filename_array)
{
if ( !is_array($filename_array) )
{
$filename_array = array($filename_array);
}
reset($filename_array);
while(list($handle, $filename) = each($filename_array))
{
if ( $filename[0] != '/' )
{
$filename = $this->root . '/' . $filename;
}
if ( !file_exists($filename) )
{
die("Template->make_filename(): Error - file $filename does not exist");
}
$this->files[$handle] = $filename;
}
return true;
}
function assign_vars($vararray)
{
@reset( $vararray );
while ( list($key, $val) = @each($vararray) )
{
$this->_tpl_key[] = '{' . $key . '}';
$this->_tpl_val[] = $val;
}
return true;
}
function pparse($handle)
{
if ( !isset($this->files[$handle]) )
{
die("Template->pparse(): unknown handle $handle");
}
$str = implode( '', @file($this->files[$handle]) );
if ( empty($str) )
{
die("Template->pparse(): File $filename for handle $handle is empty");
}
echo str_replace('{}', '', str_replace($this->_tpl_key, $this->_tpl_val, $str));
return true;
}
}
?>
Code: Select all
<?php
define('IN_PHPBB', true);
$phpbb_root_path = './../';
$easymod_install = 'install/';
include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . $easymod_install . 'light_template.' . $phpEx);
$template = new Light_Template($phpbb_root_path . $easymod_install . 'templates/');
$template->set_filenames(array(
'body' => 'test.tpl')
);
$template->assign_vars(array(
'TEST1' => 'nuuut',
'TEST2' => 'beeep',
)
);
$template->pparse('body');
?>
Code: Select all
<table cellpadding="0" cellspacing="0" border="1" width="100%">
<tr>
<td>{TEST1}</td>
</tr>
<tr>
<td>{TEST2}</td>
</tr>
</table>