[Cache, Cron, OOP, MySQLi, Multi-TPL] QuickTPL v0.2 Beta

Page 1 of 2 12 LastLast
Results 1 to 25 of 26
  1. #1
    I don't even know azaidi is offline
    MemberRank
    Apr 2010 Join Date
    the NetherlandsLocation
    2,065Posts

    [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 -->');
    ?>
    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
    Last edited by azaidi; 09-11-12 at 02:03 PM.


  2. #2
    Ultra Light Beam Makarov is offline
    MemberRank
    Apr 2010 Join Date
    GothamLocation
    3,622Posts
    Instead of showing the TPL code, provide examples to show the power of it.

  3. #3
    Alpha Member Emily is offline
    MemberRank
    Oct 2012 Join Date
    The NetherlandsLocation
    2,408Posts

    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.

  4. #4
    I don't even know azaidi is offline
    MemberRank
    Apr 2010 Join Date
    the NetherlandsLocation
    2,065Posts

    Re: [ Cache, Cron, OOP, MySQL, Multi-TPL ] QuickTPL v1 Beta

    Quote Originally Posted by Tha View Post
    (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?

  5. #5
    Alpha Member Emily is offline
    MemberRank
    Oct 2012 Join Date
    The NetherlandsLocation
    2,408Posts

    Re: [ Cache, Cron, OOP, MySQL, Multi-TPL ] QuickTPL v1 Beta

    Quote Originally Posted by azaidi View Post
    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 ;)

  6. #6
    Ultra Light Beam Makarov is offline
    MemberRank
    Apr 2010 Join Date
    GothamLocation
    3,622Posts

    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?)

  7. #7
    I don't even know azaidi is offline
    MemberRank
    Apr 2010 Join Date
    the NetherlandsLocation
    2,065Posts

    Re: [Cache, Cron, OOP, MySQLi, Multi-TPL] QuickTPL v1 Beta

    Quote Originally Posted by Makarov View Post
    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();


  8. #8
    Banned Divide is offline
    BannedRank
    Aug 2011 Join Date
    British CoderLocation
    1,013Posts

    Re: [Cache, Cron, OOP, MySQLi, Multi-TPL] QuickTPL v1 Beta

    Can you use this to print the vars?

    {title}

  9. #9
    Ultra Light Beam Makarov is offline
    MemberRank
    Apr 2010 Join Date
    GothamLocation
    3,622Posts

    Re: [Cache, Cron, OOP, MySQLi, Multi-TPL] QuickTPL v1 Beta

    print $var;

  10. #10
    Live Ocottish Sverlord Joopie is offline
    LegendRank
    Jun 2010 Join Date
    The NetherlandsLocation
    2,773Posts
    Quote Originally Posted by Makarov View Post
    print $var;
    I think you should read this. http://www.learnphponline.com/php-basics/php-echo-vs-print

  11. #11
    I don't even know azaidi is offline
    MemberRank
    Apr 2010 Join Date
    the NetherlandsLocation
    2,065Posts

    Re: [Cache, Cron, OOP, MySQLi, Multi-TPL] QuickTPL v1 Beta

    Quote Originally Posted by Divide View Post
    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))

  12. #12
    son, i am dissapoint Near is offline
    MemberRank
    Sep 2009 Join Date
    The NetherlandsLocation
    491Posts

    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.

  13. #13
    I don't even know azaidi is offline
    MemberRank
    Apr 2010 Join Date
    the NetherlandsLocation
    2,065Posts

    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..

  14. #14
    Live Ocottish Sverlord Joopie is offline
    LegendRank
    Jun 2010 Join Date
    The NetherlandsLocation
    2,773Posts

    Re: [Cache, Cron, OOP, MySQLi, Multi-TPL] QuickTPL v1 Beta

    You should do more research for your MySQLi class :)

    Take a look at this :)
    [PHP] <?php #Made by Joopie #Ver: 1.5 defined('TRUEEVENT') or die(); //D - Pastebin.com

  15. #15
    Make a wish .::Arjan::. is offline
    MemberRank
    Jan 2012 Join Date
    the NetherlandsLocation
    504Posts

    Re: [Cache, Cron, OOP, MySQLi, Multi-TPL] QuickTPL v1 Beta

    Nice to test my php ;p Thanks :D

  16. #16
    Account Upgraded | Title Enabled! Chapo is offline
    MemberRank
    Jul 2010 Join Date
    United StatesLocation
    944Posts

    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

  17. #17
    I don't even know azaidi is offline
    MemberRank
    Apr 2010 Join Date
    the NetherlandsLocation
    2,065Posts

    Re: [Cache, Cron, OOP, MySQLi, Multi-TPL] QuickTPL v1 Beta

    Quote Originally Posted by ησвяαιη View Post
    Yuck.
    I can't do anything with this, please be clear about what you don't like.

  18. #18
    I don't even know azaidi is offline
    MemberRank
    Apr 2010 Join Date
    the NetherlandsLocation
    2,065Posts

    Re: [Cache, Cron, OOP, MySQLi, Multi-TPL] QuickTPL v1 Beta

    It's just a beta base, I'm still working on it :S

  19. #19
    Valued Member Monsma is offline
    MemberRank
    Dec 2011 Join Date
    The NetherlandsLocation
    126Posts

    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

  20. #20
    I don't even know azaidi is offline
    MemberRank
    Apr 2010 Join Date
    the NetherlandsLocation
    2,065Posts

    Re: [Cache, Cron, OOP, MySQLi, Multi-TPL] QuickTPL v1 Beta

    Quote Originally Posted by ησвяαιη View Post
    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.

  21. #21
    Account Upgraded | Title Enabled! TheOleg is offline
    MemberRank
    Apr 2008 Join Date
    EstoniaLocation
    570Posts

    Re: [Cache, Cron, OOP, MySQLi, Multi-TPL] QuickTPL v1 Beta

    How is this related to Habbo?

  22. #22
    I don't even know azaidi is offline
    MemberRank
    Apr 2010 Join Date
    the NetherlandsLocation
    2,065Posts

    Re: [Cache, Cron, OOP, MySQLi, Multi-TPL] QuickTPL v1 Beta

    Quote Originally Posted by Rav4eG View Post
    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.

  23. #23
    I don't even know azaidi is offline
    MemberRank
    Apr 2010 Join Date
    the NetherlandsLocation
    2,065Posts

    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!

  24. #24
    Apprentice Ragin is offline
    MemberRank
    Nov 2012 Join Date
    8Posts

    Re: [Cache, Cron, OOP, MySQLi, Multi-TPL] QuickTPL v0.2 Beta

    I don't know what it is, but thanks for release
    -Prizm

  25. #25
    I don't even know azaidi is offline
    MemberRank
    Apr 2010 Join Date
    the NetherlandsLocation
    2,065Posts

    Re: [Cache, Cron, OOP, MySQLi, Multi-TPL] QuickTPL v0.2 Beta

    Quote Originally Posted by Ragin View Post
    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.



Page 1 of 2 12 LastLast

Advertisement