Would you like it if I released a phpinclude API?
It would greatly simplify making phpinclude mods, and what's more even speed them up, depending on the situation. Also it would become so easy that you don't really need an inner working knowledge of vB to start making them.
For example, this code (sorry about the indenting, the code tag's doublespacing is incredibly irritating):
if (strpos($_SERVER['PHP_SELF'], 'showthread.php') != false)
{
if (in_array($bbuserinfo['usergroupid'], array(5, 6, 7)))
{
if ($thread['notes'] == '') $thread['notes'] = 'None.';
eval("\$threadnotes = \"" . gettemplate("showthread_threadnotes") . "\";");
}
else $threadnotes = '';
}
Would be simplified to:
if (thisis("showthread"))
{
if (userisingroup("5,6,7"))
{
if ($thread['notes'] == "") $thread['notes'] = "None.";
evaltemplate("showthread_threadnotes", "threadnotes");
}
else $threadnotes = "";
}
And another example:
if (strpos($_SERVER['PHP_SELF'], 'index.php') != false)
{
$totalchars = $DB_site->query("SELECT SUM(LENGTH(pagetext)) AS totalchars FROM post");
$totalchars = $DB_site->fetch_array($totalchars);
$totalchars = number_format($totalchars['totalchars']);
}
becomes:
if (thisis("index"))
{
$totalchars = numberformat(mysqlonlyresult("SELECT SUM(LENGTH(pagetext)) AS totalchars FROM post"));
}
|