drupal
Fixed Watcher Icon breaking teasers
a Mission (something one person can do once) by Agent0x45 Sat, 2008-08-09 09:56 Tags:Unraveling the mysteries of the cck (and the cck docs)
blog posted by Agent0x45 Fri, 2008-07-25 00:20Groups: Developing: Code the Future, Empowerment Drupal Dev, Programming
Tags:Unraveling some of the mysteries of the CCK api. Here are some of my notes.
I have descovered that one of the biggest problems with the cck api documentation is the lack of consistant terminology. For example, "field" can have 3 distinct meanings.
- A "field type"
- Each filed type has its own unique behavior
- The node hooks are designed to work on a single field type. Most of them pass a reference to it in the $field variable
- They are stored in the table {node_field} It has the following columns:
- name and type (name is the long one used in forms)
- global configuration (the most global level of configuration you can immagine a field having. not used an awfull lot)
- a flag named "required" which means that fields of this type can never be left blank when a form is submitted (the cck does this validation, not the field implimentation, which can do additional validation)
- a flag named "multiple" which is primarily used when selecting multiple items from a list.
- The data that are stored, displayed, and made editable are defined by the field hooks for the field type.
- In the context of a hook implimentation, this is usually just called a field.
- Each filed type has its own unique behavior
- A "field instance"
- These are properties of individual node types.
- They are stored in the table {node_field_instance}
- I haven't yet found a php variable that stores a list of them. If there is a variable that stores the type, it will probably have such a list. Otherwise, I haven't found a variable storing these.
- Each "field instance" is essentially a field that has been added to a content type.
- These are generally called "field" when you are adding them to a content type
- An "item" represents the data associated with each instance of a field instance
- It is often just a single value.
- Each node has its own items.
- If "multiple" is enabled for this node type, then there will be more than nodes can have several of these for each field instance.
- I have seen these called field in several places in the cck docs, but not very consistantly. I mostly see "item" in the source.
- Items are arrays that contain key-value pairs.
- A "value" ... I haven't seen these called anything but "fields", and I am running out of names...
- I haven't seen any consistant termanology for these, but they are what each are stored in the php variables $node->field_... variables.
- They are arrays of items.
- If multiple is not turned on for the node
type
- Then the only item will allways be in $node->field_...[0]
- and the items will be stored in the table {content_type_fieldname}
- The table stores
- the nid of the node the data is attached to
- A "vid" that is used to associate the item with a field instance
- the values defined by the field type (through its hooks)
- this table (as opposed to content_field_fieldname) guarantees uniqueness of (nid,vid) pairs
- If multiple is turned on
- The items are in an un-ordered list in $node->field_fieldname
- they are stored in the table {content_field_fieldname}
- The table stores the same info as {content_type_fieldname} would, except that (nid,vid) pairs are not unique.
- The names of the tables used to store records were different in Drupal 4 and earlier, but the contents are the same.
Also, I see the phrase "multiple fields" thrown around a lot. There is a lot of multiplicity in the cck. In many cases where a singleton is the most common case, arrays are used instead.
- Each item can contain multiple values. These essentially represent columns in the virtual table for that node type. Items are arrays of key value pairs, with the key being the name of the column and the value being the data stored there. Most fields store, display, and allow the editing of a single value, and so the php variable $node->field_fieldname[0]['value'] often contains the value.
- Prior to drupal 5, the nodes were stored differently. I see lots of code that uses $node->field_fieldname_value[0] instead of $node->field_fieldname[0]['value']
- You can have multiple field instances of the same field type attached to a single node type, or to different node types.
- Each field instance has its own name, label, and some unique configuration
- The records are stored in the same tables. There isn't a table of items for each field instance, rather for each field type.
- You can have multiple Items per field instance per node. That is what the multiple flag in the node_field table does. The affects are described above in "values
Also, there are 3 different circumstances when a field provides a list of its fields. It can return separate lists for each
- The list of fields to save to the db, and the list of values to save to the db
- When rendering the field
- When editing the field (though this case is limited by the wigit used... the editing behavior is detached from the field)
This allows for very elaborite behavior. For example, a date can be presented as a single item when editing the node, can look however you want, but can be stored in an appropriate format (separate columns for day, week, and year, for example, to allow faster sorting and searching). Localization is often handled this way by cck modules.
That pretty much summs up the stuff that I found terribly unclear in the cck docs and source (including the sources of several cck modules). Its definitely not a complete guide (or even my complete notes) but if anyone else is struggling with the cck docs, it could save them a few hours of staring at phpmyadmin or the source of random contributed modules.
- Agent0x45's blog
- Login or register to post comments
Install and test a basic Drupal installation
an Open Mission (something anyone can can do any time) by Agent0x45 Tue, 2008-07-22 17:23 Tags:
|
Hierarchial navigation
a Mission (something one person can do once) by Agent0x45 Thu, 2008-06-19 22:19 Tags:We are getting lots of huge lists that are time consuming to use, and burdensome to people who aren't familiar with the contents of the lists. A tree view would be vastly superior.
There are at least three separate tasks involved.
1. Arranging all the content into a clear hierarchy. The book is ideal for this.
The lists that need the most attention are skills and missions.
There should also be some cross linking. So that, for example, someone looking for an oop language for web development can either go to oop or to web development, and doesn't have to check both.
2. Designing a better control for selecting items from the hierarchy. A nice pretty tree view supporting multiple selection would be ideal. Drop down list with 5000 items=bad.
3. Adding functionality based on the location of an item within the tree, much like already exists for book pages. For example, there should be buttons to add sub-items, like we can for book pages, for relating items more freely, and for using the relations between items for queries. (i.e. to find people who have a skill, there should be an obvious button on the page for the skill)
Some of the most usefull buttons on the site are already like this: "I want to learn this: Add to my skills wishlist"
Make the Empowerment Location Aware
a Mission (something one person can do once) by Agent0x45 Thu, 2008-06-19 22:04 Tags:Geographical locations are central to what the empowerment does. Every node should be taggable with a physical location.
Ideally, locations should be fuzzy-able.
Learn Drupal
a Mission (something one person can do once) by techivist Thu, 2008-03-13 03:47Groups: Doing: Get Things Done, empower thyself, Empowerment Drupal Dev, PHP Programming, Webcomics Drupal Module Dev
Tags:Optimize for Search Engines
a Mission (something one person can do once) by RiZeN Sun, 2008-03-09 17:33 Tags:One of the most important things for a website is garnering more attention. Search Engine Optimization is a HUGE part of that.
http://www.crawlscore.com/blog/optimising-drupal-site-seo-part-1
Invite cancellations and reinvites
a Mission (something one person can do once) by RiZeN Sat, 2008-03-08 08:14 Tags:Begin the testing of drupal 6 and mods.
a Mission (something one person can do once) by RiZeN Wed, 2008-03-05 04:13 Tags:Create a view for unassigned missions
a Mission (something one person can do once) by RiZeN Wed, 2008-03-05 04:09 Tags:Add Module for Contact Grabber
a Mission (something one person can do once) by RiZeN Fri, 2008-02-29 21:25 Tags:The usage of a module such as this could help expand the userbase on the site.
Clicking calendar on an event
a Mission (something one person can do once) by RiZeN Thu, 2008-02-28 22:05Groups: Empowerment Drupal Dev
Tags:http://www.empowerthyself.com/event/2008/03/01
Comes up with an error message about the theme.
Gold Stars (userpoints) should be awarded every time someone votes up one of your comments or articles or comments on it
a Mission (something one person can do once) by lxpk Sun, 2008-02-24 07:54 Tags:Gold Stars (userpoints) should be awarded every time someone votes up one of your comments or articles or comments on it
Right now there's no way to vote for articles directly, only comments. Having that ability would be great for digg-style voting on things.
It would also be cool to have gold stars for every 1000 hits to an article or so. That way a popular dugg story like my Leopard Phones Home alert would earn about 30 gold stars.
Unify user notification of comments, private messages, article edits and group posts
a Mission (something one person can do once) by lxpk Tue, 2007-10-02 04:32 Tags:Right now only Private Messages and adding new buddies will result in a notification box when you login or view a page
Unify user notification of comments on posts you wrote or commented on, private messages, article edits and group posts
So everything you need notification of comes to your attention like the flickr messages box
Drupal Theming
Tags:Drupal theming can turn a boring and clunky site into a beautiful and intuitive user experience.
Drupal themeing is usually accomplished with a lot of CSS rules in a file called style.css and HTML modification of Drupal theme template files like page.tpl.php and node.tpl.php.
Firebugging Design
All the usual design skills and tools for developing CSS and HTML apply. You will find the Firebug Firefox Extension to be the most essential tool for experimenting with different CSS possiblities.
PHP Elements
You can do a lot of Drupal theme design without modifying any PHP code, but to unlock Drupal's full customization potential it is helpful to learn to write and modify PHP code in the PHPTemplate.
Links
Extreme Drupal PHPTemplate Theming
Drupal Module Development
Tags:Developing Drupal modules can take you beyond the capabilities already offered to develop develop new features and modules of your own with which to improve your projects and give back to the community.
Drupal module development requires knowledge of PHP programming and some learning of the Drupal APIs.
How To Learn Drupal Module Development
Drupal Module Development Guide
Developer documentation can be found at http://api.drupal.org and in the remainder of the Drupal developer's guide below.
- api.drupal.org documents the Drupal APIs and presents an overview of Drupal's building blocks along with handy examples.
- The Drupal developer guide provides guidelines as how to upgrade your modules (API changes) along with development tips/tutorials.
- See also Maintaining a project on drupal.org
You should also become acquainted with Drupal coding and documentation standards as well as Writing secure code.
Setup Drupal Galleries Module
a Mission (something one person can do once) by cidviscous Mon, 2007-10-01 05:38 Tags:When clicking on galleries, you get an error that says the OG Galleries have not been set up.
The module for uploading images seems to work fine, but I find the possibility of galleries to be a lot more robust. Like I always say, I'm pretty new to drupal, so if this is harder than it sounds or there's a reason for things being the way they are feel free to tell me to hold my horses of fuck off or whatever. Also, if we are not going to use galleries (at least for the time being) we might think about removing the link to the galleries feature, as it is just useless clutter at the moment.
I cannot tinker with this sort of thing directly as I do not have admin access, but there is a basic rundown of intructions at http://drupal.org/node/157715
-cid
Audio module needs fixin'
a Mission (something one person can do once) by cidviscous Sun, 2007-09-30 21:42 Tags:Not sure why, exactly, but the audio module refuses to take all the files I've tried to upload. Gives me a stock message about acceptable bitrates and file formats, but the resulting upload comes in at 0bytes.
Currently, I'm reading up on the matter (it seems we're not the only one with this error, but I haven't found a solution yet). I'll post anything I can find that might help, and this action item can serve as a reminder and we can coordinate to get it up and running.
-cid
Icons Module performance improvement
a Mission (something one person can do once) by lxpk Fri, 2007-09-28 23:44Groups: Empowerment Drupal Dev
Tags:




