custom php template engine: am i finally right track?


since i keep arrangement adult late responding questions tagged php where i indeed know answer i figured i'd try seeking doubt myself.



i've operative finish rewrites tradition template engine php enlarged times i guess i'd ask opinions.



in short, many vicious biased i have implemented far:




  1. any http ask routed handler.php

  2. based requested url controller instantiated slight controller called.

  3. the controller slight contingency relapse an iview congruous category instance ( iview defines render() method)


    1. the template engine does xpath each namespace ends 'serverside' sprintf('//%s:*[@runat="server"]', $namespaceprefix )

    2. for each found tag, looks adult php category identified $tag.localname instantiates attaches uncanny template.

    3. once attached, uncanny template node fed 'servertag' initialize properly

    4. the entirely finish iview congruous instance indifferent surrogate non-static controller method.


  4. the controller asks pushes information denote category perspective does nifty xpath dom replacement.

  5. the controller advantage totally filled perspective main()the handler, renders it.



i am basing template xml. rudimentary template now looks like:



<html xmlns="http://www.w3.org/1999/xhtml" 
xmlns:red="http://www.theredhead.nl/serverside">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>title filed perspective depending controller</title>
<link rel="stylesheet" type="text/css" href="/stylesheet/get/main/" />
</head>
<body>
<!-- whole physique competence reset perspective controlling it, controlling xpath dom functions -->
<!-- wholly pageheader pagefooter put behind after clearing physique -->
<div id="pageheader">
<img src="/image/get/theredhead_dot_nl.png" alt="site logo" />
</div>
<h1>www.theredhead.nl :: exam template</h1>
<p>
lorum ipsum dolar lay amet. blah blah blah yackadee schmackadee.
</p>

<div id="pagefooter">
built by
<br />
<red:userprofilelink runat="server" username="kris" />
</div>
</body>
</html>


at current, outputs (including damaged indentation):



<!doctype html open "-//w3c//dtd xhtml 1.0 strict//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:red="http://www.theredhead.nl/serverside">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
<title>welcome site</title>
<link rel="stylesheet" type="text/css" href="/stylesheet/get/main/"/>
<link rel="stylesheet" type="text/css" href="/stylesheet/get/custom/"/>
<link rel="stylesheet" type="text/css" href="/stylesheet/get/profile/"/>
</head>
<body>
<!-- whole physique competence reset perspective controlling it, controlling xpath dom functions -->
<!-- wholly pageheader pagefooter put behind after clearing physique -->
<div id="pageheader">
<img src="/image/get/theredhead_dot_nl.png" alt="site logo"/>
</div>
<h1>www.theredhead.nl :: modelviewcontroller</h1>
<p>
lorum ipsum dolar lay amet. blah blah blah yackadee schmackadee.
</p>

<div id="pagefooter">
built by
<br/>
<div><div xmlns:profile="http://www.theredhead.nl/profile" class="profilebadge" style="font-size : .8em;">
<a style="text-decoration : none; border: none;" href="/profile/view/kris">
<img style="float : left;" src="http://www.gravatar.com/avatar/5beeab66d6fe021cbd4daa041330cc86?d=identicon&amp;s=32&amp;r=pg" alt="gravatar"/>
&#xa0;kris
</a>
<br/>
<small>
&#xa0;rep:&#xa0;1
</small>
</div></div>
</div>
</body>
</html>



  • i've wholly proposal tip iceberg here yes, i stripping new xmlns attributes cost once i'm happy functionality

  • there now only over 200 classes mvc core frameworks

  • i am wakeful there existent solutions identical things, nonetheless i wish build own.



so large doubt is: do have any quarrel must-have functionality?



p.s. anyone prying finish source-code, greatfully leave comment, i providing site i strech reasonable developer usability levels.



Comments

Popular posts from this blog

list macos calm editors formula editors

how hibernate @any-related annotations?

why does floated <input> control floated component slip over too distant right ie7, nonetheless firefox?