From: Jan H. <hi...@wi...> - 2000-12-07 14:14:17
|
When browsing through Arno's code for interpreting the templates I came up with a new idea. What is now happening is that you are basically trying to reinvent your own HTML scripting language with "IF"s et cetera. But that is exactly how PHP started! So why not simply us PHP to do this in stead of trying to write your own script interpreter? All you would have to do in your code is define the PHP variables and function that can be used in the template, and then simply include the template at the end of the code. A template like browse.html could then look like this: ---- <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <title><? echo $page; ?></title> </head> <body bgcolor=ivory text=black alink=red link=darkblue vlink=darkmagenta> <h1> <a href="<? echo $scripturl; ?>"> <img src="<? echo $logo; ?>"border=0 alt="[phpwiki]" align=middle width=50 height=50> </a> <a href="<? echo $scripturl; ?>?full=<? echo $pageurl; ?>"> <? echo $page; ?> </a> </h1> <? if ($admin) { ?> <FORM ACTION="<? echo $scripturl; ?>" METHOD=POST> <? if ($lock) { ?> [<a href="<? echo $scripturl; ?>?unlock=<? echo $pageurl; ?>">Unlock page</a>] <? } else { ?> [<a href="<? echo $scripturl; ?>?lock=<? echo $pageurl; ?>">Lock page</a>] <? } ?> - - [<a href="<? echo $scripturl; ?>?remove=<? echo $pageurl; ?>">Remove page</A>] <hr noshade> <? } ?> <P> <? echo $content; ?> <hr noshade> ... ---- Well, you get the point. Time for some pro's and con's: + phpwiki code gets simpeler + future extensions for templates will be far more easy to program (just define some new PHP variables and functions) + administrator can define very powerfull templates - the templates become less readable if you don't know any PHP - no backwards compatability So what do you guys think? If you think this is a good idea I would be quite willing to spend some time on this during the coming holidays. -- Jan Hidders |