dynamic template system which autoloads from HTML (minimal PHP) -


i have templating engine wrote , use, wanting go better , want know if i'm planning write exists or not, because have specific wants this.

my question: templating system features describe below exist?
if not, there libraries allow of features possibly integrate eachother , integrate of own code, have write of stuff?

i believe answer no, figured i'd ask before spending many many hours making myself.

my intention integrate php,html,css, , js single object oriented system of interact cleanly 1 another. wrote javascript class system integrate accomplish that, given i've established describe below.

tldr; in short, i'm looking object oriented templating engine autoloads html, css, javascript, , php files without having special syntax or new languages write in. plus, able use html files build php objects based on paramaters in file.

what i'm wanting:
autoloading. example, given template.html:

    <div class="templateengine content">          <div class="templateengine content-head"></div>          <div class="templateengine content-body"></div>          <div class="stylizedclass">              static content          </div>     </div> 

it should load php class content , associated resource files (such mysite/content/content.[extension] , call loader method automatically.

then load content-head (php class \content\head w/ namespace) found @ mysite/content/head/head.[extension] , content-body, skip stylizedclass

furthermore, when each of classes (content, content-head, content-body) load, check associated html templates , load php file not have loader method

to explain that, able load content-head either following php file or html file.
/site/content/head/head.php:

namespace content;  class content {     /** returns inner html     */     public function innerhtml(){         return mydbsystem::loaditem(some_id)->content;     } } 

and /site/content/content/head.html:

<div class="somethingstatic">    stupid static content </div> <div class="templateengine content-head-crazyloader"></div> 

so, if php file/class , method exists, call innerhtml() method. if php file not exist, run head.html, autoloading content-head-crazyloader class (oh, yeah. want support nesting boss).

to summarize, template.html loaded, auto loading content-head , inserting return value of \content\head::innerhtml() or content of /site/content/head/head.htmlinto <div> has class content-head.

html php object mapping: this, think, seems bit more straightforward.

for file /site/automap/automap.edit.html:

<div class="templateengine cool-automap">     <input type="text" name="name" value="coolname"/>     <input type="checkbox" name="isfunny" checked>     <select name="multi">         <option value="cat" selected>cat</option>         <option value="dog">dog</option>     </select> </div> 

the php file /site/automap/automap.php generated like:

<?php     namespace cool;      class automap {          public $name;         public $isfunny;          public $multi;         public $multioptions;          public function __constructed(){             //theoretically, template engine first declare              //  this->propname = new \templateengine\prop\datatype();             //  each prop             $this->name->value = 'coolname';             $this->isfunny->value = true;             $this->multi->value = 'cat';              $this->multi->options = array("cat"=>'cat',"dog"=>'dog');         }      } ?> 

pre-compiler: essentially, build cached php pages dynamic sections in them performance, stuff that's static static , dynamic stuff doesn't have run through crazy autoloading on every page request.

also:

  • in html files, able include dynamic bits like: <?=time()?> have simple need php.
  • there database abstraction layer, wrote myself , integrate rest of system auto-load database objects

it doesn't seem exist. options have seen require php code or own simple custom language operate. , don't seem autoload anything. ie, have create variables in php, , write php code load template.

i wrote own (mostly, still in progress) , i'll open source (parts of it, anyway) see fit, not few months.


Popular posts from this blog