Source for file glsmarttemplate.php
Documentation is available at glsmarttemplate.php
* Game View Template definitions
* GloryLands, a Web-Based, Massive Multiplayer Online RPG/Strategy Game
* Copyright (C) 2008-09 John Haralampidis <jïhnys2[at]gmail.cïm>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* For any help/suggestions or troubleshooting you can see the
* project community website at <http://www.glorylands.gr>
* @license GNU/GPLv3 GNU General Public License version 3
* @author John Haralampidis <jïhnys2[at]gmail.cïm>
* @copyright Copyright (C) 2007-2009, John Haralampidis
* GloryLands Smart template
* This class extends the GLTemplate and appends some automation support.
* 1) The GLSmartTemplate will automatically extract all the head information
* from the HTML template and add them on the root template. That way you
* don't need to concern about putting the heading information on a special
private function extract_params($param) {
preg_match_all('/(\\w+)=[\'"](.*?)[\'"]/', $param, $parms, PREG_SET_ORDER);
$res[$p[1]] = $res[$p[2]];
private function analyze_header($headers) {
$param = $this->extract_params($data[3]);
echo '['. $name. ': '. print_r($param,true). ']';
public function fetch() {
$buffer = parent::fetch();
preg_match('%<head>(.*?)</head>%s', $buffer, $head);
preg_match('%<body>(.*?)</body>%s', $buffer, $body);
// Make sure we have the proper body
preg_match('%<(\\w+) ?(.*?)>(.*?)</\\1>|<(\\w+).*?/>%s', $buf, $heads, PREG_SET_ORDER);
echo '===[Data]======================='. "\n". $buf. "\n". '===[Array]======================'. "\n". print_r($heads,true);
$this->analyze_header($h);
|