SitePoint Sponsor

User Tag List

Page 2 of 2 FirstFirst 12
Results 26 to 48 of 48
  1. #26
    SitePoint Addict
    Join Date
    May 2003
    Location
    Calgary, Alberta, Canada
    Posts
    275
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Oops

  2. #27
    SitePoint Addict
    Join Date
    May 2003
    Location
    Calgary, Alberta, Canada
    Posts
    275
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ive only heard of templates being stored in a database once. Wayne Luke says vbulletin stores templates in the database for a couple of good reasons. That sort of thing is not for your run of the mill application however.

  3. #28
    Non-Member
    Join Date
    Jan 2003
    Posts
    5,748
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ian,

    In another post SweatJe had a go at you because of your posts and I couldn't understand as to why. Now I do

    It appears that you are limiting your application in ways that you (yet) do not understand simple because you have this idea that the database templating method is your 'only choice' is what I'm getting from your various posts.

    Lastcraft has explained why your choice is bad but what happens for example when you roll out your application and someone requests Postgres or Oracle? Er, exactly... You'd be up the clyde without a paddle (goggle the phase if your lost in the translation).

    Very rare occasion you'd use a database for templating (think I said this in another thread?) and for content management I can definitely say that a database storage system is a bad idea for you at this time, for your application and your just giving yourself future problems

    As for SweatJe's attitude (in other thread) maybe there is nothing wrong with it after all huh...

  4. #29
    SitePoint Wizard DougBTX's Avatar
    Join Date
    Nov 2001
    Location
    Bath, UK
    Posts
    2,498
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Ian R. Gordon
    its just I have not really made any progress with this script and its frustrating.
    Quit spending time making your life more difficult then...

    What is your definition of "good way to program"? If you're not making progress and it is frustrating you, then I'm guessing it is not a "good way to program" so my advice is to try a different approach. Then you can see if it is a "better" or a "worse" way to program. Once you can compare things, you'll at least have something to work with.

    Douglas
    Hello World

  5. #30
    SitePoint Evangelist Ian R. Gordon's Avatar
    Join Date
    Feb 2004
    Location
    New York
    Posts
    474
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I say its frustrating because when I am asking for help people keep telling me I am doing it wrong. I am not asking for an opinion of my method of implementing my script I am just asking how I could get it done.
    Ian Gordon
    CSS / XHTML / PHP Programmer
    http://www.iangordon.us

  6. #31
    SitePoint Wizard DougBTX's Avatar
    Join Date
    Nov 2001
    Location
    Bath, UK
    Posts
    2,498
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Ian R. Gordon
    I say its frustrating because when I am asking for help people keep telling me I am doing it wrong. I am not asking for an opinion of my method of implementing my script I am just asking how I could get it done.
    Your first post seems to ba sking for opinions more than anything else, which is what you've gotten. If you were asking specific things, like "how do I get the template from the Database?" (Use SELECT or check out the API of your chosen ORM/DBAL) or "how do I get the variables into the template?" (eval) then you would probably have still have gotten people saying that you shouldn't put your templates in the database

    Douglas
    Hello World

  7. #32
    SitePoint Evangelist ghurtado's Avatar
    Join Date
    Sep 2003
    Location
    Wixom, Michigan
    Posts
    591
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You can't be stuck on the road with a flat tire and when someone stops to help you out, tell them "well, it is a square wheel that I want to put on my car, so are you gonna help me or not?"; you will more than likely not receive any help, as for anyone with common sense, "help" would be to try and explain to you that a round wheel would work much better. But you don't seem like the type that accepts advice from others, so it's unlikely that you will find any kind of help in these forums with that approach.
    Garcia

  8. #33
    Non-Member
    Join Date
    Jan 2003
    Posts
    5,748
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)


    I'm getting the feeling that we may well have another Tony here folks, and it's just something we got to put up with

  9. #34
    SitePoint Zealot
    Join Date
    Jun 2004
    Location
    Bogota
    Posts
    101
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Where's exactly the problem Ian, Wouldn't a select stmnt/eval solution be enough?
    If I have wings, why am I walking?

  10. #35
    SitePoint Wizard
    Join Date
    Aug 2004
    Location
    California
    Posts
    1,672
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I say its frustrating because when I am asking for help people keep telling me I am doing it wrong. I am not asking for an opinion of my method of implementing my script I am just asking how I could get it done.
    Perhaps you are in the wrong forum. This forum is for:
    1) If you wish to discuss topics such as Object Orientated Programming, Design Patterns and other software development techniques related to PHP then please post in the Advanced PHP Programming forum. If your thread does not deal with the above then the Advanced PHP Programming forum is not what you are looking for.

    2) If you need help with a parse error, or would like to know how to achieve something with PHP or have a PHP question that does not fit any other forum then please post in the PHP forum.
    Here you get a opinion: like it or not. When smart people disagree with me, I start to listen more closely to what they are saying and try to learn (though I'd never let them know that ... oops, just did)
    Christopher

  11. #36
    SitePoint Wizard DougBTX's Avatar
    Join Date
    Nov 2001
    Location
    Bath, UK
    Posts
    2,498
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Dr Livingston
    I'm getting the feeling that we may well have another Tony here folks, and it's just something we got to put up with
    Naa, Tony knows he is an a ss. And is proud of it. Ian just likes the relational model much more than the hierarchical filesystem model. He's just putting that preference above the performance/efficiency/ease of coding issues.

    I'm saying that because I disagree with the Tony label - file system based templates are the best choice. If you give the files .phtml extensions and put them outside the server's public directory, you'll get the 'beauty' of the DB solution plus the performance too. (It is extensions like .tpl.php which make the filesystem solution ugly imo, along with using too many and too split up templates. Avoid both those problems and you beat the hell out of the 'beauty' of the relational setup!)

    Perhaps Ian doesn't view things in terms of beauty, but that's my impression for his motivation to move things into the DB. But beauty comes in performance, not just layout. This is design of dynamic systems, the beauty is in the dynamic not some static flow chart.

    imo.

    Douglas
    Hello World

  12. #37
    SitePoint Evangelist
    Join Date
    May 2004
    Location
    New Jersey, USA
    Posts
    567
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Ian R. Gordon
    Traditional template systems rely on flat-files stored on the server in some folder that holds them, the problem with this is that is, in my opinion, cluttered and bad. I want to be able to create templates in the MySQL database and then have variables in those templates such as
    Ian,

    I think you're wrong to be worried about the database structure at this point. Just build a simple class that fetches a template based on a key:
    PHP Code:
     class Template
     
    {
         private 
    $template;
     
         public function 
    __construct($key)
         {
            
    $this->_fetch_template($key);
         }
     
         private function 
    _fetch_template($key)
         {
             return 
    "Not implemented yet.";
         }
     
         public function 
    render()
         {
             return 
    "<span>" $this->template "</span>";
         }
     } 
    I don't think this project is particularly hard but, it will take some time and incorporate a vast array of common features seen across multiple blog and CMS scripts.

    Oh, I also want to create clean SEF URLs so: http://www.domain.com/index.php?cate...page=iangordon => http://www.domain.com/about/iangordon

    So, what I am asking is help with the database structure for MySQL and help with how to implement this templating system.

    PLEASE DO NOT TELL ME ABOUT EXISTING TEMPLATE SYSTEMS!!

    I already know about them and I am not interested in them, don't make any posts mentioning them PLEASE!!!
    Sorry, man:

    There are lots of templating systems out there, and they've solved the various "usual problems": template nesting, variable substitution, etc.

    You'll be much better served tearing them apart for ideas and implementations than asking here. WACT, which is popular with many of the SP users, might be a good starting point.

    This is not to say you have to model your code on any other system, but that you should get your list of features from there. Do a basic use-case analysis to identify the 10 must-have features, and implement them...

    This is where I am at right now, working on gettting this working.
    Good luck.

    =Austin

  13. #38
    SitePoint Evangelist
    Join Date
    May 2004
    Location
    New Jersey, USA
    Posts
    567
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by kyberfabrikken
    Yeah, except that the apples you insist to eat are treated with DDT.
    You should probably have a look at the wikipedia article on DDT: still not shown to be hazardous.

    Perhaps you meant "Alar", which was used to treat apples and has been shown to be harmful?

    =Austin

  14. #39
    SitePoint Wizard
    Join Date
    Aug 2004
    Location
    California
    Posts
    1,672
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    file system based templates are the best choice.
    File system based templates are simply A choice. Ultimately it does not matter where the template data is stored. I see no reason why you couldn't build you own or use one of the many existing templating systems with templates from any data source.
    So, what I am asking is help with the database structure for MySQL and help with how to implement this templating system.
    Filesystem based:
    key - filename
    template - file contents

    DB based:
    key - primary key field
    template - "template" field (type TEXT or BLOB)
    Christopher

  15. #40
    SitePoint Wizard DougBTX's Avatar
    Join Date
    Nov 2001
    Location
    Bath, UK
    Posts
    2,498
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by arborint
    Ultimately it does not matter where the template data is stored.
    Sure, you could even print them out and OCR them whenever someone wants to visit your site:

    Book based:
    key - page number
    template - page text

    ... it is also A choice, though not one I would want to use for the average web app. Performance wise, and complexity of code wise, using the file system is the easiest, and using dead trees is the hardest. That's why you see more people talking about using the file system than using paper to store the data.

    Douglas
    Hello World

  16. #41
    SitePoint Evangelist
    Join Date
    May 2004
    Location
    New Jersey, USA
    Posts
    567
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by arborint
    DB based:
    key - primary key field
    template - "template" field (type TEXT or BLOB)
    It really is that simple. That's why I recommended you just wrap it in a class and get on with the interesting stuff.

    (Note: There are a lot of cool things you can do with DB based templates -- but none of them come into play until you get "basic" template handling to work. So throw something together, put a big "FIXME: this is trash code" in a comment someplace, and move on to the next use case.)

    =Austin

  17. #42
    SitePoint Evangelist Ian R. Gordon's Avatar
    Join Date
    Feb 2004
    Location
    New York
    Posts
    474
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks everyone, I do know I am quite stubborn in my insistence on DB Template Storage system but, its something I already made up my mind about and I don't want to start from square one.

    I am right now looking at different implementions in existing template systems of how things are achieved, some aren't useful because they use PHP5 programming but, most are still PHP4 compatiable.

    I apologize for seeming rude in my responses, this has been a hell of a week for me in terms of school work and other things. This is also important to me, so I do whig out a bit sometimes.

    Thanks again for all your help and I will do some more research regarding this matter.
    Ian Gordon
    CSS / XHTML / PHP Programmer
    http://www.iangordon.us

  18. #43
    Non-Member
    Join Date
    Jan 2003
    Posts
    5,748
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I'll take back what I said earlier about the new Tony, no hard feelings Ian? If it's just a point of being more in favour of one method over another method then there has to be a reasoning behind it, as choosing a database template method has knock on effects as said

    Off Topic:

    still not shown to be hazardous.


    That what they (Goverment) said about BSE here in the UK and now look, people are dying of a brain disorder That's what happens when you feed cattle dead chickens and why I've never eaten beaf for the last 8 odd years.

    ...

  19. #44
    SitePoint Wizard DougBTX's Avatar
    Join Date
    Nov 2001
    Location
    Bath, UK
    Posts
    2,498
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Dr Livingston
    That's what happens when you feed cattle dead chickens and why I've never eaten beaf for the last 8 odd years.
    Even worse is feeding cattle cattle

    Off Topic:

    Livingston: BUT, if he then goes on to parade about his DB solution in every second thread as the absolute best despite the obvious dead-chicken problem, then you've got my goahead to call him Tony
    (Unless something magic happens when he writes it and it turns out to have the same sort of performance against the expectations of 90% of the people here, in which case I want to know all about how you did it Ian! (though in your own thread please ))
    Hello World

  20. #45
    SitePoint Zealot
    Join Date
    Oct 2004
    Location
    naperville
    Posts
    189
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Ian R. Gordon
    Thanks everyone, I do know I am quite stubborn in my insistence on DB Template Storage system but, its something I already made up my mind about and I don't want to start from square one.

    I am right now looking at different implementions in existing template systems of how things are achieved, some aren't useful because they use PHP5 programming but, most are still PHP4 compatiable.

    I apologize for seeming rude in my responses, this has been a hell of a week for me in terms of school work and other things. This is also important to me, so I do whig out a bit sometimes.

    Thanks again for all your help and I will do some more research regarding this matter.
    If you layered well; you would only need to switch out your template DAO and change no other code. Just a thought for the design of your application.

  21. #46
    SitePoint Wizard
    Join Date
    Aug 2004
    Location
    California
    Posts
    1,672
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I am wondering about why there was such a violent reaction to a DB Template Storage system. This thread has acutally got me thinking about one of my clients that has an underused backend Postgres server and a heavily used frontend server used for file uploads. I have been thinking that it might make sense to put the template data in the database just to reduce disk activity on the frontend server.

    I in general agree that you use file systems for what they are good for and databases for what they are good for. But it is not an absolute rule. Also the advice on layering you application is a good one.
    Christopher

  22. #47
    eschew sesquipedalians silver trophy sweatje's Avatar
    Join Date
    Jun 2003
    Location
    Iowa, USA
    Posts
    3,749
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    DB based templates might also be useful in a condition where
    a) you are allowing client based modification
    and b) you have a server farm for load balancing

    It would save you the trouble of replicating between file based systemx or the io overhead of a network mounted file resource.

  23. #48
    SitePoint Evangelist Ian R. Gordon's Avatar
    Join Date
    Feb 2004
    Location
    New York
    Posts
    474
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    http://www.iangordononline.info <- Hadoken development website
    Ian Gordon
    CSS / XHTML / PHP Programmer
    http://www.iangordon.us


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •