A Look at the Tumblr Dashboard HTML (Answered)
Oh, look: answers answered me:
Output-markup cleanliness is sacrificed for source-code readability. The source for the above block, with some too-wide Boolean expressions removed for space reasons (don’t worry, they were boring):
<li id="post<?= $post->id ?>" class=" post <?= $post->type ?> <?= (/* [removed for space] */) ? 'same_user_as_last' : '' ?> <?= ($post->is_reblog) ? 'is_reblog' : '' ?> <?= (/* [removed for space] */) ? 'is_mine' : 'not_mine' ?> ">Normally I try to enforce an approximate 80-character line-length limit, but
- this is all David’s code, being front-end, and
- short length limits are impractical for HTML/view code.
Rest assured the controller and model code looks awesome.
That makes total sense. I’m not sure why I didn’t think about that to begin with. Still, is this considered good/standard PHP coding style? I would definitely think twice if I saw something like this in a Rails app. I think most Rails people would pull all that logic out into a helper:
<li id="post<%= @post.id %>" class="<%= classes_for(@post) %>">
-
taco-man-andre liked this
-
palm-jumeirah liked this
-
helloimde liked this
-
mspiky liked this
-
pozycjonowanie- liked this
-
jeu-rami liked this
-
buzzyou liked this
-
dowding liked this
-
igut reblogged this from do-nothing
-
thankstothemoon liked this
-
interglacial reblogged this from do-nothing
-
do-nothing reblogged this from dstrelau
-
takaakik reblogged this from answers
-
sunaoh liked this
-
syoichi reblogged this from answers
-
mix3 reblogged this from tsupo
-
device302 liked this
-
manamanmana reblogged this from cxx
-
tsupo reblogged this from cxx
-
cxx reblogged this from answers
-
talby liked this
-
200 reblogged this from answers and added:
We have a similar coding style in our Application. I think this case is very difficult, because I wouldn’t mix up Model...
-
azspot liked this
-
answers reblogged this from dstrelau and added:
It belongs in the view,...the Post model, because it’s rendering-related. A...
-
dstrelau reblogged this from answers and added:
Oh, look: answers answered me:...That makes total sense. I’m not sure why I didn’t think...
-
peterclark reblogged this from dstrelau
-
peterclark liked this
-
topherchris liked this
-
answers reblogged this from dstrelau and added:
wasn’t. There’s...online generator thing...— it’s compressed...
-
esquareda liked this
-
dstrelau posted this