SitePoint Sponsor

User Tag List

Page 1 of 4 1234 LastLast
Results 1 to 25 of 100
  1. #1
    SitePoint Wizard silver trophy redemption's Avatar
    Join Date
    Sep 2001
    Location
    Singapore
    Posts
    5,269
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Smarty 2.2.0 Released

    Smarty now supports multiple plugin directories, supports grouping of cache files for easier maintenance, and has numerous bug fixes, minor enhancements and documentation updates.
    http://smarty.php.net


  2. #2
    Wanna-be Apple nut silver trophy M. Johansson's Avatar
    Join Date
    Sep 2000
    Location
    Halmstad, Sweden
    Posts
    7,400
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    yay! Smarty rocks!
    Mattias Johansson
    Short, Swedish, Web Developer

    Buttons and Dog Tags with your custom design:
    FatStatement.com

  3. #3
    SitePoint Wizard silver trophy redemption's Avatar
    Join Date
    Sep 2001
    Location
    Singapore
    Posts
    5,269
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    my favorite PHP template engine

    and at the risk of shameless self-promotion, there's a Smarty article in my sig that could just get you convinced about using Smarty
    Last edited by redemption; Jul 14, 2002 at 00:27.

  4. #4
    SitePoint Addict whofarted's Avatar
    Join Date
    Aug 2001
    Location
    lost, If you find me please return me to St.Louis
    Posts
    396
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks for the info, I updated.

    Do any of you know of a good forum for help with smarty templates? & using templates period?

    TIA
    You smell something?

  5. #5
    SitePoint Wizard
    Join Date
    Apr 2002
    Location
    Brisbane QLD Australia
    Posts
    1,489
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Redemption: hey nice article!!!!

  6. #6
    SitePoint Evangelist
    Join Date
    Oct 2001
    Posts
    592
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I read the article.

    Still not convinced.

    But then, I don't see the need for ANY template engine. PHP already is one.

    (If someone wants my complete rant on this one, just let me know! )

    Vincent

  7. #7
    Mlle. Ledoyen silver trophy seanf's Avatar
    Join Date
    Jan 2001
    Location
    UK
    Posts
    7,168
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Go ahead Vincent!

    Sean
    Harry Potter

    -- You lived inside my world so softly
    -- Protected only by the kindness of your nature

  8. #8
    Wanna-be Apple nut silver trophy M. Johansson's Avatar
    Join Date
    Sep 2000
    Location
    Halmstad, Sweden
    Posts
    7,400
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Originally posted by voostind
    But then, I don't see the need for ANY template engine. PHP already is one.

    (If someone wants my complete rant on this one, just let me know! )
    I would DEFINETLY be interested in this one! Please rant!
    Mattias Johansson
    Short, Swedish, Web Developer

    Buttons and Dog Tags with your custom design:
    FatStatement.com

  9. #9
    SitePoint Wizard johnn's Avatar
    Join Date
    Mar 2001
    Location
    Southern California, USA
    Posts
    1,181
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    yeh, rant

  10. #10
    SitePoint Wizard silver trophy redemption's Avatar
    Join Date
    Sep 2001
    Location
    Singapore
    Posts
    5,269
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    rant! rant! rant!

  11. #11
    SitePoint Wizard gold trophysilver trophy
    Join Date
    Nov 2000
    Location
    Switzerland
    Posts
    2,479
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Vincent's rants are awesome! Rant away. It's going to be a tough one though - how do you cooperate on a site with a designer who only knows HTML, without using templates (or building a custom design interface)?

    Also - why do none of the PHP template systems (that I'm aware of) use XML for marking up the "dynamic" parts of a template? Browsers ignore tags they don't recognise so for a designer, they could view a page without even seeing the XML or needing to interfere with it.

  12. #12
    Wanna-be Apple nut silver trophy M. Johansson's Avatar
    Join Date
    Sep 2000
    Location
    Halmstad, Sweden
    Posts
    7,400
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Originally posted by HarryF
    Also - why do none of the PHP template systems (that I'm aware of) use XML for marking up the "dynamic" parts of a template? Browsers ignore tags they don't recognise so for a designer, they could view a page without even seeing the XML or needing to interfere with it.
    ASP.NET's built-in templating does this in a very cool manner. Check out Kevin Yanks article on ASP.NET Form Processing Basics.
    Mattias Johansson
    Short, Swedish, Web Developer

    Buttons and Dog Tags with your custom design:
    FatStatement.com

  13. #13
    SitePoint Wizard silver trophy someonewhois's Avatar
    Join Date
    Jan 2002
    Location
    Canada
    Posts
    6,364
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Good Article.

    I was about to switch, and reading that, I am for sure.

    FastTemplate was slow...

    Smarty, here I come!

  14. #14
    SitePoint Wizard silver trophy redemption's Avatar
    Join Date
    Sep 2001
    Location
    Singapore
    Posts
    5,269
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally posted by someonewhois
    Good Article.

    I was about to switch, and reading that, I am for sure.

    FastTemplate was slow...

    Smarty, here I come!
    thanks someonewhois and billiousness

    at least my article did convert one person to using Smarty

    <edit> ok judging from your posts (someonewhois), maybe not </edit>
    Last edited by redemption; Jul 15, 2002 at 18:44.

  15. #15
    SitePoint Evangelist
    Join Date
    Oct 2001
    Posts
    592
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    A rant, by request...

    My apologies for posting this rant at so late a time, but I had to get in the right state of mind first, and I didn't want to let you down by posting a useless little rant. Also, it seems like I have a reputation to uphold...

    I seriously believe that template engines like Smarty are a complete waste of our precious time. Luckily these packages are generally freely available, or they would be a complete waste of money as well. They do not add any features to PHP not already there, and by using them, dynamic web sites become more complex, a lot slower, and harder to maintain. That's right! Harder, not easier.

    Making these bold statements is plain silly without explaining them, so that is what I will do in the remainder of this rant. As this is a genuine rant, I may unpurposefully hurt the feelings of some well-respected people (at least by me they are ), and I may not always appear to be the nice guy I actually am...

    What does a template engine enable us to do? It allows us to separate content from business logic by supplying it with a template file. The template file is a normal HTML file, with special symbols (variables) in it instead of traditional content, and with special control structures (or: blocks) to influence the presentation logic.

    Here's an example of using a template file with Smarty:

    PHP Code:
    // Business code (index.php)
    require_once('Smarty.class.php');
    $smarty = new Smarty();
    $smarty->assign('title''Template Engine Test');
    $smarty->display('index.tpl');

    // Presentation (index.tpl)
    <html>
      <
    head>
        <
    title>{title}</title>
      </
    head>
      <
    body>
        <
    h1>{title}</h1>
      </
    body>
    </
    html
    The following code, which is completely equivalent, runs much faster, is much clearer, and doesn't use a third-party template engine at all:

    PHP Code:
    // Business code (index.php)
    $title = 'Template Engine Test');
    include('index.tpl');

    // Presentation (index.tpl)
    <html>
      <head>
        <title><?= $title ?></title>
      </head>
      <body>
        <h1><?= $title ?></h1>
      </body>
    </html>
    A lot of you will probably say: "Yeah, right! This may work for simple examples as these, but for more complicated web sites, template engines are a real asset!" That is not true. The example I gave can easily be extended to larger, complex sites. Why is this possible? Because PHP already is a template engine. Examine all template engines you can think of, and compare their features with those of PHP. PHP has them all. And more.

    So why do people think we need a template engine? The answer to that question is very simple: PHP has become too complex. Back in the old days, when PHP4 was just PHP/FI, the language was nothing more than a simple template engine. It had variables and blocks, and that was about it. Now, after a couple of years, PHP has been added to (but nothing was removed!) - it now has classes - and a large function library was written. And the latter is where the problem lies.

    Pick any book on PHP from a shelf in your local bookstore, and look how result rows from a MySQL database are printed. (MySQL is of course the DBMS used in those books, which should already give you a clue about how bad the book is.) The mysql_-functions are used all over the place in the presentation layer.

    Here, in these forums, we have learned people to not use those mysql_-functions directly, but use a database abstraction layer instead. This makes coding simpler (no need to know all those functions for the various DBMS's) and when they decide to use another DBMS instead of MySQL (and they undoubtedly will at some point), the conversion will be painless. What is the result of those lessons? People no longer use those functions directly, so that's good. On the other hand, they still place their business logic all over the presentation code. That's not so good. Most people don't know what to do about it, untill they learn about those yukky template engines. No need to carry on here...

    At this point I also like to point out that saying "The layout must be strictly separated from the content" is a moot point. What is the layout? That's the colors, the fonts, the styles and so on. The plain HTML itself is the content. A couple of years ago cascading style sheets were introduced, and using these makes it possible to cleanly separate content from layout. I can change 99% of the layout of any of my sites by just changing the style sheet; there is no need to dive into the HTML. Only if the site needs a major overhaul the HTML must be changed. If your web designer tells you this isn't true, fire him.

    Another answer to the question "Why do people think we need a separate template engine?" is the following: the biggest part of the PHP community (and the ASP community, for that matter) knows nothing about software architecture. Most of the PHP programmers don't know what an O(n^2) algorithm is, or who Donald Knuth is, or why a sorting algorithm can never be faster than O(n log n), or how Dijkstra's shortest path algorithm works. If they don't know the answers to these basic questions, how can we expect them to know how the design a software program? I'm not saying the majority of the community consists of a bunch of idiots, because that certainly isn't true. There are lots of bright, intelligent people out there, but they just don't know how to write software, because that isn't in their field of expertise. And can we blame them? Of course not. People who use PHP aren't software developers to begin with.

    I have been programming now for about 13 years (I started when I was 12), and am currently graduating in University. In a couple of months, I will hopefully have a Masters Degree in Computer Science. This isn't meant to boast; it is meant to put things in perspective: I think I have the right to say that I know a little of what I'm talking about. I have been studying software architecture for many years know, and I still find it very hard. Programming is easy, yes. But developing software is extremely difficult. Don't trust anyone who tells you otherwise. Reading these forums, or examining PHP projects (PEAR, Smarty, Javuh, ...), I often become a little depressed. The questions asked are so simple; the mistakes made so stupid... But what can I expect? PHP wasn't built and isn't used by professional software developers (something I hope to become one day). The PEAR library is a badly designed (and badly implemented) library for several reasons. I have tried pointing these out several times (I had a long discussion with the PEAR developers), but most people simply don't get them, and praise the library to heaven. I try not to say something about this too often, because I'm likely to hurt feelings and there's no point in doing that. But then there are these people starting to praise these so-called 'template engines' and all I can think of is: "Here we go again..." Then I just have to say something about it. Again, I must stress that I don't blaim any PHP programmer personally, and that I don't think they are stupid. They are just working outside their field of expertise, that's all. It's like asking a carpenter to paint a house. He will probably do a nice overall job, but a real painter will undoubtedly do better.

    Well, this more or less concludes my rant. From now on I will be nice again to everybody, and I won't be saying all too bad things about template engines, the PEAR library, or anything else I have a strong opinion about. Unless you want me to, of course...

    Here are some questions/remarks you may have had when reading this rant, and my answers for them.

    Q: If you use variables like '$title', as in your example, all over your code, then the business logic becomes a mess, and there is a possibility of clashes between such variables.
    A: Then don't use these (global) variables. With little effort you can set up a simple class (or other structure) that stores the values for the page you are creating, allowing you to nicely separate presentation code from the business code.

    Q: The 'better' template engines have a cache to make loading of pages much faster. Clean PHP doesn't do this, so the template engine is, in that case, faster!
    A: Incorrect. The cache in a template engine is needed to store the parsed template in some other format (Smarty uses PHP for that), which can then be instantly restored. With clean PHP the format is already correct, so there is no need to use a cache. Less and simpler lines code, faster execution.

    Q: Instead of using a template engine-specific language, our web designers - who know nothing about programming - are now required to have knowledge of PHP! We can't have that, now can we?
    A: Why not? The template engine-specific language is nothing more than a minimal programming language with an ugly syntax. It has variables, conditionals, loops, and maybe even functions. As PHP is a full programming language, it has all of these constructs, and more. But that doesn't mean you require your web designers to know all there is to know about PHP. The set of requirements doesn't change at all. Just the basics will be enough. The added benefit is that if they want to, your web designers can start experimenting with PHP (or other scripting languages) much faster.

    Q: You said maintaining a web site generated by some template engine is harder to maintain instead of easier. Why?
    A: One reason is that an additional software package is involved. At least one person must be able to work with it. More knowledge is required. Also, not only the web site and PHP must be kept up to date; the template engine itself must be maintained as well. This means more work. Another reason is that the best solution for any problem is always the simplest one. Using a large, complex template engine where PHP itself suffices is not a simple solution. In other words: more work yet again.

    Vincent
    Last edited by voostind; Jul 16, 2002 at 01:25.

  16. #16
    Wanna-be Apple nut silver trophy M. Johansson's Avatar
    Join Date
    Sep 2000
    Location
    Halmstad, Sweden
    Posts
    7,400
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Your rant messed up my hair.
    Mattias Johansson
    Short, Swedish, Web Developer

    Buttons and Dog Tags with your custom design:
    FatStatement.com

  17. #17
    Super Ninja Monkey Travis's Avatar
    Join Date
    Dec 2001
    Location
    Sioux City, Iowa
    Posts
    691
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Wow that blew me away. If you'd let me I'd like to make a section on my site called "Vincent's Rants" and put all the ones I can find.
    Travis Watkins - Hyperactive Coder
    My Blog: Realist Anew
    Projects: Alacarte - Gnome Menu Editor

  18. #18
    SitePoint Wizard gold trophysilver trophy
    Join Date
    Nov 2000
    Location
    Switzerland
    Posts
    2,479
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    If you'd let me I'd like to make a section on my site called "Vincent's Rants" and put all the ones I can find.
    Likewise! Perhaps, if Vincents willing, the rants should be turned into SP articles.

    You've mentioned using classes for content seperation before, in this (now I read this you must have been groaning as you read my first post there - no problem)

    Could you give a simple example of how you normally do that? E.g. constuct the header and footer, fill in the content depending on the "page" someone is viewing

    Also, what's your take on the Fusebox, if you've come across it.

    And finally (sorry - being very demanding), of the PHP application frameworks (plus ezPublish) out there, are there any you've used, would recommend?

  19. #19
    SitePoint Wizard silver trophy someonewhois's Avatar
    Join Date
    Jan 2002
    Location
    Canada
    Posts
    6,364
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally posted by redemption

    thanks someonewhois and billiousness

    at least my article did convert one person to using Smarty

    <edit> ok judging from your posts (someonewhois), maybe not </edit>
    Well, it was a very good artcticle, and it got me to change.. it just wasn't the right interface for me.

    It wasn't working, but you were right, it was faster... geez, what kind of name is FastTemplate, if it's dead slow?

  20. #20
    SitePoint Wizard silver trophy redemption's Avatar
    Join Date
    Sep 2001
    Location
    Singapore
    Posts
    5,269
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i'm in a little of a hurry but i thought to let vincent have a go at 2 of my counter-arguments (for now ):

    1) i develop scripts for clients -- they aren't complete idiots and as such know some HTML D)... i've had requests that they change the layout for them or that they be allowed to easily change the layout... wouldn't templates be a particularly good way to solve that problem... mind you templates are far more readable than PHP scripts... and one thing is they can show in WYSIWYG editors like Dreamweaver, perfect for a quick redesign of the layout

    2) templates can be re-used... you can have 1 template for a particular section (or even the whole site) and then re-use them for each page, just changing the variable contents... i don't see that happening easily unless you write a class for that (like Perl/CGI or Python's HTMLgen)

  21. #21
    SitePoint Evangelist
    Join Date
    Oct 2001
    Posts
    592
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    If you'd let me I'd like to make a section on my site called "Vincent's Rants" and put all the ones I can find.
    I don't really rant that much, now do I? I am flattered of course (I think that's the right emotion to express in this case...), but I wasn't aware that the majority of my posts are considered as rants from a seriously deluded guy...

    Anyway, to answer redemption on how templates can make life easier: If you read my rant carefully (although I don't know why you would do that ), you'll see that I never said templates themselves are useless; I merely said third-party template engines are useless, which is something quite different. I just don't see why it would be easier for a web designer to write '{title|ucfirst}' (Smarty) instead of '<?= ucfirst($title) ?>' (PHP). It's even true that the latter is supported better by applications used by web designers, as for example Dreamweaver supports PHP, but not Smarty. There's nothing wrong with templates. On the contrary, using them is often a good idea. But as PHP is a template engine in itself, why would you need another one?

    My own approach to developing web sites is different from the normal approach ('normal' being the one taught in the average 'PHP & MySQL' book). Instead of working my way back from a set of pages given by a web designer to a fully dynamic database-driven PHP site, I view a web site as I view any software product (surprise!). Most of you will know by now I write my software object-oriented, and the same goes for websites. A page on a site is represented by a class, which has a method 'show' that prints the page. Of course that method doesn't do all the work by itself; it calls other methods on the page object itself to show different parts of the page (the header, the menu, the footer and so on). The nice thing about this is that I can easily write a subclass that overrides parts of the original class to generate a page that looks more or less the same, but works slightly different. A subclass 'NewsPage' for example might look in some subdirectory, read all text files in it, and print their contents, ordered on the dates the files were created.

    You might argue that this kind of approach makes it harder to separate the code from the HTML, but this is only partially true. It is true that a single HTML page is broken up in separate parts: headers, footers, and so on. But this is also the case for template engines. Depending on the complexity of the site, I can use simple classes that merely echo the necessary HTML inside the classes themselves, or classes that retrieve the content from (template) files on disk, or extract it from some database, or whatever.

    To bind the different pages the site can create together, I use a different class 'Site' or 'Application'. This class knows about all pages the site can create, and the settings for these pages (like the specific class to use and the arguments that need to be passed to the class on construction). These settings can be read from a text file, extracted from a database, or restored from a cache file. Whatever is more appropriate. This design more or less implies that my sites have only page 'index.php' that can be influenced by setting the parameter 'page' to some (valid) value. It reads the 'page' parameter, gets the settings for that page, instantiates the right class, passes the settings to it, and shows it. From what I've seen of Fusebox, this is more or less what they do there, although I do it a bit simpler.

    One important thing is that I can reuse this set of classes for many sites, and not just the one I currently happen to be working on.

    There are many application frameworks out there, but I don't use one myself. I've examined a few in detail, and although some work pretty well, I haven't yet found a framework I like. The code I use in my daily work shouldn't just work well, it should look good too. In my book, good looking code is fully object-oriented, well layered code. I haven't found such a package yet, nor do I think I ever will (for reasons I have made all to clear in my rant..). All PHP code I use is code I wrote myself. That's code I understand, code I trust, and last but certainly not least, it's code that Looks Good (TM).

    Vincent

  22. #22
    SitePoint Wizard silver trophy redemption's Avatar
    Join Date
    Sep 2001
    Location
    Singapore
    Posts
    5,269
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    If you read my rant carefully (although I don't know why you would do that ), you'll see that I never said templates themselves are useless;
    oh yeah i did read your rant carefully... wouldn't do you justice not to ... i know you never said templates were useless and i never thought or implied that you said that (if you read _my_ short post carefully )...

    I merely said third-party template engines are useless, which is something quite different. I just don't see why it would be easier for a web designer to write '{title|ucfirst}' (Smarty) instead of '<?= ucfirst($title) ?>' (PHP).
    why is it easier? first of all, you're relying on the fact that short_open_tags are 'on'... i admit that may sound a little nitpicky but i do it like this '<?php echo ucfirst($title); ?>', because i can't rely on them being on at each of my clients hosts... i fancy that somewhat harder for your average web designer to understand and it also somewhat makes the code look messier... what's wrong with getting a 3rd-party template then if it simplifies the code at your average web designers end so they can concentrate on making pretty stuff ?

    It's even true that the latter is supported better by applications used by web designers, as for example Dreamweaver supports PHP, but not Smarty. There's nothing wrong with templates. On the contrary, using them is often a good idea. But as PHP is a template engine in itself, why would you need another one?
    yes Dreamweaver MX (which not all my clients would have) does support PHP but you don't get what i'm trying to say i think: when i deal with the templates, or when i pass them on to a designer, we shouldn't have to care about PHP code embedded in the code... the template is the HTML page and shouldn't depend on the business logic that will use the template... what they should ideally see is a HTML file with placeholders, and they should be able to work around these placeholders easily and do their stuff... PHP on the other hand is foreign to (most of) them, while templates are not... designers know templates and how they work, as they've been (or they should have) working with them all the time... throw PHP code at them and they may just start barfing ... that's my point

    You might argue that this kind of approach makes it harder to separate the code from the HTML, but this is only partially true. It is true that a single HTML page is broken up in separate parts: headers, footers, and so on. But this is also the case for template engines. Depending on the complexity of the site, I can use simple classes that merely echo the necessary HTML inside the classes themselves, or classes that retrieve the content from (template) files on disk, or extract it from some database, or whatever.
    i like your approach and i do the same too for myself (my own scripts) though i don't use an OO approach (mere functions)... but what you're doing is essentially a template engine too, isn't it? you're creating your own template engine on top of PHP (the 'other template engine')... it may not be 3rd-party (meaning someone else's code) but it is still an 'unnnecessary' layer on top of what already is a template engine (as you proclaim) is it not?

    That's code I understand, code I trust, and last but certainly not least, it's code that Looks Good (TM).
    amen to that ... i believe in that too... so much so that it took me awhile to get used to the idea of using other peoples' scripts, code snippets, libraries... but think about it: if you use Perl, you're using modules which are other people's code, even the Perl interpreter is other people's code... the same goes for any other programming language... code-reuse is a Good Thing too... but like you say it should be code with quality, efficiency, security and stability...

    someone with strong opinions like yours make for good discussions and a new learning experience every time Vincent

    - Joel

  23. #23
    Wanna-be Apple nut silver trophy M. Johansson's Avatar
    Join Date
    Sep 2000
    Location
    Halmstad, Sweden
    Posts
    7,400
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    You know, this is EXACTLY the reason I'm considering switching from PHP to ASP.NET. Their "templating" is soo good. Someone really should rip it off for PHP.

    Code:
    <asp:datalist id="MyList" layout="flow" showfooter=true borderwidth=0 runat=server>
    
                  <HeaderTemplate>
    
                     <table cellpadding=1 cellspacing=0 >
                        <tr>
                           <td colspan=4>
                              <b><font face="Verdana" size=3>Product Listing </font></b>
                           </td>
                        </tr>
                        <tr>
                           <td colspan=4 height=5 bgcolor="000000"></td>
                        </tr>
    
                  </HeaderTemplate>
    
                  <ItemTemplate>
                          <tr>
                              <td colspan=3 style="font-size:10pt">
                                  <b><%# DataBinder.Eval(Container.DataItem, "title_id") %></b>
                                  <span> <%# DataBinder.Eval(Container.DataItem, "title") %> </span>
                              </td>
                              <td align=right style="font-size:10pt">
                                  <b><%# DataBinder.Eval(Container.DataItem, "price", "${0}") %> </b>
                              </td>
    
                          </tr>
                  </ItemTemplate>
    
                  <SeparatorTemplate>
                          <tr>
                              <td colspan=4 height=1 bgcolor="000000"></td>
                          </tr>
                  </SeparatorTemplate>
    
                  <FooterTemplate>
                          <tr>
                              <td colspan=4 height=5 bgcolor="000000"></td>
                          </tr>
                      </table>
                  </FooterTemplate>
    
               </asp:datalist>
    Will work perfectly in a wysiwyg editor for your designer, since it's XML.

    Server controls are another thing that's very nice and clean. If you put a "runat=server" attribute in any HTML tag, you can simply change it in the script - like this:

    Code:
    <script runat="server">
    Message.InnerHtml = "This is another message";
    Message.Style["color"] = "red";
    </script>
    
    <label id="Message" runat="server">This is the default message</label>
    Output from the above code is static HTML:

    Code:
    <span style="color: red;">This is another message</span>
    It's so pretty!
    Mattias Johansson
    Short, Swedish, Web Developer

    Buttons and Dog Tags with your custom design:
    FatStatement.com

  24. #24
    SitePoint Wizard gold trophysilver trophy
    Join Date
    Nov 2000
    Location
    Switzerland
    Posts
    2,479
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Mattias - looking at that code, I don't think it solves the problem Redemption wants to solve - that designers with HTML knowhow only will build the site design. That looks to me like it's going to take a .NET coder use it.

  25. #25
    Wanna-be Apple nut silver trophy M. Johansson's Avatar
    Join Date
    Sep 2000
    Location
    Halmstad, Sweden
    Posts
    7,400
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Originally posted by HarryF
    Mattias - looking at that code, I don't think it solves the problem Redemption wants to solve - that designers with HTML knowhow only will build the site design. That looks to me like it's going to take a .NET coder use it.
    You have to be a .NET coder to understand this?

    Code:
    <asp:datalist id="MyList" layout="flow" showfooter=true borderwidth=0 runat=server>
    
                  <HeaderTemplate>
    
                     <table cellpadding=1 cellspacing=0 >
                        <tr>
                           <td colspan=4>
                              <b><font face="Verdana" size=3>Product Listing </font></b>
                           </td>
                        </tr>
                        <tr>
                           <td colspan=4 height=5 bgcolor="000000"></td>
                        </tr>
    
                  </HeaderTemplate>
    
                  <ItemTemplate>
                          <tr>
                              <td colspan=3 style="font-size:10pt">
                                  <b><%# DataBinder.Eval(Container.DataItem, "title_id") %></b>
                                  <span> <%# DataBinder.Eval(Container.DataItem, "title") %> </span>
                              </td>
                              <td align=right style="font-size:10pt">
                                  <b><%# DataBinder.Eval(Container.DataItem, "price", "${0}") %> </b>
                              </td>
    
                          </tr>
                  </ItemTemplate>
    
                  <SeparatorTemplate>
                          <tr>
                              <td colspan=4 height=1 bgcolor="000000"></td>
                          </tr>
                  </SeparatorTemplate>
    
                  <FooterTemplate>
                          <tr>
                              <td colspan=4 height=5 bgcolor="000000"></td>
                          </tr>
                      </table>
                  </FooterTemplate>
    
               </asp:datalist>
    Mattias Johansson
    Short, Swedish, Web Developer

    Buttons and Dog Tags with your custom design:
    FatStatement.com


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
  •