I'm interested to know about approaches people take on the issue which I assume relatively serious coders have regarding code fragments, particularly with scripting languages like PHP rather than (what is bound to be more content-orientated) HTML.
On various sites, I have used common elements which solve problems that any large site is likely to have to tackle, e.g.
- a 'You are in:' line for navigation*
- 'Send this page to a friend'
- 'Send me an e-mail when this page is updated'
- Automatic insertion of submenus
and all sorts of other widgets - or even hefty scripts - like this which can take hours/days to write, but once written, are utterly indispensible and totally reusable.
Partly in respect of being a believer in the open source ethos, I'd be interested to know how people deal with this issue with clients and the associated copyright/'ownership' issues.
For instance, one issue is that, supposing a client asks me to write a page that has XYZ function in (e.g. e-mail to a friend). Now, this is blatantly going to be useful for lots of other stuff, but I'm not going to go away and rewrite the thing from scratch, since it's already done. I'm now subsidising one client because of the work done for another.
Now also, what then if I want to open source my code libraries?
* See post [webmasterworld.com...] for a suggestion here.