1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

System Structure

Discussion in 'PHP' started by PeterB, Jan 17, 2006.

  1. #1
    Hey guys,

    I'm new to this forum, so first I'm gonna introduce myself to you :).
    I am Peter Bosch from the Netherlands and I am sixteen years old. Enough about me ;).

    About a year ago I made a website about (little) trades, such as Ebay.
    Now this system is a bit old and I want to rewrite the whole system, but I want to do this very secure this time.

    So I am very aroused curiosity about the way you program big websites.
    What kind of techniques do you use? (Like template parsers, mysql classes, etc.)

    Hope this will be a nice discussion and very educative for us all!

    Greetings,
    Peter Bosch
     
    PeterB, Jan 17, 2006 IP
  2. onlyican.com

    onlyican.com Peon

    Messages:
    206
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Depends what you want to do.

    I have a page which is half on MySQL db and half on codes, no pure "static" htm pages.

    each page depends on something

    From IF ($logged_in_user)

    to if this then that then that then that.

    then grab result from DB
     
    onlyican.com, Jan 17, 2006 IP
  3. rossriley

    rossriley Guest

    Messages:
    25
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    0
    #3
    I swear by PHPTAL for templating.....
    it means someone else can layout the html pages with absolutely zero PHP code thus getting good separation....

    Other than that we have our own MVC framework which is not too dissimilar to the many others that can be freely downloaded, and make sure that all sites you do however big or small stick to the same framework.

    For mysql we use PDO for database access, which theoretically allows you to deploy to other databases (though some are easier than others) with an activeRecord class to wrap database access. Again, most available frameworks use a similar principle, I've just found that they need to be customised a little to make them more adaptable.

    Ross
     
    rossriley, Jan 17, 2006 IP
  4. cornelius

    cornelius Peon

    Messages:
    206
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    0
    #4
    dont go templating unless u have a good reason, its a waste of resources on busy sites (i know from personal experience)

    i use a "director script model" (cant think of the propers software eng term at the moment )

    basicaly i have 1 page (index.php)
    now this page does common things that will be the same across most ur pages,
    for example it does user verification and authentication, user ip loging, requiring all my other classes, requiring 3rd part classes like PEAR, creating most used objects like User, Thread, Message and so on

    and most importantly it decides what module to load

    for example

    i have http://www.example.com/?do=postMessage

    this director script will check user authentication, then itll check if a module called postMessage exists, then it checks whether the current user has permission to use this module, if a user can use it the module is loaded
     
    cornelius, Jan 17, 2006 IP
  5. PeterB

    PeterB Peon

    Messages:
    6
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Hmm that's a nice alternative for templates, it looks like a "page system".
    You know, like: www.site.com/index.php?page=home
     
    PeterB, Jan 18, 2006 IP
  6. dave487

    dave487 Peon

    Messages:
    701
    Likes Received:
    20
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Using www.site.com/index.php?page=home is bad practice for SEO and I think lazy programming.

    Far better to create a template using server side includes (SSI's) for example
    <?php
    include('header.inc.php');
    ?>
    Type page content here.
    <?php
    include(footer.inc.php');
    ?>
    PHP:
    Using this method to create each page you can alter every page on your site just by changing the header and footer files.
     
    dave487, Jan 18, 2006 IP
  7. neterslandreau

    neterslandreau Peon

    Messages:
    279
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    0
    #7
    Smarty is a great template engine. Like it was reported for PHPTAL, it allows you to seperate the php code from the page design. Of course it is open source and free.
     
    neterslandreau, Jan 18, 2006 IP
  8. rossriley

    rossriley Guest

    Messages:
    25
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    0
    #8
    I do get fed up with the 'don't use templating engines they're slower' argument. The usual response is don't use php because it adds an overhead to programming in C.

    The important thing is never speed, it's programming correctly and separating presentation from logic is one of the primary rules of good programming.

    If your templating system is slowing you down, you can cache your pages, remove features you don't need and countless other things to improve your performance. With the majority of applications the speed factor doesn't come into play but you solve it by trying to cure the problem, not by cutting off the head.

    A good templating system allows your programmers to code, and your web designers to produce presentation with no need for either to touch each others work.

    If, as the original question asked, you are planning for larger scale sites the main thing to plan for is that you will not be doing everything yourself.

    Ross
     
    rossriley, Jan 18, 2006 IP
  9. PeterB

    PeterB Peon

    Messages:
    6
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #9
    Hmm, you've got a point in there!


    I've used something like that for a while, but I think a templateparser is much more effective.

    Allright, someone here who knows a nice and effective templateparser? I've used TemplatePower in another project and it worked great.
    But if there is another templateparser which is more effective or faster, tell me! :)
     
    PeterB, Jan 19, 2006 IP
  10. neterslandreau

    neterslandreau Peon

    Messages:
    279
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    0
    #10
    I have been using Smarty for quite a while. It is a great template engine with all the best bells and whistles, i.e. Free, open source, and community supported. The documentation is pretty good and the learning curve was fairly level when I first started working with it.

    It's also a habit of mine to keep one eye on the job market where I've noticed a few opportunities that specifically mention Smarty experience as being preferred.
     
    neterslandreau, Jan 19, 2006 IP
  11. PeterB

    PeterB Peon

    Messages:
    6
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #11
    I think Smarty is to advanced. I need just a simple templateparser, without much features.
    Just parse the file, make blocks and define the variables. Thats it ;).

    Maybe I should try to make one myself. Couldn't be hard to make such a standard parser..
     
    PeterB, Jan 19, 2006 IP