Same for me. I never (very, very rarely) use HTML helpers in controllers and only use URL() in views.
I try to limit the logic I put in views but love that I have full Python if necessary. On Thursday, September 6, 2012 12:20:38 AM UTC-7, Marin Pranjić wrote: > > You should use helpers (DIV & others) inside controllers. In views, it's > better to use raw html. > Only exception is URL helper which should be always used. > > One advantage of using helpers in controllers is serverside DOM: > http://web2py.com/books/default/chapter/29/05#Server-side-DOM-and-parsing > > On Thu, Sep 6, 2012 at 7:30 AM, luckysmack <lucky...@gmail.com<javascript:> > > wrote: > >> Traditionally, for html templates, I would do something like this in a >> template.php file (i am coming from php): >> >> *<div>* >> * Hello <?= $name ?>* >> *</div>* >> >> and reading through the docs for web2py, I see the classes like DIV(), >> which i can then add id's, classes, and other attributes to, to be >> rendered. Which seems odd to me. Ive always had the mindset that I shouldnt >> mix html template and logic. minus things like for loops and such. and in >> my code, I shouldnt generate html. Mixing them, to me at least, makes it >> harder for designers to go into the templates to style things and change >> id's, classes. I also tend not to use ids/classes for structure. lately i >> have been using things like data attributes to help with structure or >> looping through things. this way if styles change and id's/classes change, >> functionality is not broken. >> >> So should I still think that way? Should I not use DIV and the other html >> helper classes in my templates? or is there a use case where I would to >> that. >> >> If there is, I am curious to see/hear about some use cases or examples of >> why I would use them in templates, or use them in controllers to generate >> html. >> >> or am I just thinking about them wrong somehow. if they should be used in >> a different way, how should I use them. >> >> Thanks. >> >> > --