Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re^4: Code and html separation - always or mostly doable?

by Michalis (Pilgrim)
on Jun 17, 2004 at 09:28 UTC ( [id://367568]=note: print w/replies, xml ) Need Help??


in reply to Re^3: Code and html separation - always or mostly doable?
in thread Code and html separation - always or mostly doable?

I thought I'ld let it as an exercise, but...
If I use bgcolor as integer, not boolean, I can easily do that:
<td class="color[:bgcolor:]">....</td>

So I can not only define classes color1,color2 etc, but if in the future we decide we want a 57th special case we haven't thought of before, we don't need to change any code, we just create a class57 and "feed" the bgcolor with the number 57.
As I said before, there is always a matter of good analysis in order to trully and forever seperate perl code (business logic) from presentation (I consider the loops and if/then/else cases in the final HTML pages to be presentation-specific and not business specific)
--
Michalis

Replies are listed 'Best First'.
Re^5: Code and html separation - always or mostly doable?
by saberworks (Curate) on Jun 17, 2004 at 17:01 UTC
    It's an interesting approach, and I like it better than mine, however, I still feel like it's forcing me to "mess with" display logic in the template. I have to start setting bgcolor hash entries which are nothing more than display logic in my data hash. Imagine if I wanted every third row italicized, bolded, or underlined. I'd have to do the same thing (pass it a class in my perl code). Thanks for your help and interesting solutions, I just wish there was a better way. A way in which I can pass the results say directly from fetchall_arrayref to the template and have the template worry about setting the colors.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://367568]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others goofing around in the Monastery: (9)
As of 2024-04-18 13:25 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found