SitePoint Sponsor

User Tag List

Page 2 of 2 FirstFirst 12
Results 26 to 33 of 33
  1. #26
    Non-Member
    Join Date
    Jan 2003
    Posts
    5,748
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I must say that I find that more complicated to figure out then the example with the for loop, which you infact, make much more complicated then it really is, php can move in and out of html with the <? ?> which I think makes it a lot like template engines, as to clear up your example, I would do
    Doesn't really matter which method is more complicated or not; I know from experience in the point of seeing a web designer actually walk out of a job because they looked at something simular to this and wanted no part in it.

    IMO though you shouldn't really have variables of any sort - even tags that represent PHP variable directly or indirectly within any kind of markup.

    For a better idea of constructing a page why not look at HarryF's examples ?

  2. #27
    "Of" != "Have" bronze trophy Jeff Lange's Avatar
    Join Date
    Jan 2003
    Location
    Calgary, Canada
    Posts
    2,063
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by torrent
    <? in XML is considered to be a processing instruction. You follow <? with = in a well-formed XML document and the parser will generate an error.

    The PHP in my templates is run through a parser (my template parser)


    <? echo 1; ?> is considered PHP
    <?=$var?> is considered PHP
    <?xml ?> is not considered PHP, because there is an xml there.

    That's what I was pointing out, in my template engine, I can use short tags, and have valid XHTML, XML, or any other document type.

    Standards compliancy is very important to me, which is why I always use XHTML 1.0 Strict and/or XHTML 1.1, and always validate it, as well as my CSS, and make sure my CSS has no errors or warnings, and that my site works in Mozilla, IE/Win, IE/Mac, and Opera.
    Who walks the stairs without a care
    It shoots so high in the sky.
    Bounce up and down just like a clown.
    Everyone knows its Slinky.

  3. #28
    SitePoint Addict mgkimsal's Avatar
    Join Date
    Sep 1999
    Posts
    209
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Xhtml

    Quote Originally Posted by cyborg from dh
    The PHP in my templates is run through a parser (my template parser)


    <? echo 1; ?> is considered PHP
    <?=$var?> is considered PHP
    <?xml ?> is not considered PHP, because there is an xml there.

    That's what I was pointing out, in my template engine, I can use short tags, and have valid XHTML, XML, or any other document type.

    Standards compliancy is very important to me, which is why I always use XHTML 1.0 Strict and/or XHTML 1.1, and always validate it, as well as my CSS, and make sure my CSS has no errors or warnings, and that my site works in Mozilla, IE/Win, IE/Mac, and Opera.
    I think the point the earlier poster was trying to make is that if you use an editing tool which is expecting valid XHTML to edit your templates, you'll be hosed.

    If this is the case, how many 'real world' editors choke on
    <?=$foo;?>
    being in a file? Probably very few, as they want as many people to work with their product as possible.

    Now, if the original poster was suggesting that I can't *generate* valid XHTML without using something like smarty or patTemplate, then s/he is just wrong.

    ------------------------
    http://www.logicreate.com

  4. #29
    ********* Member website's Avatar
    Join Date
    Oct 2002
    Location
    Iceland
    Posts
    1,238
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by cyborg from dh
    The PHP in my templates is run through a parser (my template parser)


    <? echo 1; ?> is considered PHP
    <?=$var?> is considered PHP
    <?xml ?> is not considered PHP, because there is an xml there.

    That's what I was pointing out, in my template engine, I can use short tags, and have valid XHTML, XML, or any other document type.

    Standards compliancy is very important to me, which is why I always use XHTML 1.0 Strict and/or XHTML 1.1, and always validate it, as well as my CSS, and make sure my CSS has no errors or warnings, and that my site works in Mozilla, IE/Win, IE/Mac, and Opera.
    I must say that I would like to see your template engine!
    - website

  5. #30
    "Of" != "Have" bronze trophy Jeff Lange's Avatar
    Join Date
    Jan 2003
    Location
    Calgary, Canada
    Posts
    2,063
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Well you can see the administrator-side of things at http://demo.deluxeportal.com, although that is a slightly older version, and you can't update anything.

    I also keep the template engine, and the template parser seperate, the engine handles how the templates get fed to pages, and how you edit them, the parser just creates the code.

    It's difficult to explain, however it took me almost 4 months to come up with a working version, and at that point the parser function was about 120 lines, now it is over 250 lines, just because of testing, feature additions.
    Who walks the stairs without a care
    It shoots so high in the sky.
    Bounce up and down just like a clown.
    Everyone knows its Slinky.

  6. #31
    SitePoint Guru
    Join Date
    Nov 2002
    Posts
    841
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by torrent
    I do not believe loading a large class at the start of a script has any noticeable performance deficit. In fact, if you like I can run some start and end time tests to see how much difference it makes (I've never done this and so could be shooting myself in the foot here)
    I would encourage you to try this test. You might be surprised.

    However, you must use a benchmark like ab (apache benchmark) to do this test.

    The microtime() approach posted above does not include the time that it takes to parse the PHP files themselves. This can be significant for a large class. I have seen cases where the time it takes to parse a large class exceeds the run time of the calls to it.

    The need for performance is related to the type of task you are doing and the volume of traffic that you get.

    I have a client whos site does about 350,000 page requests per day, 3.5 million total requests covering 90GB of transfer per day. This demands a different template solution than for a site that only gets a few hits per day. (Like the web site for my own business.)

  7. #32
    ********* Member website's Avatar
    Join Date
    Oct 2002
    Location
    Iceland
    Posts
    1,238
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    cyborg, your site is great way to complicated that I would ever bother to code it , how many are you working on it ?

    And I assume you can't post the actual code behind the template engine/parser ?
    - website

  8. #33
    "Of" != "Have" bronze trophy Jeff Lange's Avatar
    Join Date
    Jan 2003
    Location
    Calgary, Canada
    Posts
    2,063
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Well, I am one of 2 developers, Andrew's actually registered over here, but he's only got one post, . Yeah, sorry, but I can't post the template parser code .

    (And if you think that's great, wait until Beta 4 comes out ).
    Who walks the stairs without a care
    It shoots so high in the sky.
    Bounce up and down just like a clown.
    Everyone knows its Slinky.


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
  •