SitePoint Sponsor

User Tag List

Page 2 of 2 FirstFirst 12
Results 26 to 38 of 38
  1. #26
    throw me a bone ... now bonefry's Avatar
    Join Date
    Nov 2004
    Location
    Romania
    Posts
    848
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Ezku
    Yeah, it kinda is. The XSL syntax can be pretty damn ambiguous at times - plus, being XML, it's a horrible bloat, as you demonstrated yourself.

    Well, yeah, kinda. What bugs me is that afaik you need an actual XML file to transform, which is sub-optimal in numerous cases. Generating that XML is slow, and if you need to do it dynamically based on each request... ouch.

    Unless I'm horribly mistaken, that is.
    OK, that's it. I won't promote XSL anymore, since nobody wants it .

    You should read about XSL before making claims about it. Bloat ? Tell me, does your favorite template manager have sub-templates. Do you ever reuse code with your template manager without copy/paste ? Do you have any tool that can do automatic syntax completion or that debugs your templates ? Does your template work in java or in python or in ruby without rewritting the template manager for that platform ? And be honest about it

    The real slow task is the actuall XSL parsing, but that can be handled on the client by the latest browsers.

    About the XML generation. How slow is the following ?
    Code:
    $xmlString = "
    <docRoot>
        <person>
            <first_name>John</first_name>
            <last_name>Baldwin</last_name>
        </person>
    </docRoot>
    ";

  2. #27
    SitePoint Guru
    Join Date
    Oct 2001
    Posts
    656
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    About the XML generation. How slow is the following ?
    Slower than
    Code:
    [person]
    first_name = John
    last_name = Baldwin
    Especially considering the fact that you have to type it at some time

  3. #28
    throw me a bone ... now bonefry's Avatar
    Join Date
    Nov 2004
    Location
    Romania
    Posts
    848
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Captain Proton
    Slower than
    Code:
    [person]first_name = John
    last_name = Baldwin
    Especially considering the fact that you have to type it at some time
    Yeeas, but that INI file can't hold a query result

    I just love to argue

  4. #29
    Non-Member
    Join Date
    Jan 2003
    Posts
    5,748
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I just love to argue
    Me too It is absent to put it politely to compare INI with an XSL-T stylesheet, when you consider the adverse advantages that XPath and XML offer

    There are some issues to be taken into account with PHP4.x, but this I wouldn't think is something to worry too much about with PHP5... Surely?

    About the XML generation. How slow is the following ?
    Not much as far as the string goes, in regards to PHPs parser, but what you need to consider is the amount of memory consumed by the DOM structure based on the XML you have yes?

    This isn't really much of an issue either, if the XML structure is in kilobytes, different if it's in megabytes though I'd imagine, but for most purposes and uses, just how often do you come across a 20 Mb file huh?

    If you have an XML file this size, then your proberly using the wrong technology anyways, as I see it...

  5. #30
    SitePoint Guru
    Join Date
    May 2005
    Location
    Finland
    Posts
    608
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You should read about XSL before making claims about it. Bloat ?
    I have. By bloat I meant the syntax - something you just have to admit.
    Tell me, does your favorite template manager have sub-templates. Do you ever reuse code with your template manager without copy/paste?
    Say I'm using Smarty and do something like {include file="header.tpl"} - what's wrong with that?
    Do you have any tool that can do automatic syntax completion or that debugs your templates?
    I don't need "debugging" to write my templates. The question, to me, is just plain irrelevant, but I could guess that isn't so to you if I'm to assume you've used XSL a lot and used to its complex quirks.
    Does your template work in java or in python or in ruby without rewritting the template manager for that platform ? And be honest about it
    No, and frankly - I don't give a damn
    The real slow task is the actuall XSL parsing, but that can be handled on the client by the latest browsers.
    That is by definition not an option.

    I'm by no means trying to pick a fight here. It's an interesting idea to say the least, but I'm not that thrilled about some of the "features" XSL has to offer.

  6. #31
    SitePoint Guru BerislavLopac's Avatar
    Join Date
    Sep 2004
    Location
    Zagreb, Croatia
    Posts
    830
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Ezku
    Say I'm using Smarty and do something like {include file="header.tpl"} - what's wrong with that?
    The primary problem with Smarty and similar engines is that they are reinventing the wheel. They effectively develop a whole new syntax which is then interpreted in PHP, which is itself interpreted. This whole approach may make sense in languages like Java, which are compiled before running (therefore JSP 2.0), but PHP is very flexible and adjustable in runtime, and such efforts are (as a colleague of mine likes to say) saddling a cow.

    As for your question above, let me rephrase it slightly -- what's wrong with <? include('header.tpl') ?> ?.

  7. #32
    throw me a bone ... now bonefry's Avatar
    Join Date
    Nov 2004
    Location
    Romania
    Posts
    848
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    [I]The real slow task is the actuall XSL parsing, but that can be handled on the client by the latest browsers.[I]

    That is by definition not an option.
    Yes it is, because I think XML will replace HTML. It already has gone a long way towards this, and it's like saying "HTML parsing on the client side is not an option by definition". That's why they are called standards. And even if there where always differences between netscape and M$, those can be resolved you know.

  8. #33
    SitePoint Guru BerislavLopac's Avatar
    Join Date
    Sep 2004
    Location
    Zagreb, Croatia
    Posts
    830
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by bonefry
    Yes it is, because I think XML will replace HTML. It already has gone a long way towards this, and it's like saying "HTML parsing on the client side is not an option by definition". That's why they are called standards. And even if there where always differences between netscape and M$, those can be resolved you know.
    I tend to agree with bonefry here. Ajax is all the rage right now, but people praising it seem to forget that it's best used in combination with XML/XSLT. I have used this technique five years ago to create a client-side application which called an SQLXML query though XMLHTTPRequest (the best concept Microsoft has ever released) and transformed the response by XSLT into a DOM tree which was if necessary (and usually wasn't) modified by JScript and placed into the display.

  9. #34
    throw me a bone ... now bonefry's Avatar
    Join Date
    Nov 2004
    Location
    Romania
    Posts
    848
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I don't need "debugging" to write my templates. The question, to me, is just plain irrelevant, but I could guess that isn't so to you if I'm to assume you've used XSL a lot and used to its complex quirks.
    Your not right about this. If you don't need debugging it only means that your interfaces you designed were very simple or you use PHP whenever things get complicated.

    I used Smarty in the past and I did worked with its debugging very often since I had very complex designs and I wanted to make no use of PHP. But its debugging facility was a simple javascript popup listing the variables. No F8 (jump to next instruction) facility. That's what I meant.

  10. #35
    throw me a bone ... now bonefry's Avatar
    Join Date
    Nov 2004
    Location
    Romania
    Posts
    848
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Say I'm using Smarty and do something like {include file="header.tpl"} - what's wrong with that?
    XSLT can pass parameters when doing a sub-template call. In Smarty or simillar, you can only do this from PHP (unless I am mistaking).

    But what you can't do in a normal Smarty like template engine is recursion.

    In XSL you can do recursion with sub-templates. And call other templates from you sub-templates and because of this experienced XSLT programmers use sub-templates instead of foreach statements. And one advantage is that it encourages code-reuse between different applications and not different pages.

  11. #36
    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)
    Quote Originally Posted by bonefry
    But what you can't do in a normal Smarty like template engine is recursion.
    I recall years ago I wrote a page which displayed a node hierarchy, and it used Smarty as a template engine and used recursion to descend the hierarchy and display it.
    Jason Sweat ZCE - jsweat_php@yahoo.com
    Book: PHP Patterns
    Good Stuff: SimpleTest PHPUnit FireFox ADOdb YUI
    Detestable (adjective): software that isn't testable.

  12. #37
    Non-Member
    Join Date
    Jan 2003
    Posts
    5,748
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Bet the script and the template was a complete mess though Jason huh?

    +1 Jason for at least attempting something like that...

  13. #38
    SitePoint Addict been's Avatar
    Join Date
    May 2002
    Location
    Gent, Belgium
    Posts
    284
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Ezku
    Say I'm using Smarty and do something like {include file="header.tpl"} - what's wrong with that?
    There's nothing really 'wrong' with it, but the issue I have with such an approach is that now the designer actually has to have a working PHP-with-Smarty infrastructure to actually see his design, if the infrastructure isn't there, bye bye wysiwyg.
    Furthermore, Smarty nor PHP are what I'd call web standards, I think a 2 step process would be a better approach:
    Design realm: let them use their tools, their standards, their conventions and produce (x)html, plain and simple.
    App dev realm: auto-compile the given (x)html to php native templates (the kind of template that's always being held up high by the folks who scream 'but php is already a template engine!' (myself included for a while I might add ) Anyway, this has been mentioned numerous times before, sorry for reiterating.

    On that note, has anybody experimented with 2 files for templates:
    1. The (x)html files, maintained by the design department
    2. Some mapping or binding file, maintained by the app dev department, which maps css selectors to references to dynamic data? This would cut out the need of having any special markup in the source template files. (Although splitting the knowledge over 2 files might not be a good idea).

    Anyway, I do have the strong feeling that it is utterly wrong to force our tools and standards upon the design realm that already has their own. That's enforcement, not integration.
    Per
    Everything
    works on a PowerPoint slide


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
  •