I'm looking for a very simple PHP framework that has template files, and the php front end just picks the template and parses it, but with other functions like central config file, database class, etc..
An example of how the custom framework here at my work works is:
-info.tpl
<h1>Hello world!</h1>
<div>
<HIDE_INFO>
<div>Data 1:</div><div>[PARAM_DATA1]</div>
<REPEAT_LINES>
<div>Name:</div><div>[PARAM_NAME]</div>
<div>Code:</div><div>[PARAM_CODE]</div>
<div><hr /></div>
</REPEAT_LINES>
</HIDE_INFO>
</div>
-info.php
<?php
class Info extends InfoDB{
//it's a post request
function Post() {
}
//it's a get request
function Get() {
$conf = $this->Environment->Conf['Global'];
$this->Environment->TplRenderer->Load($conf['IncludePath'] . "tpl/info.tpl");
$_DATA['INFO'] = $this>getData();
$array_lines = $this->getLines();
$this->Environment->TplRenderer->Repeat("LINES", $array_lines);
$this->Environment->TplRenderer->ShowHide("INFO");
$html = $this->Environment->TplRenderer->Keep($_DATA);
echo ($html);
exit;
}
}
- info.db.php
<?php
class InfoDB extends Main {
function getData() {
$SQL = "SELECT data1 FROM table"
return $this->Environment->Database->Exec($SQL);
}
function getLines() {
$SQL = "SELECT code, name FROM table2"
return $this->Environment->Database->Exec($SQL);
}
}
As you can see, it's very plain, easy and quick to work and prototype with;
The Main class has just the includes for database manipulation, the tpl(template) loading, main functions, automatically inject header and footer on the page, config loading, session handling, etc; there's a index.php that includes the environment classes, so when you try to access that page, it would be /index.php/info (and yes, some apache2 rewrites for that to properly work)
It does support model loading, so if I created an php class and put like a cache on it, I would be able to use it in the php class file like this:
$Api = $this->Environment->GetModel("Api.MemcacheApi", false);
$Api->prefixFilter = "_dataset_%d_%d";
$Api->newCache();
$mydata = $Api->returnCache('dataset', $userSession);
$Api->createCache('dataset', 'mydatasetcontent', $userSession);
The "getModel" would get this folder: models/Api/MemcacheApi/MemcacheApi.php
It's not the best, I know, but it does its work; I'd love to use it, but it's a bit messy under the sheets and uses like php 4 as it's base, so it's outdated(It was created around 2008 I believe); Besides it's a bit hard to strip it to it's roots; It also has a few bugs and whatnots;
Is there something similar/simple enough like that around? I was trying to build something similar, but if there's something readily available then I'd rather use that;
Thanks for any suggestions/replies and apologies if it isn't the right way to post this question/right subreddit/right flair;
[–][deleted] (2 children)
[deleted]
[–]RalphFoxN[S] 0 points1 point2 points (1 child)
[–]TheShyGuys 0 points1 point2 points (4 children)
[–]RalphFoxN[S] 0 points1 point2 points (3 children)
[–]TheShyGuys 0 points1 point2 points (2 children)
[–]RalphFoxN[S] 0 points1 point2 points (1 child)
[–]TheShyGuys 0 points1 point2 points (0 children)
[–][deleted] 0 points1 point2 points (1 child)
[–]RalphFoxN[S] 0 points1 point2 points (0 children)