Seite 2 von 5

Verfasst: 10.09.2003 15:52
von Henne
Ist die Tabelle denn vorhanden?
Hast bei der Installation die Änderungen an der DB vorgenommen?

Verfasst: 10.09.2003 15:56
von sledgi
welche änderungen an der DB und welche tabelle meinst du ?

Verfasst: 10.09.2003 15:58
von BrahmA
da ist ein script "mod_table_inst.php" oder so heißt das, das must du ausführen um die tabellen für den mod zu erstellen.....

Verfasst: 10.09.2003 15:58
von Henne
Die Tabelle phpbb_stats_config (wie es die Fehlermeldung auch sagt).

Es muss nen Script bei der MOD bei sein oder in der ANleitung was stehen.
Diese Änderungen MUSST du vornehmen.

Verfasst: 10.09.2003 16:04
von sledgi
upps habe grad geschaut und habe bemerkt das ich bei der installation was vergessen habe !
#
#-----[ OPEN ]------------------------------------------
#
templates/subSilver/overall_header.tpl

#
#-----[ FIND ]------------------------------------------
#
<td align="center" valign="top" nowrap="nowrap"><span class="mainmenu">&nbsp;<a href="{U_FAQ}" class="mainmenu"><img src="templates/subSilver/images/icon_mini_faq.gif" width="12" height="13" border="0" alt="{L_FAQ}" hspace="3" />{L_FAQ}</a></span><span class="mainmenu">&nbsp; &nbsp;<a href="{U_SEARCH}" class="mainmenu"><img src="templates/subSilver/images/icon_mini_search.gif" width="12" height="13" border="0" alt="{L_SEARCH}" hspace="3" />{L_SEARCH}</a>&nbsp; &nbsp;<a href="{U_MEMBERLIST}" class="mainmenu"><img src="templates/subSilver/images/icon_mini_members.gif" width="12" height="13" border="0" alt="{L_MEMBERLIST}" hspace="3" />{L_MEMBERLIST}</a>&nbsp; &nbsp;<a href="{U_GROUP_CP}" class="mainmenu"><img src="templates/subSilver/images/icon_mini_groups.gif" width="12" height="13" border="0" alt="{L_USERGROUPS}" hspace="3" />{L_USERGROUPS}</a>&nbsp;

#
#-----[ AFTER, ADD ]------------------------------------------
#
&nbsp;<a href="statistics.php" class="mainmenu"><img src="templates/subSilver/images/icon_mini_statistics.png" width="12" height="13" border="0" alt="Statistics" hspace="3" />Statistics</a>&nbsp;

#
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------
#

#-------------------------------------------------------------
# NOTE: THIS STEP IS ONLY NEEDED IF YOU USE THE FILE-BASED CACHED TEMPLATE.PHP FILE
#
# If you are using the template cache system (only file-based is mentioned here),
# please adjust your template.php as followed (This will NOT disable the Template Caching)
# It is a little tweak to let the template use the non-cached output if no cached template
# file could be found.
#-------------------------------------------------------------

#
#-----[ OPEN ]---------------------------------------------
#
includes/template.php

#
#-----[ FIND ]---------------------------------------------
# around line 144
$fp = fopen($cache_file, 'w+');
fwrite ($fp, '<?php' . "\n" . $this->compiled_code[$handle] . "\n?" . '>');

#
#-----[ REPLACE WITH ]--------------------------------------
#
$fp = @fopen($cache_file, 'w+');
if (!$fp)
{
eval($this->compiled_code[$handle]);
return true;
}
fwrite ($fp, '<?php' . "\n" . $this->compiled_code[$handle] . "\n?" . '>');

#
#-----[ FIND ]---------------------------------------------
# around line 188
$fp = fopen($cache_file, 'w+');
fwrite ($fp, '<?php' . "\n" . $code . "\n?" . '>');

#
#-----[ REPLACE WITH ]--------------------------------------
#
$fp = @fopen($cache_file, 'w+');
if (!$fp)
{
$_str = '';
eval($code);
$this->assign_var($varname, $_str);
return true;
}
fwrite ($fp, '<?php' . "\n" . $code . "\n?" . '>');


# EoM
Diese Sachen habe ich nicht gemacht !

