Re: [WebDNA] feature suggestion - long response
This WebDNA talk-list message is from 2011
It keeps the original formatting.
numero = 106795
interpreted = N
texte = that's a great question!I'm in the middle of rewriting my e-commerce platform to be moderately =MVC (Model-View-Controller) instead of the spaghetti code that it =currently is. (I haven't solved the m part of mvc, but I will)=3D=3D=3D=3D=3D=3D=3DI'm willing to go out on a limb and say that most people using webdna do =this:(mypage.tpl)HAS_WEBDNA_TAGSsome logic codedatabase lookups, appends, whateverhtml headers(some webdna variables used here)body[include pagetop]the html of the pagewebdna searchesvarious variables usedif you're a really sloppy coder... more logic intermixed[include pagebottom]/bodymaybe some more webdna code(/mypage.tpl)=3D=3D=3D=3D=3D=3D=3Dmy new way:(mypage.tpl) (the controller)HAS_WEBDNA_TAGSinclude some function files as neededbusiness logic in webdna code.=20assign variables as will be needed in the html view(i'm trying very hard not to cheat and put searches in the html - as =part of transitioning some code to access sql databases)[include templates/mypage.html](/mypage.tpl)(mypage.html) (the view)[text]title=3Dthe page title[/text][text]sidebar=3Dwhatever is in the sidebar[/text][text]content=3D all the html that is shown in the content area of the =page[/text][include base.html](/mypage.html)+++++KEN, here's why: +++++(base.html) (the master page template)htmlheader
[showif [? title]=3DT][title][/showif][showif [? title]=3DF] =generic page title[/showif]/headersbodydiv sidebar[showif [? sidebar]=3DT][sidebar][/showif][showif [? sidebar]=3DF] =generic sidebar[/showif]/divdiv cotent[showif [? content]=3DT][content][/showif]/div/body/html(/base.html)this is basically a ginormous borrowing (as close as I have bothered to =develop) of Django's template system, their extend tag, and =content_blocks.My base template is always clean, & nicely balanced ("did i close that =div tag in footer.inc?")Hope this helps explain why i don't want to preset variables if i don't =need to.On Jun 22, 2011, at 7:16 PM, Kenneth Grome wrote:> If all you're doing is checking to see if a variable exists,=20> why not do this?:>=20> [text]abc=3D123[/text]> [text]def=3D[/text]>=20> [showif [abc]!]this stuff is shown[/showif]> [showif [def]!]this stuff is hidden[/showif]>=20> All it takes is presetting the vars at the top of the page,=20> then you don't have to screw around with [raw] or=20> [interpret] ... or some new syntax that would require WebDNA=20> to be rewritten. =20>=20> I've done this for years, it is so efficient and effective that=20> I've never needed anything else. You don't even have to=20> [url] the variable tags when you do it this way!>=20> Sincerely,> Kenneth Grome
Associated Messages, from the most recent to the oldest:
that's a great question!I'm in the middle of rewriting my e-commerce platform to be moderately =MVC (Model-View-Controller) instead of the
Spaghetti code that it =currently is. (I haven't solved the m part of mvc, but I will)=3D=3D=3D=3D=3D=3D=3DI'm willing to go out on a limb and say that most people using webdna do =this:(mypage.tpl)HAS_WEBDNA_TAGSsome logic codedatabase lookups, appends, whateverhtml headers(some webdna variables used here)body[include pagetop]the html of the pagewebdna searchesvarious variables usedif you're a really sloppy coder... more logic intermixed[include pagebottom]/bodymaybe some more webdna code(/mypage.tpl)=3D=3D=3D=3D=3D=3D=3Dmy new way:(mypage.tpl) (the controller)HAS_WEBDNA_TAGSinclude some function files as neededbusiness logic in webdna code.=20assign variables as will be needed in the html view(i'm trying very hard not to cheat and put searches in the html - as =part of transitioning some code to access sql databases)[include templates/mypage.html](/mypage.tpl)(mypage.html) (the view)
[text]title=3Dthe page title[/text]
[text]sidebar=3Dwhatever is in the sidebar[/text]
[text]content=3D all the html that is shown in the content area of the =page[/text][include base.html](/mypage.html)+++++KEN, here's why: +++++(base.html) (the master page template)htmlheader
[showif [? title]=3DT][title][/showif][showif [? title]=3DF] =generic page title[/showif]/headersbodydiv sidebar[showif [? sidebar]=3DT][sidebar][/showif][showif [? sidebar]=3DF] =generic sidebar[/showif]/divdiv cotent[showif [? content]=3DT][content][/showif]/div/body/html(/base.html)this is basically a ginormous borrowing (as close as I have bothered to =develop) of Django's template system, their extend tag, and =content_blocks.My base template is always clean, & nicely balanced ("did i close that =div tag in footer.inc?")Hope this helps explain why i don't want to preset variables if i don't =need to.On Jun 22, 2011, at 7:16 PM, Kenneth Grome wrote:> If all you're doing is checking to see if a variable exists,=20> why not do this?:>=20>
[text]abc=3D123[/text]>
[text]def=3D[/text]>=20> [showif [abc]!]this stuff is shown[/showif]> [showif [def]!]this stuff is hidden[/showif]>=20> All it takes is presetting the vars at the top of the page,=20> then you don't have to screw around with
[raw] or=20>
[interpret] ... or some new syntax that would require WebDNA=20> to be rewritten. =20>=20> I've done this for years, it is so efficient and effective that=20> I've never needed anything else. You don't even have to=20>
[url] the variable tags when you do it this way!>=20> Sincerely,> Kenneth Grome
"Brian B. Burton"
DOWNLOAD WEBDNA NOW!
Top Articles:
Talk List
The WebDNA community talk-list is the best place to get some help: several hundred extremely proficient programmers with an excellent knowledge of WebDNA and an excellent spirit will deliver all the tips and tricks you can imagine...
Related Readings:
OT: Need some feedback, please. (2003)
Template Encrypt Speed (1998)
RE: [WebDNA] Is there a good file upload script available these days? (2009)
WebCat2b13MacPlugIn - [include] (1997)
[ModDate] & [ModTime] ? (1997)
Plugin or CGI or both (1997)
Getting a domain listening on port 443 and port 80? (2003)
Setting up WebCatalog with Retail Pro data (1996)
Quick ShowIf question (1997)
webten vs. webstar (1998)
Search Result refinement help (2003)
WebCat2 - Getting to the browser's username/password data (1997)
[WebDNA] [announce] WebDNA Site and Store (2008)
$Replace with [founditems] (1997)
Problem displaying search result (1997)
[showif] and equality (1998)
[WebDNA] Styling search results [using css] (2009)
WebTrends (2002)
system crashes, event log (1997)
Database Structure? (1998)