-
[Cache, Cron, OOP, MySQLi, Multi-TPL] QuickTPL v0.2 Beta
v0.3: http://www.mediafire.com/download.php?tcr7t8hpfoi5i81
____
The release of 5 days ago is QuickTPL v0.1 Beta, now here is 0.2:
QuickTPL v0.2 Beta.rar
Changed QuickTPL.php (And a lot more ofcourse)
PHP Code:
<?php
define('AbsoluteStart', microtime(true));
require('QuickTPL/System.php');
$TPL = new Template();
$TPL->Set('sitename', Config::$name);
$TPL->Set('url', URL);
$TPL->AddLine('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">');
$TPL->AddLine('<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">');
$TPL->AddLine('<head>');
$TPL->AddLine(tab.'<title>{sitename}: {pageTitle}</title>');
$TPL->GetLinks();
$TPL->AddLine('</head>');
$TPL->AddLine('<body>');
$TPL->GetContent();
$TPL->AddLine('</body>');
$TPL->AddLine('</html>');
$TPL->Output('<!-- QuickTPL: Loaded in '.(microtime(true) - AbsoluteStart).' seconds -->');
?>
Quote:
Some people might still be using my FrostCMS releases.
When I look at them I really think they are badly coded, and pretty slow.
I didn't have time to improve FrostCMS because of school. My friend wanted to learn a little bit of HTML too and I made a simple system for him which I called QuickTPL. I kept improving it bit by bit every weekend and now I have a handy system which can make your developement much faster.
I call it QuickTPL v1 Beta because a lot of classes aren't finished yet, and you'll definitely see me release a new version. It's not yet Habbo made, it's just a base. I already started on a Habbo theme but didn't do yet on the front end.
There are some examples of code in the comments I made in some files. You can take a look of the code and get ideas, I don't care if you take code out of it without giving credits, I just don't want you to steal the whole system and say it's yours.
What everyone was waiting for (the download link): QuickTPL v1 Beta.rar
Remember: It's not ready for actual use. It just showes what I learned in the past two years about PHP.
Code Example (QuickTPL.php):
PHP Code:
<?php
define('AbsoluteStart', microtime(true));
require('QuickTPL/System.php');
$QuickTPL = new Template();
$QuickTPL->SetArray(Array('cssLink' => '<link rel="stylesheet" type="text/css" href="', '/' => '" />'));
$QuickTPL->SetArray(Array('jsLink' => '<script type="text/javascript" src="', '/jsLink' => '"></script>'));
$QuickTPL->Set('sitename', Config::$name);
$QuickTPL->Set('url', URL);
$QuickTPL->AddLine('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">');
$QuickTPL->AddLine('<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">');
$QuickTPL->AddLine('<head>');
$QuickTPL->AddLine(tab.'<title>{sitename}: {pageTitle}</title>');
Includes::Get($QuickTPL);
$QuickTPL->AddLine('</head>');
$QuickTPL->AddLine('<body>');
$QuickTPL->GetContent();
$QuickTPL->AddLine('</body>');
$QuickTPL->AddLine('</html>');
$QuickTPL->Output();
unset($QuickTPL);
?>
Easy TPL functions like:
PHP Code:
<?php
//this is the handler
$this->SetArray($DB->GetRow("SELECT shortstory, longstory FROM cms_articles WHERE id = '5'"));
?>
<!-- This is the content -->
{shortstory}
{longstory}
Like if you like it :ott1:
-
Instead of showing the TPL code, provide examples to show the power of it.
-
Re: [ Cache, Cron, OOP, MySQL, Multi-TPL ] QuickTPL v1 Beta
(this is the handler)
It's not really recommended to show up a comment in a code block, people can copy that code and say: it doesn't work (I don't mean everyone, because I think 90% of the community is.. well.. pretty smart)
Anyways, I don't know if it's good.
Offtopic: Is it true MySqli is better than MySql? I heard it somewhere.
-
Re: [ Cache, Cron, OOP, MySQL, Multi-TPL ] QuickTPL v1 Beta
Quote:
Originally Posted by
Tha
(this is the handler)
It's not really recommended to show up a comment in a code block, people can copy that code and say: it doesn't work (I don't mean everyone, because I think 90% of the community is.. well.. pretty smart)
Anyways, I don't know if it's good.
Offtopic: Is it true MySqli is better than MySql? I heard it somewhere.
MySQLi is a much cleaner (and actually easier if you understand OOP) method to connect to MySQL than the mysql_X functions.
PDO became the standard MySQL driver now, but I prefer to use MySQLi because it's stabler and I can use the num_rows variable.
However, the mysql_X functions are actually faster if you look at speed tests or do them yourself.
So you have to choose: Do you want to improve your code with nanoseconds by making your code less readable?
-
Re: [ Cache, Cron, OOP, MySQL, Multi-TPL ] QuickTPL v1 Beta
Quote:
Originally Posted by
azaidi
MySQLi is a much cleaner (and actually easier if you understand OOP) method to connect to MySQL than the mysql_X functions.
PDO became the standard MySQL driver now, but I prefer to use MySQLi because it's stabler and I can use the num_rows variable.
However, the mysql_X functions are actually faster if you look at speed tests or do them yourself.
So you have to choose: Do you want to improve your code with nanoseconds by making your code less readable?
I, as myself, have tried out MySqli yet (and I know how it works) but I was wondering if it is really stabler.
Thanks for your comment ;)
-
Re: [Cache, Cron, OOP, MySQLi, Multi-TPL] QuickTPL v1 Beta
I do like the way your database handler returns an array of the required row names.. (If it actually does that?)
-
Re: [Cache, Cron, OOP, MySQLi, Multi-TPL] QuickTPL v1 Beta
Quote:
Originally Posted by
Makarov
I do like the way your database handler returns an array of the required row names.. (If it actually does that?)
GetRow is a function that only returns the first row (auto adding " LIMIT 1") and SetArray sets the array keys with the array values as TPL variables.
It looks like an ugly function but it's to prevent errors
PHP Code:
function GetRow($query) {
$result = $this->Get($query.' LIMIT 1');
if ($result->num_rows > 0) {
return $result->fetch_assoc();
}
return Array();
}
-
Re: [Cache, Cron, OOP, MySQLi, Multi-TPL] QuickTPL v1 Beta
Can you use this to print the vars?
{title}
-
Re: [Cache, Cron, OOP, MySQLi, Multi-TPL] QuickTPL v1 Beta
-
Quote:
Originally Posted by
Makarov
print $var;
I think you should read this. http://www.learnphponline.com/php-basics/php-echo-vs-print
-
Re: [Cache, Cron, OOP, MySQLi, Multi-TPL] QuickTPL v1 Beta
Quote:
Originally Posted by
Divide
Can you use this to print the vars?
{title}
If you add that variable in the handler, yes you can.
($this->Set('title', dbresulttitle) or $this-> SetArray(dbrow))
-
Re: [Cache, Cron, OOP, MySQLi, Multi-TPL] QuickTPL v1 Beta
Question: Why are you not parsing the HTML from a file instead of all the HTML still required in the PHP file.. it doesn't look need and a template system is also meant to draw a line between PHP and HTML.
-
Re: [Cache, Cron, OOP, MySQLi, Multi-TPL] QuickTPL v1 Beta
Have you seen the source or only the examples? I made special handlers for the php jobs..
-
Re: [Cache, Cron, OOP, MySQLi, Multi-TPL] QuickTPL v1 Beta
-
Re: [Cache, Cron, OOP, MySQLi, Multi-TPL] QuickTPL v1 Beta
Nice to test my php ;p Thanks :D
-
Re: [Cache, Cron, OOP, MySQLi, Multi-TPL] QuickTPL v1 Beta
I saw the text 'I hope you like it' but i don't see any likes ):
So i'm the first one
-
Re: [Cache, Cron, OOP, MySQLi, Multi-TPL] QuickTPL v1 Beta
Quote:
Originally Posted by
ησвяαιη
Yuck.
I can't do anything with this, please be clear about what you don't like.
-
Re: [Cache, Cron, OOP, MySQLi, Multi-TPL] QuickTPL v1 Beta
It's just a beta base, I'm still working on it :S
-
Re: [Cache, Cron, OOP, MySQLi, Multi-TPL] QuickTPL v1 Beta
Hmm im sorry Azaidi i dont like the template class
maybe you can make it better look this
Template Class
-
Re: [Cache, Cron, OOP, MySQLi, Multi-TPL] QuickTPL v1 Beta
Quote:
Originally Posted by
ησвяαιη
1. Pointless ASCII:
Code:
/*
_____ _ _ ___________ _
| _ | (_) | ||_ _| ___ \ |
| | | |_ _ _ ___| | _| | | |_/ / |
| | | | | | | |/ __| |/ / | | __/| |
\ \/' / |_| | | (__| <| | | | | |____
\_/\_\\__,_|_|\___|_|\_\_/ \_| \_____/
_ ___ _ ______
| | / _ \ (_) |___ /
| |__ _ _ / /_\ \_ __ ___ _ _ __ / /
| '_ \| | | | | _ | '_ ` _ \| | '__/ /
| |_) | |_| | | | | | | | | | | | |./ /___
|_.__/ \__, | \_| |_/_| |_| |_|_|_|\_____/
__/ |
|___/
*/
2. Made me laugh:
Code:
### If you rename or claim this as your own
### your rights to use this will be gone and
### I'll find you and inject your pc, be warned
### and do not try it, for your own safety.
3. It's a total mess.
4. MySQL class is horrible.
Be more clear.
-
Re: [Cache, Cron, OOP, MySQLi, Multi-TPL] QuickTPL v1 Beta
How is this related to Habbo?
-
Re: [Cache, Cron, OOP, MySQLi, Multi-TPL] QuickTPL v1 Beta
Quote:
Originally Posted by
Rav4eG
How is this related to Habbo?
I'm going to make a very advanced habbo style, but I wanted to show the back end first.
-
Re: [Cache, Cron, OOP, MySQLi, Multi-TPL] QuickTPL v1 Beta
___
The release of 5 days ago is QuickTPL v0.1 Beta, now here is 0.2:
QuickTPL v0.2 Beta.rar
Please say what you think of it!
-
Re: [Cache, Cron, OOP, MySQLi, Multi-TPL] QuickTPL v0.2 Beta
I don't know what it is, but thanks for release :):
-Prizm
-
Re: [Cache, Cron, OOP, MySQLi, Multi-TPL] QuickTPL v0.2 Beta
Quote:
Originally Posted by
Ragin
I don't know what it is, but thanks for release :):
-Prizm
It's a sort of small framework, with a lot of basic functions. I'm going to make it for the Habbo section but I first want to have a good back end.
-
Re: [Cache, Cron, OOP, MySQLi, Multi-TPL] QuickTPL v0.2 Beta
BTW can a Moderator move this to the developement section.
Updated 0.3:
QuickTPL v0.3 Beta (Started on the front-end now).rar
Started on the front-end, wrote a tabs script and I'm working on register and login logout etc now.