Ein prob habe ich Das schwarz merkierte finde ich nicht hier

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html dir="{S_CONTENT_DIRECTION}">
<head>
<meta http-equiv="Content-Type" content="text/html; charset={S_CONTENT_ENCODING}">
<meta http-equiv="Content-Style-Type" content="text/css">
<meta name="Author" content="http://www.trushkin.net" />
{META}
{NAV_LINKS}
<title>{SITENAME} :: {PAGE_TITLE}</title>
<link rel="stylesheet" href="{T_TEMPLATE_PATH}/style.css" type="text/css">
<style type="text/css">
<!--
th, td.th, td.spacerow { background-image: url({T_TEMPLATE_PATH}/images/cell1.gif); }
td.th2 { background-image: url({T_TEMPLATE_PATH}/images/cell1.gif); }
td.cat, td.catHead, td.catSides, td.catLeft, td.catRight { background-image: url({T_TEMPLATE_PATH}/images/cell2.gif); }
td.catBottom { background-image: url({T_TEMPLATE_PATH}/images/cell3.gif); }
td.profile { background-image: url({T_TEMPLATE_PATH}/images/post_bg2.gif); }

/* Import the fancy styles for IE only (NS4.x doesn't use the @import function) */
@import url("{T_TEMPLATE_PATH}/formIE.css");
-->
</style>
<!-- BEGIN switch_enable_pm_popup -->
<script language="Javascript" type="text/javascript">
<!--
if ( {PRIVATE_MESSAGE_NEW_FLAG} )
{
window.open('{U_PRIVATEMSGS_POPUP}', '_phpbbprivmsg', 'HEIGHT=225,resizable=yes,WIDTH=400');;
}
//-->
</script>
<!-- END switch_enable_pm_popup -->
<script language="javascript" type="text/javascript">
<!--

function changeImages()
{
if (document.images)
{
for (var i=0; i<changeImages.arguments.length; i+=2)
{
document[changeImages.arguments].src = changeImages.arguments[i+1];
}
}
}

var PreloadFlag = false;

function newImage(arg)
{
if (document.images)
{
rslt = new Image();
rslt.src = arg;
return rslt;
}
}

function PreloadImages()
{
if (document.images)
{
// preload all rollover images
<!-- BEGIN switch_user_logged_out -->
img0 = newImage('{T_TEMPLATE_PATH}/images/lang_{LANG}/btn_login_on.gif');
img1 = newImage('{T_TEMPLATE_PATH}/images/lang_{LANG}/btn_register_on.gif');
<!-- END switch_user_logged_out -->
<!-- BEGIN switch_user_logged_in -->
img2 = newImage('{T_TEMPLATE_PATH}/images/lang_{LANG}/btn_pm_on.gif');
img3 = newImage('{T_TEMPLATE_PATH}/images/lang_{LANG}/btn_profile_on.gif');
img4 = newImage('{T_TEMPLATE_PATH}/images/lang_{LANG}/btn_groups_on.gif');
img5 = newImage('{T_TEMPLATE_PATH}/images/lang_{LANG}/btn_logout_on.gif');
<!-- END switch_user_logged_in -->
img6 = newImage('{T_TEMPLATE_PATH}/images/lang_{LANG}/btn_faq_on.gif');
img7 = newImage('{T_TEMPLATE_PATH}/images/lang_{LANG}/btn_search_on.gif');
img8 = newImage('{T_TEMPLATE_PATH}/images/lang_{LANG}/btn_users_on.gif');
img9 = newImage('{T_TEMPLATE_PATH}/images/lang_{LANG}/btn_index_on.gif');
PreloadFlag = true;
}
return true;
}

