SitePoint Sponsor

User Tag List

Page 2 of 2 FirstFirst 12
Results 26 to 49 of 49
  1. #26
    SitePoint Wizard silver trophy Jeremy W.'s Avatar
    Join Date
    Jun 2001
    Location
    Toronto, Canada
    Posts
    9,121
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Where you're wrong? Where to begin...
    Code:
    <table width="100%" cellpadding=0 cellspacing=0 > <tr> <th>Title</th> <th>Author</th> <th>Date</th> </tr> <asp:repeater id="ArticlesListing" runat="server"> <tr> <td> <%# DataBinder.Eval(Container.DataItem, "Title" ) %> </td> <td> <%# DataBinder.Eval(Container.DataItem, "Author" ) %> </td> <td> <%# DataBinder.Eval(Container.DataItem, "Date" ) %> </td> </tr> </asp:repeater> </table> 


    Ignores code-behind, and thus presentational/logical separation, nevermind business/presentational separation.

    We've also been through your generalization that .NET is just a templating engine a thousand times, disproven it a thousand times, and you continue to repeat it. You're like some PHP version of Colin Powell or something.

    Once again, you list addons for PHP which will allow you to do .NET things, while criticizing those same things.

    Getting back to your above example, simply having the Repeater control there would allow you to enumerate (in your presentational or business logic, depending on your degrees of separation) everything to be repeated.

    Perhaps an example of completely HTML, presentational, logical and business separation (nevermind modularization among all of these) is in order.

    Attached is our production level client, multi-server, website tool which we're still developing. It should give you a little taste for what's possible. We haven't implemented some of the newer features, management or degrees of separation in this released code (it's v1, we're releasing 1.2 soon).

    Feel free to pick apart, but you'll find it runs fast, takes nearly 0 server resources and beats all the competition. I'd suggest not distributing this, but feel free to use this original version for evaluation purposes.

    J
    Last edited by Jeremy W.; May 7, 2003 at 05:26.
    SVP Marketing, SoCast SRM
    Personal blog: Strategerize
    Twitter: @jeremywright

  2. #27
    Non-Member
    Join Date
    Jan 2003
    Posts
    5,748
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks for the link Captain Proton - looks interesting though a bit complicated IMO 8)

    Not quite ready for it though it's there if I want it I suppose ?

  3. #28
    SitePoint Wizard gold trophysilver trophy
    Join Date
    Nov 2000
    Location
    Switzerland
    Posts
    2,479
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Easy now J - I'm general interested in the way .NET parses it's templates.

    But first I know you get excited about this but if you read carefully, every time I mention .NET and templates, in this post or in the past, I'm very careful to say that it's ASP.NET which is the templating language. I absolutely never say that .NET itself is a templating language - .NET is a framework for executing applications which I understand perfectly.

    Please read this post carefully - what I'm saying is ASP.NET is a templating language. It's markup refers to classes and objects. We write a template HTML page and embed ASP.NET tags in it. Conceptually ASP.NET is similar to Smarty but better implemented. It has it's own syntax. Do I need to put ASP.NET in bold again to make it clear I perfectly understand the difference and have done for a long while now.

    Anyway - sorry - this wasn't about anything for or against .NET or to annoy anyone - I'm interested in understanding how the ASP.NET syntax related to underlying classes in the most abstract OOP terms.

    From what you're saying seems to make the repeater, for example, is either an interface class which my fictional ArticlesList class has to implement in some form or ArticlesList must be an instance of the Repeater class.

    The example I gave was attempting to follow the MSDN repeater example - if this violates the principle of seperation, how is it done right?

  4. #29
    SitePoint Wizard silver trophy Jeremy W.'s Avatar
    Join Date
    Jun 2001
    Location
    Toronto, Canada
    Posts
    9,121
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Fair enough, and if that's what you meant (or said), I'm sorry Feel free to ignore that bit of my post.

    If you'd like as close to "best case" as I can find, feel free to download the above applications. The documentation for installation is in there as well

    Ideally, the MSDN example would simply place the one ASP.NET control on the page, and then do all the looping/repeating in the code-behind page, to separate the HTML from all logic (except the placement). This gives designers the freedom to do what they need to do (most GUI programs will simply display it as an unknown element).

    Behind-the-scenes, you would then separate your presentational logic from your business logic. The example you gave obviously doesn't have any business logic, as it's all presentational, but you could easily bind the list through your DB abstraction layer to an area of your application to create that.

    I mean, even within presentational logic, our application separates the template, and core look and feel from the general presentational logic.

    As such, it looks a lot like this (in a very simplified fashion):

    DB -> Backend Business Logic -> Middle-Tier and Architectural Logic -> DB Abstraction -> Presentational Logic -> Template -> Actual HTML

    Each of these can be completely separated (in reality, you could install several copies of the Mail Server in a distributed environment and it would work fine, so there are even greater degrees of separation (for instance, you'd never instantiate a class directly) than I could graph, but some of the documetnation in that ZIP should help

    J
    SVP Marketing, SoCast SRM
    Personal blog: Strategerize
    Twitter: @jeremywright

  5. #30
    Talk to the /dev/null Theiggsta's Avatar
    Join Date
    Mar 2001
    Location
    Tampa, FL
    Posts
    376
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Still the advocate of MVC and XML/XSLT, when you have a project written in ASPX templates and you need to do a code change on the fly, you end up with a problem. When you deal with XML data bourne off of a class data container, you have no worries about code changes, which means everything is truely separate. The XSLT does the dirty work of making the data which is already processed pretty any way you like it. Perhaps a PDF... or a WML page for the browser or if you fancy "shadowing"(the very bad practice of fooling spiders with extra keyword content specialized just for them) you can do that if you detect the browser could be a spider.

    I will look into serialization classes where you can shove your finished data into a class, then drop the object into XML format. I don't think PHP is advanced enough for something like that though, guess it might be back to the drawing board for me.
    Aaron "Theiggsta" Kalin
    Pixel Martini
    Ruby and Rails Developer

  6. #31
    SitePoint Wizard silver trophy Jeremy W.'s Avatar
    Join Date
    Jun 2001
    Location
    Toronto, Canada
    Posts
    9,121
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Actually, we do change our template on the fly, without recompiling...

    J
    SVP Marketing, SoCast SRM
    Personal blog: Strategerize
    Twitter: @jeremywright

  7. #32
    SitePoint Addict
    Join Date
    Mar 2003
    Location
    Germany
    Posts
    216
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Harry, interesting post, as usual. But where you say that CSS is a 3rd generation templating aproach or something, your completely losing me. CSS is just for formatting things, how has this anything to do with the template / separation of logic discussion?

    Code:
    <div id="articleRow">
    Code:
     <div id="articleRowTitle">Build your own database driven...</div> 
     <div id="articleRowAuthor">Kevin Yank</div> 
     <div id="articleRowDate">12th February 2001</div> 
    </div> 
    <div id="articleRow"> 
     <div id="articleRowTitle">Another article</div> 
     <div id="articleRowAuthor">Someone</div> 
     <div id="articleRowDate">13th June 2002</div> 
    </div> 
    Erm, this whole "div" stuff is nothing esoteric, it's a reality. Everybody can use it to layout his pages. It should be noted that it is not allowed to use "ids" more than once. Instead you would use "class". So, even today you can do something like this:
    <tr class="articleRow">. I'm doing that everyday, and it works. Besides, if you meant to put these elements into columns, you probably wouldn't use divs, because they're block level elements and as such usually take up at leat one row, unless you specify otherwise. For tabular data it still makes sense to use tables, by the way.

    But still i don't really see what this has to do with your first two examples. As there's no presentational logic in there at all, I think basically your 3rd example means that we preapare our pages fully, e.g. with widgets, and output them. Then we won't need a template system at all. Fine. But CSS has nothing to do with this, as far as I can see... It makes no difference if you use CSS here or not, the basic approach would be the same. It's just that with CSS the output would be nicely formatted.

    Please correct me if I'm wrong, but I really couldn't leave this uncommented.
    Last edited by mkrz; May 6, 2003 at 17:09.

  8. #33
    SitePoint Enthusiast Remy's Avatar
    Join Date
    Oct 2002
    Location
    Amsterdam
    Posts
    47
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Harry,

    if you say that 3rd generation templating aproach is CSS (with HTML(-divs)) isn't that the same as XSL (with XML)?

    So why don't create XML instead of HTML, with the same structure as you are using HTML for (<div id="articleRowTitle"> ) and XSL (as in the advanced version of CSS) to change the layout.

    I'm not a advocate of XML and XSL, I use XHTML and CSS and your 3rd generation templating aproach for tables, but just wanted to bring this up [img]images/smilies/wink.gif[/img]
    Last edited by Remy; May 7, 2003 at 05:56.

  9. #34
    Super Ninja Monkey Travis's Avatar
    Join Date
    Dec 2001
    Location
    Sioux City, Iowa
    Posts
    691
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Using XML data and XSL to format it would be nice, but what browsers actually support it? I think only IE5.5+ and Gecko based browsers.
    Travis Watkins - Hyperactive Coder
    My Blog: Realist Anew
    Projects: Alacarte - Gnome Menu Editor

  10. #35
    SitePoint Wizard gold trophysilver trophy
    Join Date
    Nov 2000
    Location
    Switzerland
    Posts
    2,479
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    But still i don't really see what this has to do with your first two examples. As there's no presentational logic in there at all, I think basically your 3rd example means that we preapare our pages fully, e.g. with widgets, and output them. Then we won't need a template system at all. Fine. But CSS has nothing to do with this, as far as I can see... It makes no difference if you use CSS here or not, the basic approach would be the same. It's just that with CSS the output would be nicely formatted.
    The problem with all discussions of templates is there are really two issues being discussed;

    1 - Seperation or presentation logic from application logic
    2 - How to make life easy for designers (or how to make it possible for developers and designers to work together).

    I should have emphasized this more strongly and been more careful but the "three generations" I was talking about were primarily from the perspective of solving the second problem - how to make life easy for developers. I got sidetracked by ASP.NET and eZ publish along the way though.

    Quote Originally Posted by HarryF
    Personally like the article - makes the point about seperation of presentation logic from application logic well which is, IMO, a different problem to providing a "designer friendly" mechanism for customizing the look and feel of a site.
    The presentation logic is usually not completely the realm of a designer to deal; in fact think it's mainly the job of the developer to decide what happens there. The problem is there isn't a clear divide between who does what and what each should be expected to know.
    I think there are effectively three generations of approach solving this;
    CSS (should) have nothing to do with seperation of presentation logic from application logic - it's purely a mechanism for controlling look and feel which is ideal for designers.

    Having said that, when you starting combining CSS with JavaScript or if you consider CSS markup like;

    Code:
    div.hidden {
      display: none;
    }
    We're back to designers controlling presentation logic again, which blurs the division of labor between them and the developer again.

    Erm, this whole "div" stuff is nothing esoteric, it's a reality.
    I know but to to do everything with CSS - i.e. all layout, position etc. without any reliance on HTML's in build features isn't quite there yet - in fact the guilty browser is Internet Explorer. But you're right - we're almost there.

    As to XSL; well yes and no - consider this - as a developer building a web app, instead of providing discrete "views" as XML you could (at least with a fairly simple content management system) dump one giant XML document containing all the content available on your site and leave it to XSL to break up into "views" - that means XSL blurs the boundary between designer and developer again. Also I think XSL is a tough technology to work with, if you're doing anything more than basic transformations.

    Having said that though, CSS isn't an XML based standard, in the same way as DTDs.

  11. #36
    SitePoint Wizard gold trophysilver trophy
    Join Date
    Nov 2000
    Location
    Switzerland
    Posts
    2,479
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    PS;

    Using XML data and XSL to format it would be nice, but what browsers actually support it? I think only IE5.5+ and Gecko based browsers.
    I can't remember the project but someone told me once they'd done a PHP XSL parser which first checks to see if the browser has native XSL support and if so, simply dumps the XSL doc and XML on the browser to deal with - if not it uses Sablotron to perform the transformation. If I remember right the project is (somewhere) on Sourceforge

  12. #37
    SitePoint Wizard gold trophysilver trophy
    Join Date
    Nov 2000
    Location
    Switzerland
    Posts
    2,479
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks to Skunk (aka Simon Wilson) here came across a great example of how CSS can be used to solve the developer / designer divide: http://www.mezzoblue.com/zengarden/

    If you look at the source of the page, it remains the same. Clicking on one of the design links alters only the stylesheet used and the output looks completely different.

    Basically a developer simply needs to output a page in which every element is well enough described (e.g. with an id or class attribute) for the designer to be able to control it's position, look and feel with CSS. Notice how on some pages the menu is on the right hand side and on others the left?

    Basically designers can now be removed from the decision making process of how the presentation logic works.

  13. #38
    Talk to the /dev/null Theiggsta's Avatar
    Join Date
    Mar 2001
    Location
    Tampa, FL
    Posts
    376
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Harry thats quite an interesting concept... how compatable is this with browsers? Some of the CSS shows up funny in Gecko/XUL-based browsers but of course shows up perfectly in MSIE.
    Aaron "Theiggsta" Kalin
    Pixel Martini
    Ruby and Rails Developer

  14. #39
    SitePoint Wizard silver trophy Jeremy W.'s Avatar
    Join Date
    Jun 2001
    Location
    Toronto, Canada
    Posts
    9,121
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    In terms of technology, it's quite easy, and many sites do it (learn how at www.alistapart.com, they have several articles on the subject).

    That said, CSS transformations have their pluses and minuses as well, and I think rank up there with "one of the options", as opposed to the epitome (the way it sounded like Harry was proposing this, at least to me)... Perhaps he's proposing something which doesn't exist yet?

    J
    SVP Marketing, SoCast SRM
    Personal blog: Strategerize
    Twitter: @jeremywright

  15. #40
    SitePoint Addict
    Join Date
    Mar 2003
    Location
    Germany
    Posts
    216
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yes, CSS Positioning can be a real headache, and sometimes you have to sacrifice some ideas in order to achieve best browser compatibility, but once you've fixed all that, things couldn't be easier. You get really clean and maintainable HTML code. For instance, recently I did the CSS based implementation of the new design for www.eocene.net. The menu looks and behaves like "buttons", but in the HTML all you have is a list with links. Everything else is done via CSS. But you still have to be aware of many browser bugs. Like that site, it will look wrong in MS IE 5.5, because that stupid browser gets all height and width specifications wrong. There is a workaround for that (as usual), but I haven't implemented that yet.

    And yes, I would also highly recommend www.alistapart.com on this subject, I have learned incredibly much about modern (CSS-based) web design there.

  16. #41
    midnight coder
    Join Date
    Dec 2000
    Location
    The flat edge of the world
    Posts
    838
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    HarryF, you 3rd CSS example is nice use of CSS, but doesn't really exaplain anything.

    The problem we have here is, we have data in a database, how do we show that data in a HTML page.

    In the first two example, they've done it by using a loop, then a line like:

    <%# DataBinder.Eval(Container.DataItem, "Title" ) %>

    or

    {$article:ArticleItem:item.title}

    This allows the HTML page to contain the title of all the books. No problem there.

    However in your third example, you simply typed the book titles in yourself. How did you get the words like "Build your own database driven..." and "Some article" to appear in that HTML page?

    You mentioned that "he template engine can now be thrown out of the window - this can be done with pure PHP."

    So, do you mean something like

    PHP Code:
    <table>
    <?php for (//some sort of loop) { ?>
     <tr id="articleRow">  <td id="articleRowTitle"><?php echo $title ?></td> </tr>
    <php } ?>
    </table>
    If that's the case...what does CSS have to do with anything?

    CSS is a nice way to display the page as oppose to font tags, and should be encourage. But in your example, it doesn't show how CSS helps to show the data from a database to a HTML page.
    Work smarter, not harder. -Scrooge McDuck

  17. #42
    SitePoint Wizard silver trophy Jeremy W.'s Avatar
    Join Date
    Jun 2001
    Location
    Toronto, Canada
    Posts
    9,121
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Hey Robo,

    Actually, as I was trynig to tell Harry, an actual real-world .NET example would have no loop at all. It would simply bind the result set to the output id area, and .NET would handle looping, paging, etc (depending on component used).

    Just thought I'd clear that up

    J
    SVP Marketing, SoCast SRM
    Personal blog: Strategerize
    Twitter: @jeremywright

  18. #43
    midnight coder
    Join Date
    Dec 2000
    Location
    The flat edge of the world
    Posts
    838
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Can you post some sample code in C# on how you do the bindng in .NET?
    Work smarter, not harder. -Scrooge McDuck

  19. #44
    SitePoint Wizard gold trophysilver trophy
    Join Date
    Nov 2000
    Location
    Switzerland
    Posts
    2,479
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    That said, CSS transformations have their pluses and minuses as well, and I think rank up there with "one of the options", as opposed to the epitome (the way it sounded like Harry was proposing this, at least to me)... Perhaps he's proposing something which doesn't exist yet?
    It's true CSS is another choice and I'm not proposing it some perfect solution today, by any means. But CSS shows how's things can be done. Once browsers catch up reckon it's likely to become the default technology for designers.

    Robo - you'll have to see what I was saying here - my fault for not keeping it clear but I was focusing on what various technologies have to offer designers rather than application / presentation logic issues.

  20. #45
    SitePoint Wizard silver trophy Jeremy W.'s Avatar
    Join Date
    Jun 2001
    Location
    Toronto, Canada
    Posts
    9,121
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Robo:

    Sure, I'll get the guys to post a sample drop-down menu or something using code-behinds

    J
    SVP Marketing, SoCast SRM
    Personal blog: Strategerize
    Twitter: @jeremywright

  21. #46
    SitePoint Wizard silver trophy Jeremy W.'s Avatar
    Join Date
    Jun 2001
    Location
    Toronto, Canada
    Posts
    9,121
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Aright, example time

    The main ASPX page looks something like this (I've actually stripped out the useless code that VS.NET puts in for maintenance purposes):

    Code:
    <%@ Page language="c#" Codebehind="WebForm1.aspx.cs" AutoEventWireup="false" Inherits="WebApplication1.WebForm1" %>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
    <HTML>
     <HEAD>
      <title>WebForm1</title>
      </HEAD>
     <body>
      <form id="Form1" method="post" runat="server">
       <asp:DropDownList id=DropDownList1 style="Z-INDEX: 101; LEFT: 40px; POSITION: absolute; TOP: 32px" runat="server" Width="216px">
       </asp:DropDownList>
      </form>
     </body>
    </HTML>
    And the CodeBehind file:

    Code:
    using System;
    using System.Collections;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Web;
    using System.Web.SessionState;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using System.Web.UI.HtmlControls;
    namespace WebApplication1
    {
     /// <summary>
     /// Summary description for WebForm1.
     /// </summary>
     public class WebForm1 : System.Web.UI.Page
     {
      protected System.Web.UI.WebControls.DropDownList DropDownList1;
      protected System.Data.SqlClient.SqlCommand sqlSelectCommand1;
      protected System.Data.SqlClient.SqlCommand sqlInsertCommand1;
      protected System.Data.SqlClient.SqlCommand sqlUpdateCommand1;
      protected System.Data.SqlClient.SqlCommand sqlDeleteCommand1;
      protected System.Data.SqlClient.SqlConnection sqlConnection1;
      protected System.Data.SqlClient.SqlDataAdapter sqlDataAdapter1;
      protected WebApplication1.DataSet1 dataSet11;
     
      private void Page_Load(object sender, System.EventArgs e)
      {
       // Put user code to initialize the page here
       sqlDataAdapter1.Fill(dataSet11 , "table1");
       DropDownList1.DataBind();
      }
     }
    }
    In this example, the List isn't actually filled, but that's just a .Fill(), so no biggie. I've also removed the Form Designer code.

    Define the area on the .aspx page (DW, Frontpage, VS.NET and Web Matrix will all see a drop down list). Designer does what he wants with the actual HTML. Presentational logic is done in the code-behind.

    J
    SVP Marketing, SoCast SRM
    Personal blog: Strategerize
    Twitter: @jeremywright

  22. #47
    Non-Member
    Join Date
    Jan 2003
    Posts
    5,748
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Way off topic but that hellometer is well smart

    I went straight to hell...

  23. #48
    Talk to the /dev/null Theiggsta's Avatar
    Join Date
    Mar 2001
    Location
    Tampa, FL
    Posts
    376
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I could almost swear that code looks like a strange cross between Java and Perl. Microsoft likes to take the best of both worlds, eh? its about time. Now if it only ran on linux...

    Note: Don't say Chilisoft ASP... its a very very bad system
    Aaron "Theiggsta" Kalin
    Pixel Martini
    Ruby and Rails Developer

  24. #49
    Wanna-be Apple nut silver trophy M. Johansson's Avatar
    Join Date
    Sep 2000
    Location
    Halmstad, Sweden
    Posts
    7,400
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Theiggsta
    Now if it only ran on linux...
    http://www.go-mono.com/
    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
  •