Mega PHP Template Engine

Using databases

If you are using databases in the project

Use the 5 Files PHP Inside a Folder "megatpl"


You can customize the settings in the file "mega.class.php"
As the picture

<?php 
    
@define('TEMP_FOLDER_NAME','');
?>
Name Leave empty templates folder when using databases will be automatically extracted from the config table

<?php 
$setting
['use_database'] = true;
?>
Enable the use of databases

<?php 
$setting
['class_database']   = true;
?>
Enable internal database functions for the template

<?php 
$setting
['use_var_config']   = true;
?>
Enable the internal function $config of template

Use the table within the database
--
-- Table structure for table `config`
--

CREATE TABLE IF NOT EXISTS `config` (
  `config_name` varchar(255) collate utf8_bin NOT NULL default '',
  `config_value` text collate utf8_bin NOT NULL,
  PRIMARY KEY  (`config_name`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin;

--
-- Dumping data for table `config`
--

INSERT INTO `config` (`config_name`, `config_value`) VALUES
('sitename', ' Mega Template'),
('sitedesc', 'Mega PHP Template Engine'),
('sitethemes', 'default'),
('sitemail', 'megatpl@gmail.com'),
('siteurl', 'siteurl'),
('sitekey', 'sitekey'),
('charset', 'UTF-8');


Internal variables used within the template
Code HTML:
{SITE_CHARSET}
{SITE_NAME}
{SITE_DESCRIPTION}
{SITE_KEYWORDS}
{SITE_MAIL}
{SITE_URL}
{T_TEMPLATE_PATH}