//-->
</script>
</head>
<body bgcolor="#FFFFFF" text="#000000" link="#0053A2" vlink="#00468C" alink="#FF6633" marginwidth="0" marginheight="0" leftmargin="0" topmargin="0" onload="PreloadImages();"><a name="top"></a><table border="0" cellspacing="0" cellpadding="0" width="100%" height="100%">
<tr>
<td bgcolor="#0053A2" width="100%" align="center" valign="middle"><table border="0" cellspacing="0" cellpadding="5"><tr><td><a href="{U_INDEX}"><img src="{T_TEMPLATE_PATH}/images/logo_phpBB.gif" border="0" /></a></td></tr></table></td>
</tr>
<tr height="20">
<td height="20" background="{T_TEMPLATE_PATH}/images/btn_bg.gif" align="center" valign="top"><table border="0" cellspacing="0" cellpadding="0">
<!-- BEGIN switch_user_logged_out -->
<td><a title="{L_LOGIN_LOGOUT}" href="{U_LOGIN_LOGOUT}" onmouseover="changeImages('btn_top_login', '{T_TEMPLATE_PATH}/images/lang_{LANG}/btn_login_on.gif'); return true;" onmouseout="changeImages('btn_top_login', '{T_TEMPLATE_PATH}/images/lang_{LANG}/btn_login.gif'); return true;"><img name="btn_top_login" src="{T_TEMPLATE_PATH}/images/lang_{LANG}/btn_login.gif" height="20" border="0" alt="{L_LOGIN_LOGOT}" /></a></td>
<td><a title="{L_REGISTER}" href="{U_REGISTER}" onmouseover="changeImages('btn_top_register', '{T_TEMPLATE_PATH}/images/lang_{LANG}/btn_register_on.gif'); return true;" onmouseout="changeImages('btn_top_register', '{T_TEMPLATE_PATH}/images/lang_{LANG}/btn_register.gif'); return true;"><img name="btn_top_register" src="{T_TEMPLATE_PATH}/images/lang_{LANG}/btn_register.gif" height="20" border="0" alt="{L_REGISTER}" /></a></td>
<!-- END switch_user_logged_out -->
<!-- BEGIN switch_user_logged_in -->
<td><a title="{L_PROFILE}" href="{U_PROFILE}" onmouseover="changeImages('btn_top_profile', '{T_TEMPLATE_PATH}/images/lang_{LANG}/btn_profile_on.gif'); return true;" onmouseout="changeImages('btn_top_profile', '{T_TEMPLATE_PATH}/images/lang_{LANG}/btn_profile.gif'); return true;"><img name="btn_top_profile" src="{T_TEMPLATE_PATH}/images/lang_{LANG}/btn_profile.gif" height="20" border="0" alt="{L_PROFILE}" /></a></td>
<td><a title="{PRIVATE_MESSAGE_INFO}" href="{U_PRIVATEMSGS}" onmouseover="changeImages('btn_top_pm', '{T_TEMPLATE_PATH}/images/lang_{LANG}/btn_pm_on.gif'); return true;" onmouseout="changeImages('btn_top_pm', '{T_TEMPLATE_PATH}/images/lang_{LANG}/btn_pm.gif'); return true;"><img name="btn_top_pm" src="{T_TEMPLATE_PATH}/images/lang_{LANG}/btn_pm.gif" height="20" border="0" alt="{PRIVATE_MESSAGE_INFO}" /></a></td>
<!-- END switch_user_logged_in -->
<td><a title="{L_FAQ}" href="{U_FAQ}" onmouseover="changeImages('btn_top_faq', '{T_TEMPLATE_PATH}/images/lang_{LANG}/btn_faq_on.gif'); return true;" onmouseout="changeImages('btn_top_faq', '{T_TEMPLATE_PATH}/images/lang_{LANG}/btn_faq.gif'); return true;"><img name="btn_top_faq" src="{T_TEMPLATE_PATH}/images/lang_{LANG}/btn_faq.gif" height="20" border="0" alt="{L_FAQ}" /></a></td>
<td><a title="{L_MEMBERLIST}" href="{U_MEMBERLIST}" onmouseover="changeImages('btn_top_users', '{T_TEMPLATE_PATH}/images/lang_{LANG}/btn_users_on.gif'); return true;" onmouseout="changeImages('btn_top_users', '{T_TEMPLATE_PATH}/images/lang_{LANG}/btn_users.gif'); return true;"><img name="btn_top_users" src="{T_TEMPLATE_PATH}/images/lang_{LANG}/btn_users.gif" height="20" border="0" alt="{L_MEMBERLIST}" /></a></td>
<td><a title="{L_SEARCH}" href="{U_SEARCH}" onmouseover="changeImages('btn_top_search', '{T_TEMPLATE_PATH}/images/lang_{LANG}/btn_search_on.gif'); return true;" onmouseout="changeImages('btn_top_search', '{T_TEMPLATE_PATH}/images/lang_{LANG}/btn_search.gif'); return true;"><img name="btn_top_search" src="{T_TEMPLATE_PATH}/images/lang_{LANG}/btn_search.gif" height="20" border="0" alt="{L_SEARCH}" /></a></td>
<!-- BEGIN switch_user_logged_in -->
<td><a title="{L_USERGROUPS}" href="{U_GROUP_CP}" onmouseover="changeImages('btn_top_groups', '{T_TEMPLATE_PATH}/images/lang_{LANG}/btn_groups_on.gif'); return true;" onmouseout="changeImages('btn_top_groups', '{T_TEMPLATE_PATH}/images/lang_{LANG}/btn_groups.gif'); return true;"><img name="btn_top_groups" src="{T_TEMPLATE_PATH}/images/lang_{LANG}/btn_groups.gif" height="20" border="0" alt="{L_USERGROUPS}" /></a></td>
<td><a title="{L_LOGIN_LOGOUT}" href="{U_LOGIN_LOGOUT}" onmouseover="changeImages('btn_top_logout', '{T_TEMPLATE_PATH}/images/lang_{LANG}/btn_logout_on.gif'); return true;" onmouseout="changeImages('btn_top_logout', '{T_TEMPLATE_PATH}/images/lang_{LANG}/btn_logout.gif'); return true;"><img name="btn_top_logout" src="{T_TEMPLATE_PATH}/images/lang_{LANG}/btn_logout.gif" height="20" border="0" alt="{L_LOGIN_LOGOT}" /></a></td>
<!-- END switch_user_logged_in -->
<td><a title="{L_INDEX}" href="{U_INDEX}" onmouseover="changeImages('btn_top_index', '{T_TEMPLATE_PATH}/images/lang_{LANG}/btn_index_on.gif'); return true;" onmouseout="changeImages('btn_top_index', '{T_TEMPLATE_PATH}/images/lang_{LANG}/btn_index.gif'); return true;"><img name="btn_top_index" src="{T_TEMPLATE_PATH}/images/lang_{LANG}/btn_index.gif" height="20" border="0" alt="{L_INDEX}" /></a></td>
</table></td>
</tr>
<tr height="100%">
<td align="center" valign="top" height="100%">
<br />
<table border="0" cellspacing="0" cellpadding="10" width="100%">
<tr>
<td align="center" valign="top">



Kann mir einer Sagen wo es ist ?

Verfasst: 10.09.2003 16:09
von BrahmA
<body bgcolor="#FFFFFF" text="#000000" link="#0053A2" vlink="#00468C" alink="#FF6633" marginwidth="0" marginheight="0" leftmargin="0" topmargin="0" onload="PreloadImages();"><a name="top"></a><table border="0" cellspacing="0" cellpadding="0" width="100%" height="100%">
<tr>
<td bgcolor="#0053A2" width="100%" align="center" valign="middle"><table border="0" cellspacing="0" cellpadding="5"><tr><td><a href="{U_INDEX}"><img src="{T_TEMPLATE_PATH}/images/logo_phpBB.gif" border="0" /></a></td></tr></table></td>
</tr>
<tr height="20">
<td height="20" background="{T_TEMPLATE_PATH}/images/btn_bg.gif" align="center" valign="top"><table border="0" cellspacing="0" cellpadding="0">
<!-- BEGIN switch_user_logged_out -->
<td><a title="{L_LOGIN_LOGOUT}" href="{U_LOGIN_LOGOUT}" onmouseover="changeImages('btn_top_login', '{T_TEMPLATE_PATH}/images/lang_{LANG}/btn_login_on.gif'); return true;" onmouseout="changeImages('btn_top_login', '{T_TEMPLATE_PATH}/images/lang_{LANG}/btn_login.gif'); return true;"><img name="btn_top_login" src="{T_TEMPLATE_PATH}/images/lang_{LANG}/btn_login.gif" height="20" border="0" alt="{L_LOGIN_LOGOT}" /></a></td>
<td><a title="{L_REGISTER}" href="{U_REGISTER}" onmouseover="changeImages('btn_top_register', '{T_TEMPLATE_PATH}/images/lang_{LANG}/btn_register_on.gif'); return true;" onmouseout="changeImages('btn_top_register', '{T_TEMPLATE_PATH}/images/lang_{LANG}/btn_register.gif'); return true;"><img name="btn_top_register" src="{T_TEMPLATE_PATH}/images/lang_{LANG}/btn_register.gif" height="20" border="0" alt="{L_REGISTER}" /></a></td>
<!-- END switch_user_logged_out -->
<!-- BEGIN switch_user_logged_in -->
<td><a title="{L_PROFILE}" href="{U_PROFILE}" onmouseover="changeImages('btn_top_profile', '{T_TEMPLATE_PATH}/images/lang_{LANG}/btn_profile_on.gif'); return true;" onmouseout="changeImages('btn_top_profile', '{T_TEMPLATE_PATH}/images/lang_{LANG}/btn_profile.gif'); return true;"><img name="btn_top_profile" src="{T_TEMPLATE_PATH}/images/lang_{LANG}/btn_profile.gif" height="20" border="0" alt="{L_PROFILE}" /></a></td>
<td><a title="{PRIVATE_MESSAGE_INFO}" href="{U_PRIVATEMSGS}" onmouseover="changeImages('btn_top_pm', '{T_TEMPLATE_PATH}/images/lang_{LANG}/btn_pm_on.gif'); return true;" onmouseout="changeImages('btn_top_pm', '{T_TEMPLATE_PATH}/images/lang_{LANG}/btn_pm.gif'); return true;"><img name="btn_top_pm" src="{T_TEMPLATE_PATH}/images/lang_{LANG}/btn_pm.gif" height="20" border="0" alt="{PRIVATE_MESSAGE_INFO}" /></a></td>
<!-- END switch_user_logged_in -->
<td><a title="{L_FAQ}" href="{U_FAQ}" onmouseover="changeImages('btn_top_faq', '{T_TEMPLATE_PATH}/images/lang_{LANG}/btn_faq_on.gif'); return true;" onmouseout="changeImages('btn_top_faq', '{T_TEMPLATE_PATH}/images/lang_{LANG}/btn_faq.gif'); return true;"><img name="btn_top_faq" src="{T_TEMPLATE_PATH}/images/lang_{LANG}/btn_faq.gif" height="20" border="0" alt="{L_FAQ}" /></a></td>
<td><a title="{L_MEMBERLIST}" href="{U_MEMBERLIST}" onmouseover="changeImages('btn_top_users', '{T_TEMPLATE_PATH}/images/lang_{LANG}/btn_users_on.gif'); return true;" onmouseout="changeImages('btn_top_users', '{T_TEMPLATE_PATH}/images/lang_{LANG}/btn_users.gif'); return true;"><img name="btn_top_users" src="{T_TEMPLATE_PATH}/images/lang_{LANG}/btn_users.gif" height="20" border="0" alt="{L_MEMBERLIST}" /></a></td>
<td><a title="{L_SEARCH}" href="{U_SEARCH}" onmouseover="changeImages('btn_top_search', '{T_TEMPLATE_PATH}/images/lang_{LANG}/btn_search_on.gif'); return true;" onmouseout="changeImages('btn_top_search', '{T_TEMPLATE_PATH}/images/lang_{LANG}/btn_search.gif'); return true;"><img name="btn_top_search" src="{T_TEMPLATE_PATH}/images/lang_{LANG}/btn_search.gif" height="20" border="0" alt="{L_SEARCH}" /></a></td>
<!-- BEGIN switch_user_logged_in -->
<td><a title="{L_USERGROUPS}" href="{U_GROUP_CP}" onmouseover="changeImages('btn_top_groups', '{T_TEMPLATE_PATH}/images/lang_{LANG}/btn_groups_on.gif'); return true;" onmouseout="changeImages('btn_top_groups', '{T_TEMPLATE_PATH}/images/lang_{LANG}/btn_groups.gif'); return true;"><img name="btn_top_groups" src="{T_TEMPLATE_PATH}/images/lang_{LANG}/btn_groups.gif" height="20" border="0" alt="{L_USERGROUPS}" /></a></td>

<td><a title="{L_LOGIN_LOGOUT}" href="{U_LOGIN_LOGOUT}" onmouseover="changeImages('btn_top_logout', '{T_TEMPLATE_PATH}/images/lang_{LANG}/btn_logout_on.gif'); return true;" onmouseout="changeImages('btn_top_logout', '{T_TEMPLATE_PATH}/images/lang_{LANG}/btn_logout.gif'); return true;"><img name="btn_top_logout" src="{T_TEMPLATE_PATH}/images/lang_{LANG}/btn_logout.gif" height="20" border="0" alt="{L_LOGIN_LOGOT}" /></a></td>
<!-- END switch_user_logged_in -->
<td><a title="{L_INDEX}" href="{U_INDEX}" onmouseover="changeImages('btn_top_index', '{T_TEMPLATE_PATH}/images/lang_{LANG}/btn_index_on.gif'); return true;" onmouseout="changeImages('btn_top_index', '{T_TEMPLATE_PATH}/images/lang_{LANG}/btn_index.gif'); return true;"><img name="btn_top_index" src="{T_TEMPLATE_PATH}/images/lang_{LANG}/btn_index.gif" height="20" border="0" alt="{L_INDEX}" /></a></td>
</table></td>
</tr>
<tr height="100%">
<td align="center" valign="top" height="100%">
<br />
<table border="0" cellspacing="0" cellpadding="10" width="100%">
<tr>
<td align="center" valign="top">

Verfasst: 10.09.2003 16:11
von sledgi
wo ich sehe es nicht

Verfasst: 10.09.2003 16:11
von BrahmA
ROT!!!

Verfasst: 10.09.2003 16:26
von sledgi
--------------------------------------------------------------------------------

Jetzt nochwas was ich nicht finde !
Das finde ich hier nicht :

around line 144
$fp = fopen($cache_file, 'w+');
fwrite ($fp, '<?php' . "\n" . $this->compiled_code[$handle] . "\n?" . '>');

<?php
/***************************************************************************
* template.php
* -------------------
* begin : Saturday, Feb 13, 2001
* copyright : (C) 2001 The phpBB Group
* email : support@phpbb.com
*
* $Id: template.php,v 1.10.2.3 2002/12/21 19:09:57 psotfx Exp $
*
*
***************************************************************************/

