I want to make a template engine and i somehow figured out how it is gonna work.
It will be something like this:there will be some .tmp files that will hold the HTML and whenever i want to add something there will be a "#file#" string.
then i will be opening the file and change each occurance of #file# with my content.
Code: Select all
<?xml version="1.0" encoding="#iso#"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="#lang#" lang="#lang#">
<head>
<title>#title#</title>
<meta http-equiv="content-Type" content="text/html; charset=#iso#" />
<meta name="copyright" content="Κερασιώτης Βασίλειος" />
<meta name="rating" content="General" />
<meta http-equiv="pics-label" content='(pics-1.1 "http://www.icra.org/ratingsv02.html" comment "ICRAonline EN v2.0" l gen true for "#site_url#" r (nz 1 vz 1 lz 1 oz 1 cz 1) "http://www.rsac.org/ratingsv01.html" l gen true for "#site_url#" r (n 0 s 0 v 0 l 0))' />
<meta http-equiv="expires" content="0" />
<meta name="resource-type" content="DOCUMENT" />
<meta name="distribution" content="#distribution#" />
<meta name="author" content="Κερασιώτης Βασίλειος" />
<meta name="copyrighted" content="Copyright (c) 2004 by Kerasiotis Vasileios" />
<meta name="keywords" content="#keywords#" />
<meta name="description" content="#description#" />
<meta name="revisit-after" content="1 DAYS" />
<meta name="generator" content="Dev-PHP 1.9.4" />
<link rel="stylesheet" type="text/css" href="cartoon/cartoon.css" />
</head>
<body>
<table id="main_table">
<tr>
<td colspan="3" id="header_cell">#header#</td>
</tr>
<tr>
<td id="leftside_cell">#leftside#</td>
<td id="center_cell">#center#</td>
<td id="rightside_cell">#rightside#</td>
</tr>
<tr>
<td colspan="3" id="footer_cell">#footer#</td>
</tr>
</table>
</body>
</html>Code: Select all
<?php
eregi_replace("#file#","$content",$file);
?>So my question is:
How can i search for strings betwen given characters like "##"??
Sorry for the long post