Unfinished template system with PHP & MySQL

Results 1 to 11 of 11
  1. #1
    Account Upgraded | Title Enabled! Putako is offline
    MemberRank
    Mar 2011 Join Date
    CanadaLocation
    542Posts

    Unfinished template system with PHP & MySQL

    Hey, I am not back to stay just to look around.
    Heres my unfinished template system, this is not for somebody looking to use it considering its not even closed to finished. I was just testing around with stuff and I got to bored with it so I am releasing it.
    If you know how to finish it, congrats.
    Here ya go
    connect.php
    PHP Code:
    <?php
    require_once('config.php');
    $lol mysql_connect($dbhost,$dbuser,$dbpassword);
    mysql_select_db($db,$lol);
    if(!
    $lol){
    die(
    '<img src="http://cdn.memegenerator.net/instances/400x/16391317.jpg" />');
    }
    else{
    }
    ?>
    lol @ meme :P
    config.php (change settings)
    PHP Code:
    <?php
    $dbuser 
    "root"
    $dbhost "localhost";
    $dbpassword "pass"
    $db "db"
    ?>
    index.php
    PHP Code:
    <html>
    <body>
    <head>
    <title>Test</title>
    </title>
    <?php
    require_once('connect.php');
    $lol mysql_query("SELECT * FROM style");
    $lol123 mysql_fetch_assoc($lol);
    $bg $lol123['background-color'];
    $font $lol123['font-family'];
    $color $lol123['link-color'];
    echo 
    '<style type="text/css">
    body{
    background-color:#'
    ;
    echo 
    $bg;
    echo 
    ';';
    echo 
    'font-family:';
    echo 
    $font;
    echo 
    ';}';
    echo 
    '';
    echo 
    'a:link {color:#';
    echo 
    $color;
    echo 
    '}';
    echo 
    'a:visited {color:#';
    echo 
    $color;
    echo 
    ';}';
    echo 
    '.ex
    {
    width:100%px;
    height:100px;
    background-color:#336699;
    margin: -8;
    padding: 0em;
    }'
    ;
    echo 
    '.loll
    {
    width:100%px;
    height:26px;
    background-color:#1D536E;
    margin: -8;
    padding: 6px;
    };'
    ;
    echo 
    '</style>';
    echo 
    '<div class="ex">';
    echo 
    '</div>';
    echo 
    '<div class="loll">';
    $res mysql_query("SELECT * FROM navigator");
    while (
    $row mysql_fetch_assoc($res)) {
        echo 
    '&nbsp;';
        echo 
    '<a href="';
        echo 
    $row["link"];
        echo 
    '">';
        echo 
    $row["name"];
        echo 
    '</a>';
    }
    echo 
    '</div>';
    ?>
    and run this SQL.
    -- phpMyAdmin SQL Dump
    -- version 3.4.5
    -- phpMyAdmin
    --
    -- Host: localhost
    -- Generation Time: Mar 19, 2012 at 06:55 AM
    -- Server version: 5.5.16
    -- PHP Version: 5.3.8

    SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
    SET time_zone = "+00:00";


    /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
    /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
    /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
    /*!40101 SET NAMES utf8 */;

    --
    -- Database: `temp`
    --

    -- --------------------------------------------------------

    --
    -- Table structure for table `navigator`
    --

    CREATE TABLE IF NOT EXISTS `navigator` (
    `id` int(11) NOT NULL AUTO_INCREMENT,
    `name` text NOT NULL,
    `link` text NOT NULL,
    `fontcolor` text NOT NULL,
    PRIMARY KEY (`id`)
    ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=3 ;

    --
    -- Dumping data for table `navigator`
    --

    INSERT INTO `navigator` (`id`, `name`, `link`, `fontcolor`) VALUES
    (1, 'Test', 'http://google.ca', '000000'),
    (2, 'LOL', 'falfh', 'FFFFFF');

    -- --------------------------------------------------------

    --
    -- Table structure for table `style`
    --

    CREATE TABLE IF NOT EXISTS `style` (
    `background-color` text NOT NULL COMMENT 'The background color of your website (HEX)',
    `font-family` text NOT NULL COMMENT 'Font family for everything on your website',
    `font-color` text NOT NULL COMMENT 'Font color of your font',
    `link-color` text NOT NULL COMMENT 'Color of hyperlinks on your website',
    `box-colors` text NOT NULL COMMENT 'Color of your boxes'
    ) ENGINE=InnoDB DEFAULT CHARSET=latin1;

    --
    -- Dumping data for table `style`
    --

    INSERT INTO `style` (`background-color`, `font-family`, `font-color`, `link-color`, `box-colors`) VALUES
    ('C0C0C0', 'Tahoma', '330000', 'FFFFFF', '3399CC');

    /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
    /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
    /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
    pls give me your constructive critism and if this helped you, like it.


  2. #2
    Hm. foxx is offline
    MemberRank
    Sep 2006 Join Date
    Czech RepublicLocation
    5,257Posts

    Re: Unfinished template system with PHP & MySQL

    wow, this is really, really bad

  3. #3
    Infraction Baɴɴed holthelper is offline
    MemberRank
    Apr 2008 Join Date
    1,765Posts

    Re: Unfinished template system with PHP & MySQL

    i loled

  4. #4
    Mother effin' clouds SaintsIan is offline
    MemberRank
    Apr 2008 Join Date
    fyrechat.netLocation
    2,809Posts

    Re: Unfinished template system with PHP & MySQL

    Quote Originally Posted by foxx View Post
    wow, this is really, really bad
    That's an understatement.

  5. #5
    Account Upgraded | Title Enabled! Putako is offline
    MemberRank
    Mar 2011 Join Date
    CanadaLocation
    542Posts

    Re: Unfinished template system with PHP & MySQL


    Well of course it is bad? Its just a base if someone wanted to do something with it..
    instead of spamming next time post what would be 'better'.
    I could give 2 shits what anybody thinks about this, considering i barley started it.
    Please also consider I am still learning. Hope someone learns from this.
    Its also just an example of what you could do with a template system.
    Take this also into consideration - I havent even finished what I posted here.

  6. #6
    Software Person TimeBomb is offline
    ModeratorRank
    May 2008 Join Date
    United StatesLocation
    1,252Posts

    Re: Unfinished template system with PHP & MySQL

    Quote Originally Posted by Putako View Post

    Well of course it is bad? Its just a base if someone wanted to do something with it..
    instead of spamming next time post what would be 'better'.
    I could give 2 shits what anybody thinks about this, considering i barley started it.
    Please also consider I am still learning. Hope someone learns from this.
    Its also just an example of what you could do with a template system.
    Take this also into consideration - I havent even finished what I posted here.
    Here's the issue:

    This isn't a template system.
    This is including HTML and PHP in the same file. Without even attempting to separate much of anything.

    A templating system organizes the code via separating PHP and HTML into different files. There's more to it then that, but that's always a good starting point.

  7. #7
    Account Upgraded | Title Enabled! Putako is offline
    MemberRank
    Mar 2011 Join Date
    CanadaLocation
    542Posts

    Re: Unfinished template system with PHP & MySQL

    Quote Originally Posted by timebomb View Post
    Here's the issue:

    This isn't a template system.
    This is including HTML and PHP in the same file. Without even attempting to separate much of anything.

    A templating system organizes the code via separating PHP and HTML into different files. There's more to it then that, but that's always a good starting point.
    There was intended to be an admin panel to edit content and the layout such as the profile editor in userCP. I never got around to it. Sorry for trying, il stop.

  8. #8
    Hm. foxx is offline
    MemberRank
    Sep 2006 Join Date
    Czech RepublicLocation
    5,257Posts

    Re: Unfinished template system with PHP & MySQL

    Quote Originally Posted by timebomb View Post
    Here's the issue:

    This isn't a template system.
    This is including HTML and PHP in the same file. Without even attempting to separate much of anything.

    A templating system organizes the code via separating PHP and HTML into different files. There's more to it then that, but that's always a good starting point.
    not to mention missing doctype, <head> inside <body>, missing closing tags, inline styles, messed up CSS(such as margin: -8 OR width:100%px), require_once() etc AFTER html AND LOADS AND LOADS of other messed up stuff..

  9. #9
    Software Person TimeBomb is offline
    ModeratorRank
    May 2008 Join Date
    United StatesLocation
    1,252Posts

    Re: Unfinished template system with PHP & MySQL

    @Putako
    Don't give up. While this specific project may not be something you want to continue doing - keep at it (in general, not the project), it's all a learning experience.

    Quote Originally Posted by foxx View Post
    not to mention missing doctype, <head> inside <body>, missing closing tags, inline styles, messed up CSS(such as margin: -8 OR width:100%px), require_once() etc AFTER html AND LOADS AND LOADS of other messed up stuff..
    Well there were obviously tons of issues, but I was trying to encompass the broader issue of misunderstanding what a template system is.

  10. #10
    Account Upgraded | Title Enabled! Putako is offline
    MemberRank
    Mar 2011 Join Date
    CanadaLocation
    542Posts

    Re: Unfinished template system with PHP & MySQL

    I am aware how sloppy the code is, this was BARLEY started. It was just for people whom may use it or work off of it. Say somebody knew what to do, it would save the some time?

  11. #11
    Omega Ron is offline
    MemberRank
    Apr 2005 Join Date
    Location
    8,990Posts

    Re: Unfinished template system with PHP & MySQL

    Where did you learn html? w3 schools? Nah, even they teach proper tags at least...

    Code:
    <html> 
    <body> 
    <head> 
    <title>Test</title> 
    </title>






Advertisement