/***************************************************************************
*
* 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.
*
***************************************************************************/

/**
* Template class. By Nathan Codding of the phpBB group.
* The interface was originally inspired by PHPLib templates,
* and the template file formats are quite similar.
*
*/

class Template {
var $classname = "Template";

// variable that holds all the data we'll be substituting into
// the compiled templates.
// ...
// This will end up being a multi-dimensional array like this:
// $this->_tpldata[block.][iteration#][child.][iteration#][child2.][iteration#][variablename] == value
// if it's a root-level variable, it'll be like this:
// $this->_tpldata[.][0][varname] == value
var $_tpldata = array();

// Hash of filenames for each template handle.
var $files = array();

// Root template directory.
var $root = "";

// this will hash handle names to the compiled code for that handle.
var $compiled_code = array();

// This will hold the uncompiled code for that handle.
var $uncompiled_code = array();

/**
* Constructor. Simply sets the root dir.
*
*/
function Template($root = ".")
{
$this->set_rootdir($root);
}

/**
* Destroys this template object. Should be called when you're done with it, in order
* to clear out the template data so you can load/parse a new template set.
*/
function destroy()
{
$this->_tpldata = array();
}

/**
* Sets the template root directory for this Template object.
*/
function set_rootdir($dir)
{
if (!is_dir($dir))
{
return false;
}

$this->root = $dir;
return true;
}

/**
* Sets the template filenames for handles. $filename_array
* should be a hash of handle => filename pairs.
*/
function set_filenames($filename_array)
{
if (!is_array($filename_array))
{
return false;
}

reset($filename_array);
while(list($handle, $filename) = each($filename_array))
{
$this->files[$handle] = $this->make_filename($filename);
}

return true;
}


/**
* Load the file for the handle, compile the file,
* and run the compiled code. This will print out
* the results of executing the template.
*/
function pparse($handle)
{
if (!$this->loadfile($handle))
{
die("Template->pparse(): Couldn't load template file for handle $handle");
}

// actually compile the template now.
if (!isset($this->compiled_code[$handle]) || empty($this->compiled_code[$handle]))
{
// Actually compile the code now.
$this->compiled_code[$handle] = $this->compile($this->uncompiled_code[$handle]);
}

// Run the compiled code.
eval($this->compiled_code[$handle]);
return true;
}

/**
* Inserts the uncompiled code for $handle as the
* value of $varname in the root-level. This can be used
* to effectively include a template in the middle of another
* template.
* Note that all desired assignments to the variables in $handle should be done
* BEFORE calling this function.
*/
function assign_var_from_handle($varname, $handle)
{
if (!$this->loadfile($handle))
{
die("Template->assign_var_from_handle(): Couldn't load template file for handle $handle");
}

// Compile it, with the "no echo statements" option on.
$_str = "";
$code = $this->compile($this->uncompiled_code[$handle], true, '_str');

// evaluate the variable assignment.
eval($code);
// assign the value of the generated variable to the given varname.
$this->assign_var($varname, $_str);

return true;
}

/**
* Block-level variable assignment. Adds a new block iteration with the given
* variable assignments. Note that this should only be called once per block
* iteration.
*/
function assign_block_vars($blockname, $vararray)
{
if (strstr($blockname, '.'))
{
// Nested block.
$blocks = explode('.', $blockname);
$blockcount = sizeof($blocks) - 1;
$str = '$this->_tpldata';
for ($i = 0; $i < $blockcount; $i++)
{
$str .= '[\'' . $blocks[$i] . '.\']';
eval('$lastiteration = sizeof(' . $str . ') - 1;');
$str .= '[' . $lastiteration . ']';
}
// Now we add the block that we're actually assigning to.
// We're adding a new iteration to this block with the given
// variable assignments.
$str .= '[\'' . $blocks[$blockcount] . '.\'][] = $vararray;';

// Now we evaluate this assignment we've built up.
eval($str);
}
else
{
// Top-level block.
// Add a new iteration to this block with the variable assignments
// we were given.
$this->_tpldata[$blockname . '.'][] = $vararray;
}

return true;
}

/**
* Root-level variable assignment. Adds to current assignments, overriding
* any existing variable assignment with the same name.
*/
function assign_vars($vararray)
{
reset ($vararray);
while (list($key, $val) = each($vararray))
{
$this->_tpldata['.'][0][$key] = $val;
}

return true;
}

/**
* Root-level variable assignment. Adds to current assignments, overriding
* any existing variable assignment with the same name.
*/
function assign_var($varname, $varval)
{
$this->_tpldata['.'][0][$varname] = $varval;

return true;
}


/**
* Generates a full path+filename for the given filename, which can either
* be an absolute name, or a name relative to the rootdir for this Template
* object.
*/
function make_filename($filename)
{
// Check if it's an absolute or relative path.
if (substr($filename, 0, 1) != '/')
{
$filename = phpbb_realpath($this->root . '/' . $filename);
}

if (!file_exists($filename))
{
die("Template->make_filename(): Error - file $filename does not exist");
}

return $filename;
}


/**
* If not already done, load the file for the given handle and populate
* the uncompiled_code[] hash with its code. Do not compile.
*/
function loadfile($handle)
{
// If the file for this handle is already loaded and compiled, do nothing.
if (isset($this->uncompiled_code[$handle]) && !empty($this->uncompiled_code[$handle]))
{
return true;
}

// If we don't have a file assigned to this handle, die.
if (!isset($this->files[$handle]))
{
die("Template->loadfile(): No file specified for handle $handle");
}

$filename = $this->files[$handle];

$str = implode("", @file($filename));
if (empty($str))
{
die("Template->loadfile(): File $filename for handle $handle is empty");
}

$this->uncompiled_code[$handle] = $str;

return true;
}



/**
* Compiles the given string of code, and returns
* the result in a string.
* If "do_not_echo" is true, the returned code will not be directly
* executable, but can be used as part of a variable assignment
* for use in assign_code_from_handle().
*/
function compile($code, $do_not_echo = false, $retvar = '')
{
// replace \ with \\ and then ' with \'.
$code = str_replace('\\', '\\\\', $code);
$code = str_replace('\'', '\\\'', $code);

// change template varrefs into PHP varrefs

// This one will handle varrefs WITH namespaces
$varrefs = array();
preg_match_all('#\{(([a-z0-9\-_]+?\.)+?)([a-z0-9\-_]+?)\}#is', $code, $varrefs);
$varcount = sizeof($varrefs[1]);
for ($i = 0; $i < $varcount; $i++)
{
$namespace = $varrefs[1][$i];
$varname = $varrefs[3][$i];
$new = $this->generate_block_varref($namespace, $varname);

$code = str_replace($varrefs[0][$i], $new, $code);
}

// This will handle the remaining root-level varrefs
$code = preg_replace('#\{([a-z0-9\-_]*?)\}#is', '\' . ( ( isset($this->_tpldata[\'.\'][0][\'\1\']) ) ? $this->_tpldata[\'.\'][0][\'\1\'] : \'\' ) . \'', $code);

// Break it up into lines.
$code_lines = explode("\n", $code);

$block_nesting_level = 0;
$block_names = array();
$block_names[0] = ".";

// Second: prepend echo ', append ' . "\n"; to each line.
$line_count = sizeof($code_lines);
for ($i = 0; $i < $line_count; $i++)
{
$code_lines[$i] = chop($code_lines[$i]);
if (preg_match('#<!-- BEGIN (.*?) -->#', $code_lines[$i], $m))
{
$n[0] = $m[0];
$n[1] = $m[1];

// Added: dougk_ff7-Keeps templates from bombing if begin is on the same line as end.. I think. :)
if ( preg_match('#<!-- END (.*?) -->#', $code_lines[$i], $n) )
{
$block_nesting_level++;
$block_names[$block_nesting_level] = $m[1];
if ($block_nesting_level < 2)
{
// Block is not nested.
$code_lines[$i] = '$_' . $n[1] . '_count = ( isset($this->_tpldata[\'' . $n[1] . '.\']) ) ? sizeof($this->_tpldata[\'' . $n[1] . '.\']) : 0;';
$code_lines[$i] .= "\n" . 'for ($_' . $n[1] . '_i = 0; $_' . $n[1] . '_i < $_' . $n[1] . '_count; $_' . $n[1] . '_i++)';
$code_lines[$i] .= "\n" . '{';
}
else
{
// This block is nested.

// Generate a namespace string for this block.
$namespace = implode('.', $block_names);
// strip leading period from root level..
$namespace = substr($namespace, 2);
// Get a reference to the data array for this block that depends on the
// current indices of all parent blocks.
$varref = $this->generate_block_data_ref($namespace, false);
// Create the for loop code to iterate over this block.
$code_lines[$i] = '$_' . $n[1] . '_count = ( isset(' . $varref . ') ) ? sizeof(' . $varref . ') : 0;';
$code_lines[$i] .= "\n" . 'for ($_' . $n[1] . '_i = 0; $_' . $n[1] . '_i < $_' . $n[1] . '_count; $_' . $n[1] . '_i++)';
$code_lines[$i] .= "\n" . '{';
}

// We have the end of a block.
unset($block_names[$block_nesting_level]);
$block_nesting_level--;
$code_lines[$i] .= '} // END ' . $n[1];
$m[0] = $n[0];
$m[1] = $n[1];
}
else
{
// We have the start of a block.
$block_nesting_level++;
$block_names[$block_nesting_level] = $m[1];
if ($block_nesting_level < 2)
{
// Block is not nested.
$code_lines[$i] = '$_' . $m[1] . '_count = ( isset($this->_tpldata[\'' . $m[1] . '.\']) ) ? sizeof($this->_tpldata[\'' . $m[1] . '.\']) : 0;';
$code_lines[$i] .= "\n" . 'for ($_' . $m[1] . '_i = 0; $_' . $m[1] . '_i < $_' . $m[1] . '_count; $_' . $m[1] . '_i++)';
$code_lines[$i] .= "\n" . '{';
}
else
{
// This block is nested.

// Generate a namespace string for this block.
$namespace = implode('.', $block_names);
// strip leading period from root level..
$namespace = substr($namespace, 2);
// Get a reference to the data array for this block that depends on the
// current indices of all parent blocks.
$varref = $this->generate_block_data_ref($namespace, false);
// Create the for loop code to iterate over this block.
$code_lines[$i] = '$_' . $m[1] . '_count = ( isset(' . $varref . ') ) ? sizeof(' . $varref . ') : 0;';
$code_lines[$i] .= "\n" . 'for ($_' . $m[1] . '_i = 0; $_' . $m[1] . '_i < $_' . $m[1] . '_count; $_' . $m[1] . '_i++)';
$code_lines[$i] .= "\n" . '{';
}
}
}
else if (preg_match('#<!-- END (.*?) -->#', $code_lines[$i], $m))
{
// We have the end of a block.
unset($block_names[$block_nesting_level]);
$block_nesting_level--;
$code_lines[$i] = '} // END ' . $m[1];
}
else
{
// We have an ordinary line of code.
if (!$do_not_echo)
{
$code_lines[$i] = 'echo \'' . $code_lines[$i] . '\' . "\\n";';
}
else
{
$code_lines[$i] = '$' . $retvar . '.= \'' . $code_lines[$i] . '\' . "\\n";';
}
}
}

// Bring it back into a single string of lines of code.
$code = implode("\n", $code_lines);
return $code ;

}


/**
* Generates a reference to the given variable inside the given (possibly nested)
* block namespace. This is a string of the form:
* ' . $this->_tpldata['parent'][$_parent_i]['$child1'][$_child1_i]['$child2'][$_child2_i]...['varname'] . '
* It's ready to be inserted into an "echo" line in one of the templates.
* NOTE: expects a trailing "." on the namespace.
*/
function generate_block_varref($namespace, $varname)
{
// Strip the trailing period.
$namespace = substr($namespace, 0, strlen($namespace) - 1);

// Get a reference to the data block for this namespace.
$varref = $this->generate_block_data_ref($namespace, true);
// Prepend the necessary code to stick this in an echo line.

// Append the variable reference.
$varref .= '[\'' . $varname . '\']';

$varref = '\' . ( ( isset(' . $varref . ') ) ? ' . $varref . ' : \'\' ) . \'';

return $varref;

}


/**
* Generates a reference to the array of data values for the given
* (possibly nested) block namespace. This is a string of the form:
* $this->_tpldata['parent'][$_parent_i]['$child1'][$_child1_i]['$child2'][$_child2_i]...['$childN']
*
* If $include_last_iterator is true, then [$_childN_i] will be appended to the form shown above.
* NOTE: does not expect a trailing "." on the blockname.
*/
function generate_block_data_ref($blockname, $include_last_iterator)
{
// Get an array of the blocks involved.
$blocks = explode(".", $blockname);
$blockcount = sizeof($blocks) - 1;
$varref = '$this->_tpldata';
// Build up the string with everything but the last child.
for ($i = 0; $i < $blockcount; $i++)
{
$varref .= '[\'' . $blocks[$i] . '.\'][$_' . $blocks[$i] . '_i]';
}
// Add the block reference for the last child.
$varref .= '[\'' . $blocks[$blockcount] . '.\']';
// Add the iterator for the last child if requried.
if ($include_last_iterator)
{
$varref .= '[$_' . $blocks[$blockcount] . '_i]';
}

return $varref;
}

}

?>

Verfasst: 10.09.2003 16:40
von sledgi
Schaut euch mal die Leiste oben an !
Das sieht einfach beschissen aus warum !
Und bitte hilft mir oben !

www.xboxwelt.de.vu