Ask a Question related to PHP Development, Design and Development.
-
springchun at 21cn dot com #1
#24818 [NEW]: This is best php template
From: springchun at 21cn dot com
Operating system: linux
PHP version: 4.3.1
PHP Bug Type: Unknown/Other Function
Bug description: This is best php template
Description:
------------
This is best php template than Smarty,FastTemplate and PHPLIB Template;
Is it add this function into php5.0.dll?
please seen 'http://www.cqlc.net/document.txt';
function cqlctpl($file)
{
$fp=fopen($file,"r");
$msg="echo\"".str_replace("\"","\\\"",fread($fp,fi lesize($file)))."\";";
fclose($fp);
$oldstr=array(0=>"/\{loop:([^\}]+)\}(.+)\{\/loop\}/si",
1=>"/\{logi:([^\}]+)\}(.+)\{\/logi\}/si",
2=>"/\{exec:([^\}]+)\}/si",
3=>"/(\{\*[^\*]+\*\})/si"
);
$newstr=array(0=>"\";\\1{echo\"\\2\";}echo\"",
1=>"\";\\1{echo\"\\2\";}echo\"",
2=>"\";\\1;echo\"",
3=>""
);
return preg_replace($oldstr,$newstr,$msg);
}
Reproduce code:
---------------
<?
function cqlctpl($file)
{
$fp=fopen($file,"r");
$msg="echo\"".str_replace("\"","\\\"",fread($fp,fi lesize($file)))."\";";
fclose($fp);
$oldstr=array(0=>"/\{loop:([^\}]+)\}(.+)\{\/loop\}/si",
1=>"/\{logi:([^\}]+)\}(.+)\{\/logi\}/si",
2=>"/\{exec:([^\}]+)\}/si",
3=>"/(\{\*[^\*]+\*\})/si"
);
$newstr=array(0=>"\";\\1{echo\"\\2\";}echo\"",
1=>"\";\\1{echo\"\\2\";}echo\"",
2=>"\";\\1;echo\"",
3=>""
);
return preg_replace($oldstr,$newstr,$msg);
}
function test(){echo"<p>this is 2.tml ,welcome you";}
$title="this is a tml";
$body="this out ";
for($i=0;$i<10;$i++)$array[$i]="hello world $i";
eval(cqlctpl("1.txt"));
Expected result:
----------------
this is a tml (1.tml)
this out is hello world 0
this out is hello world 1
this out is hello world 2
this out is hello world 3
this out is hello world 4
this out is hello world 5
this out is hello world 6
6 is biger than 5
this out is hello world 7
7 is biger than 5
this out is hello world 8
8 is biger than 5
this out is hello world 9
9 is biger than 5
time is 1059193623
this is other tml(2.tml)
this is 2.tml ,welcome you
Actual result:
--------------
this is a tml (1.tml)
this out is hello world 0
this out is hello world 1
this out is hello world 2
this out is hello world 3
this out is hello world 4
this out is hello world 5
this out is hello world 6
6 is biger than 5
this out is hello world 7
7 is biger than 5
this out is hello world 8
8 is biger than 5
this out is hello world 9
9 is biger than 5
time is 1059193623
this is other tml(2.tml)
this is 2.tml ,welcome you
--
Edit bug report at [url]http://bugs.php.net/?id=24818&edit=1[/url]
--
Try a CVS snapshot (php4): [url]http://bugs.php.net/fix.php?id=24818&r=trysnapshot4[/url]
Try a CVS snapshot (php5): [url]http://bugs.php.net/fix.php?id=24818&r=trysnapshot5[/url]
Fixed in CVS: [url]http://bugs.php.net/fix.php?id=24818&r=fixedcvs[/url]
Fixed in release: [url]http://bugs.php.net/fix.php?id=24818&r=alreadyfixed[/url]
Need backtrace: [url]http://bugs.php.net/fix.php?id=24818&r=needtrace[/url]
Try newer version: [url]http://bugs.php.net/fix.php?id=24818&r=oldversion[/url]
Not developer issue: [url]http://bugs.php.net/fix.php?id=24818&r=support[/url]
Expected behavior: [url]http://bugs.php.net/fix.php?id=24818&r=notwrong[/url]
Not enough info: [url]http://bugs.php.net/fix.php?id=24818&r=notenoughinfo[/url]
Submitted twice: [url]http://bugs.php.net/fix.php?id=24818&r=submittedtwice[/url]
register_globals: [url]http://bugs.php.net/fix.php?id=24818&r=globals[/url]
PHP 3 support discontinued: [url]http://bugs.php.net/fix.php?id=24818&r=php3[/url]
Daylight Savings: [url]http://bugs.php.net/fix.php?id=24818&r=dst[/url]
IIS Stability: [url]http://bugs.php.net/fix.php?id=24818&r=isapi[/url]
Install GNU Sed: [url]http://bugs.php.net/fix.php?id=24818&r=gnused[/url]
springchun at 21cn dot com Guest
-
template help
how can i create a background for my template? thanks! take a look, www.cassisdesign.com/nexsyis it will be on the software page that i am... -
template inside another template
Hi All! I have a problem with templates! As far as I know there is a nested template in dw. A nested template means that a template can be... -
CFM in a PHP template?
is there a way to execute CFM code in an existing PHP template? i was toying with a pre-made freeware template that, unfortunately, is all in... -
Using a Template as the base for another Template
Hi, - Dreamweaver MX - Created a HTML-Template with some menu-items (normal hyperlinks) - I need to create on that menu-items some submenu-items... -
#24818 [Opn->Bgs]: This is best php template
ID: 24818 Updated by: iliaa@php.net Reported By: springchun at 21cn dot com -Status: Open +Status: ... -
bizboy12 #2
Re: #24818 [NEW]: This is best php template
Template engine is in a sense a component that allows separation of php and HTML codes. When template engine is used in the application, HTML code is placed into separate files, templates. In addition to the HTML code, these files contain processing instructions that template engines execute, assembling the final HTML page which is downloaded and converted by browsers into what
we see as Web pages. Typically, template engines execute a number of processing instructions, including, but certainly not limited to inserting a value of a certain variable, looping through a set of listings, displaying their titles, and including other template(s).
Some free PHP template engine listed on the page: http://www.phpkode.com/projects/category/php-template-engine/Thousands of free PHP Scripts listed on PHPKode.com
Junior Member
- Join Date
- May 2011
- Posts
- 1



Reply With Quote

