How To Dynamic Web Rendering?

Alexander aldem+dmars at nk7.net
Sun May 15 09:14:26 PDT 2011


On 15.05.2011 17:36, Adam D. Ruppe wrote:

> But Wordpress' code *is* an xml template, just with other crap mixed in.

  Not really "XML template". XML template, in my view, is something that is pure XML, without any code in it. In WordPress, those are mix of HTML and code, nothing more.

> One of the downsides of me writing my document in notepad is adding code examples in a pain. I didn't want to manually write <div>
> over and over again, so I just sidestepped it.

  Well, normally, code examples are not something which is displayed on (say) internet shop pages ;)

  I couldn't even remember when I had to do this last time, to be honest - so quoting is not a concern for me.

  Perhaps, you don't need it, but I do want to have an option to modify application logic on the fly, in the template or any other dynamic page, that's why I like mix of code and data - especially when the code is insignificant fraction of data.

> The D side, btw, looks like so:
> 
> auto table = cast(Table) document.getElementById("our-data");
> foreach(row; data)
>    table.appendRow(row...);

> Much easier than the PHP equivalent too - it's all clear. And all properly closed and entity encoded with zero effort.

  "all clear" to you - who is the author :) To me, this all is not so clear - as I don't know (=see) where exactly in the document all this happens.

  The whole reason to mix code with templates is to see where specific values are written, that's why to me code like:

        <div id="page-content">
            <?php output_page_content(); ?>
        </div>

  is much more clear - whatever it is - PHP, ASP, D or something else.

  You may call it ugly, bad practice, incorrect, etc - that's, probably, is true for you - but not for everyone out there. People have different preferences :) Some even like to write HTTP servers in bash or postscript, and, though this is doable -
it is not really practical to anyone who is used to something different - that's what I want to say.

/Alexander


More information about the Digitalmars-d-learn mailing list