Archive for the ‘web design’ Category.

Holy Hannah, what are these authors thinking?

(Yes, I'm rewatching SG-1 lately. Hush.)

I'm checking out the websites of the authors attending COSine this weekend, so I have some idea of who they are, what they write, and how much they need my help, and wow, seriously. 1995-era GeoCities just called and wants its websites back. Yikes!

I mock because I love, but seriously, folks: the whole point of an author's site is to get readers to read what you've written, so give them that information. Most readers don't care about your cat, your past lives, or your obsession with Cheez-Its; we're visiting your site because we read something by you that we enjoyed and now we just want to read more of your stories.

More on this topic later. (I'm working on a presentation about it right now, as a matter of fact.)

 

I'm not just saying that: I really do love helping authors reach out to readers, and I hate seeing it done badly. It causes me physical pain every time I visit an author's site that looks like it was thrown together by the neighbor's kid or That Guy you know from work who knows web design. *rolls eyes* You get what you pay for, folks!

Another simple but useful Django trick

Say you need the full URL of the current page you're displaying that you need to use on the template of that page, for example, to add links to Facebook, Delicious, etc., and you don't want to have additional JavaScript that you didn't write on your pages. (Why yes, I'm a control freak, shush. :P) Also say that you don't want to use the sites framework to hack it together. The permalink decorator won't work, either, because that just gives you the relative link.

Thankfully, there's a new request object that's been added to 1.0 that will do it.

To use it, include the bolded bit in your views.py file, as part of each view where you want to have the variable available:

return render_to_response('dir/template.html', {'object': obj, 'link': request.build_absolute_uri()}, RequestContext(request))

Then you can use the link variable on the template where you need the URL:

<a href="http://www.facebook.com/sharer.php?u={{ link|urlencode }}&t={{ title|urlencode }}">

I have yet to figure out how to get it to work with generic views, so feel free to holler if you know how. *vbg*

Django snippet — Template tag: split list to n sublists

This is the code for a Django template tag I adapted (also posted here). It was based on this snippet, adapted to split a list into n number of sublists, e.g. split a list of results into three evenly-divided sublists to enable display of the results in three columns on one page with CSS.
Continue reading 'Django snippet — Template tag: split list to n sublists' »

Arrrrrrrrrrrgh.

I like CodeIgniter so far (I've been fiddling with it on and off for a bit), but I've run into an issue that is driving me insane, so if anyone sees a typo that's causing the issue, I'd appreciate it if you'd let me know. *g*

I posted about the issue on the CI forums this afternoon, so all the relevant code's over there.

The gist of the problem is this: I'm using the same form for both adding a record and editing it. The model, view and controller work fine for the form when adding a new record cheap viagra. They also work fine when I submit the edited information. However, where it doesn't work is when I initially load the record to be edited by grabbing the data from the database and then filling the fields on form. Text and textarea inputs get filled in just fine, but radio and checkboxes do not get checked to match their stored values. *sigh*

Any ideas out there?