I’ve complained off and on about the lack of user-defined fields in Movable Type. Today was finally the day I got off my high-horse and messed with some code.
Here is a method to add a new field to the MT database. The field can store whatever you like, can be queryed on and sorted by (via Brad Choate’s marvelous SQL plugin), and has its own template tag.
We're trying something new around here. Since we have so many posts, there's a lot of internal linking between posts. This linking has value because it can point you to other things you may be interested in. You see, you can only link to something in the past --…
CustomFields: Here's a plugin for Movable Type that may address some (all?) of my "open vs closed content management" ranting. CustomFields is a plugin that allows you to define custom fields that will appear on the entry editing screen and author profile screens. This allows you to store far…
Six Apart ProNet - Plugin Directory - Built for 3.2: If you're on the latest version of Movable Type, take a browse of the plugins built to take advantage of the new API hooks in that version. There's some really great stuff here: Ajaxify Ajaxify is a set of…
Well, here we are at #4,000. This puts us just 1,000 posts away from our stated goal of 5,000. Along with the 4,000 posts, we have 6,050 comments as of this writing, and that's very cool. We appreciate all the interaction everyone has with the site. Interestingly, we…
Integrating the Flash Photoblog World Map with Movable Type: I never felt this post got the credit it deserved. Finally, someone does something with it. [...] most of the credit for this goes to Deane at Gadgetopia for the instructions on adding custom fields to the Movable Type entry interface…
Well, I went ahead and upgraded to Movable Type 3.1 with the free version I got from joining the MT Professionals Network (still trying to find a catch...). Note that if you're considering a 3.1 upgrade, wait — there are errors in the upgrade scripts that Six Apart is working to…
Integrated Quicklinks Tutorial: This is a handy thing. I've always been tormented (high drama here) with the disparity between post styles. Some are long manifestos, and some are just a quick link. ...here's a brief tutorial for MoveableType on combining regular weblog entries with quicklinks (basically, entries from two…
How long before someone issues a Movable Type "distribution," and how would Six Apart react? Movable Type is so customizable, that a lot of users have custom preferences, myself included. Whenever I do a new MT install, I find myself loading the same plug-ins, building the same templates, changing the…
Jobs at Six Apart: They need a Software Engineer and an Executive Assistant. Given my MT hacking of late, I'm a shoo-in. Does it matter that I don't know Perl?
Waxy.org: Andy Baio lives here: Andy created a "mini-blog" on the right -hand side of his site for stuff which doesn't rise to the level of the "actual" blog. Boing Boing has done this too — allowed "guest" bloggers to have a space on the sidebar. This brings me back…
I find myself in a constant struggle between accepting Movable Type for what it is, and working to extend it. There are a few cases where I want to do interesting things with entries, but I don't want to hack into Ben's Perl code. I solved this problem by inserting…
Cruft-free URLs in Movable Type: Mark Pilgrim has created a great URL scheme in Movable Type for the cleanest URLs I've seen yet. Clean URLs are an anal-retentive obsession with me. I found this via a great page at Brainstorms and Raves devoted to URL beauty. Mark is using…
A Whole Lotta Features: This is a good tutorial on how to run an entire site from MT, but it runs into a problem that I've written about before. "...and you'll have to limit any site to six different types of information, but it should be clear that for a lot…
I was over at OpenSourceCMS.com today playing around with some content management systems: phpWebSite, Xoops, and PostNuke. They were all quite good, with phpWebSite being the one I enjoyed the most. But I want to articulate something I've had in the back of my mind for a while...
Outstanding Deane - Next time I need this functionality I'll give it a try.
For my next trick, I want MT to use different "edit_entry" templates for each blog, so that you can customize the editing interface -- label the fields differently, have different form elements, etc.
For instance, you could have a blog for an event calendar, and have fields for "recorrance," "start time," "end time," etc. Instead of the user having to remember want info gets hacked into what field, you could present them with a customized editor.
Why didn't I see this post earlier? I could kiss you on the lips for this one.
I've been thinking, if I could just add 2 fields, I could take the "web links" portion of blogs4God and move it entirely into MovableType.
It's official, you've been blogged: http://www.healyourchurchwebsite.com/archives/001073.shtml
I just did an install with no less than six user-defined fields: one for key/value information, and five for whatever. It seems to work perfectly.
Thanks for the great hack! It is very well described and even feaseable for a "faint of heart" as me.
An addition: If you want to use the public search module built in MovableType (I use 2.661) you just need to extend a single line in
/lib/MT/App/Search.pm
Around line 440 you'll find the subroutine sub searchhit
Just add your new field like this:
@textelements = ($entry->title, $entry->text, $entry->textmore, $entry->keywords, $entry->user1);
and you are done.
Hi,
this hack doesn't seem to work with version 3.11. Was anyone of you able to do the same thing in v3.11?
The main problem I'm having in MT v.3.* is that the template file no longer uses tables, instead it uses CSS for everything. I'm sure this is still a feasable hack but it's going to take someone a lot smarter than me to figure it out.
Ah I figured it out!
I added a post on how to add an extra field (including changing some other back-end display options and taking into account your new field in the export function) on my site (see Category MovableType) in Dutch. I'm planning on translating the post to English as well, but in the mean time:
If anyone needs any help on this in any other language then just let me know (not here, but on my own site...)!
Hi :) just used that and some other stuff i developed to build some avatar stuff on my site's comments system :))
thanks! if you want to know what i did contact me on morroida at gmail :)
You are a hero! This works excellent and very easy to do.
This hack is great, and makes MT more of an all purpose CMS. I wish it didn't prevent upgrading MT's version though.
Thanks for these instructions. I implemented them with 2.66 but soon enough it got to be a pain to upload my saved tmpl files all the time.
I think I will settle for Brad Choate's KeyValue plugin, even if it is a little less 'elegant' because I don't need to "upgrade" every upgrade. This is a personal choice but for people who would rather not bother tweaking code everytime, it is worthy of consideration.
Hi, Thanks for the tip. Unfortunately, I am looking for native support of this feature since I am running under the BerkleyDB, not MySql. But, thanks again for sharing this with me. I'll bookmark it and maybe I will switch to MySql in the near future so this will work.
Hey thanks for this - got the bank end working fine - but when i try to build the site, i get
Undefined subroutine &MT::Template::Context::hdlrentry_location called at lib/MT/Builder.pm line 159. any ideas?
line 59 is : my $out = $h->($ctx, \%args, $cond);
thanks!
Found the problem! Is was the space between sub and hdlrentry_user1 {
sub hdlrentry_user1 {
should be
subhdlrentry_user1 {
thanks!
Ok, I'm stuck now!
It's all working in the backend
I've got nice fat tags in my individual template like
But nothing appears!
Any ideas?
fixed it - stoopid typo in context.pm - sorry!
Hi, thanks for the tip! I have a question I'm hoping someone can answer. I added a new field that holds an integer, and everything worked great. So I tried adding a second field the exact same way as the first (only difference is that it holds a varchar(40) data type in the mysql db). However, whenever I reference my other tag, I get the following error:
"Building results failed: Error in tag: Error in tag: You used an 'MTEntryBoxShot' tag outside of the context of an entry; perhaps you mistakenly placed it outside of an 'MTEntries' container?"
Again, I followed the instructions exactly the same in both cases, but for some reason, the second on I added wants to be inside an tag. Any ideas?
Nevermind, I figured out my problem :)
Thanks again for such a well written tutorial, this was a life-saver for me on a project I'm working on right now.