Welcome to DU! The truly grassroots left-of-center political community where regular people, not algorithms, drive the discussions and set the standards. Join the community: Create a free account Support DU (and get rid of ads!): Become a Star Member Latest Breaking News Editorials & Other Articles General Discussion The DU Lounge All Forums Issue Forums Culture Forums Alliance Forums Region Forums Support Forums Help & Search
 

Phillip McCleod

(1,837 posts)
13. yeh be careful that sounds dangerous..
Fri Apr 5, 2013, 06:31 AM
Apr 2013

..your head's liable to asplode.

in that example {{ item }} is a string object of some sort, and 'itemlist' is a list of strings. one might throw that snippet in a template file like 'list.html', then have a view or many views that render to it by passing 'itemlist' in (or to other template files that include it by reference).

i'd use a snippet similar that to render a menu bar, say, or a sidebar (would still need to set CSS styles and need some logic for urls, but otherwise..)

django's a little different in that while it is 'true' MVC.. the 'controller' part is fairly hidden. just map urls to views. so ya end up writing mostly in 'models.py' (corresponding to database tables), 'views.py', and 'urls.py'.. plus your template HTML files that the views render to.

MVC is definitely a different approach to web dev from the old days of static html or mangled php spagballs but for any site that relies either on a database, or on the server doing some actual computation before rendering, it's a joy. what if i wanted to let the end (web) user set parameters and generate a mandelbrot set image? the view could call some normal python script (or exec a system call or extern program) to generate the image before serving up the results.

i know it could be done in PHP with Zend framework, but why stab myself repeatedly in the face with a dull fork? doing it the old (non-MVC) way? that would be a mess. not sure where i would even begin.

the $ugliness-> strikes me every time. nt napoleon_in_rags Mar 2013 #1
It's not the php as much as it is the wordpress plugin Merlot Apr 2013 #2
actually working with wordpress api Phillip McCleod Apr 2013 #3
One of the reasons I dislike WP is the lack of good plugins Merlot Apr 2013 #4
yeh it's work.. Phillip McCleod Apr 2013 #5
"Never mess with WP again." music to my ears Merlot Apr 2013 #6
What usable language? Ruby? DaveJ Apr 2013 #7
negate? no, but mediate? definitely. Phillip McCleod Apr 2013 #8
I'm not opposed to switching frameoworks DaveJ Apr 2013 #9
yep no point switching horses midstream.. Phillip McCleod Apr 2013 #11
Does {{ item }} in that example usually contain a single variable or HTML output? DaveJ Apr 2013 #12
yeh be careful that sounds dangerous.. Phillip McCleod Apr 2013 #13
I suppose nebenaube Apr 2013 #10
haha very funny dr. jones. Phillip McCleod Apr 2013 #14
I know that I'd prefer to work in Perl over PHP. Fortinbras Armstrong Jul 2013 #17
Now that's just weird... nebenaube Jul 2013 #18
PHP arachadillo May 2013 #15
yeh there's no doubt that for all it's faults.. Phillip McCleod May 2013 #16
hrumph... nebenaube Jul 2013 #19
Latest Discussions»Retired Forums»Website, DB, & Software Developers»reviving the 'php sucks' ...»Reply #13