This website is composed of information connected through taxonomy. It is simultaneously a proof-of-concept and a means to allow Agaric to share and store information both within the collective and the world as part of our open documentation philosophy.

User login

This website is composed of information connected through taxonomy. It is simultaneously a proof-of-concept and a means to allow Agaric to share and store information both within the collective and the world as part of our open documentation philosophy.

Block CSS ID for custom module blocks in Drupal 4.7

drupal 4.7 block id

the ID for that block -- as provided to the theme in a line like this:

<div class="block block-coamod" id="block-coamod-1">

Can be set in a custom module, replacing the delta numbers with whatever text string you want.

Set in the block info part of the hook I think and used in the switch statement deciding what to display.

drupal 4.7 block id

the ID for that block -- as provided to the theme in a line like this:

<div class="block block-coamod" id="block-coamod-1">

Can be set in a custom module, replacing the delta numbers with whatever text string you want.

Set in the block info part of the hook I think and used in the switch statement deciding what to display.

Thoughts at the close of code

Y'all might want to wait for the director's cut of this module...

Yeah, I'm going to try to make CMT really good. It already (pretty much) allows for on-the-fly hierarchical tagging, which is pretty cool. For a number of trusted volunteers, though, you could clean things up with SoC Matthias Hutterer's Taxonomy Manager.

Y'all might want to wait for the director's cut of this module...

Yeah, I'm going to try to make CMT really good. It already (pretty much) allows for on-the-fly hierarchical tagging, which is pretty cool. For a number of trusted volunteers, though, you could clean things up with SoC Matthias Hutterer's Taxonomy Manager.

Still unresolved philosophical/logical issues with the module
I3IVIIVI: you can vote on a terms association with content (node)
I3IVIIVI: you can vote on a name for the term
I3IVIIVI: you can vote on the term's placement in a hierarchy
I3IVIIVI: all independently
I3IVIIVI: So how do we make a term, when only one aspect of its term-ness comes up first?

Always check for "if ($foo = 'bar')" mistakes... red flag, needs ==

Always look for malformed equality statements, that assign rather than compare, when things are going weird. Earlier rather than later. That's the whole lesson for today.

So why is the select statement, that's supposed to prevent this mess below, not working?

SELECT content_id FROM {cmt_term_node} WHERE nid=%d AND tid=%d

Debugging looks all good:

* term Another versus Another
* SELECT content_id FROM {cmt_term_name} WHERE tid=%d AND name='%s'
* Result: Resource id #91
*

Always look for malformed equality statements, that assign rather than compare, when things are going weird. Earlier rather than later. That's the whole lesson for today.

auto_increment columns cannot have a default value

Makes sense I guess...

So this is good:
tid int(10) unsigned NOT NULL auto_increment,

Just make sure you don't have "default '0'" anywhere in there.

You don't want to see this on your site:

Makes sense I guess...

So this is good:
tid int(10) unsigned NOT NULL auto_increment,

Just make sure you don't have "default '0'" anywhere in there.

You don't want to see this on your site:

user warning: Invalid default value for 'tid' query: cmt_install CREATE TABLE joe_cmt_term_data ( tid int(10) unsigned NOT NULL DEFAULT '0' auto_increment, name varchar(255) NOT NULL DEFAULT '', weight tinyint NOT NULL DEFAULT '0' ) /*!40100 DEFAULT CHARACTER SET UTF8 */ in /Applications/MAMP/htdocs/joeaustin/includes/database.mysql.inc on line 172.

Regular expressions: great when they work!

Wow, it's great when regular expressions work (even if you're fumbling in the dark with them...)

Traversing through an angle-bracket delimited term set (term hierarchy path).

Input:

this > is > a > term > list

Code:

    $regexp = '%(?:^|>\ *)("(?>[^"]*)(?>""[^"]* )*"|(?: [^">]*))%x';
    preg_match_all($regexp, $typed_termset, $term_matches);
    $typed_terms = array_unique($term_matches[1]);

Wow, it's great when regular expressions work (even if you're fumbling in the dark with them...)

Traversing through an angle-bracket delimited term set (term hierarchy path).

Input:

this > is > a > term > list

Code:

    $regexp = '%(?:^|>\ *)("(?>[^"]*)(?>""[^"]* )*"|(?: [^">]*))%x';
    preg_match_all($regexp, $typed_termset, $term_matches);
    $typed_terms = array_unique($term_matches[1]);

Result:

Array
(
    [0] => this
    [1] => is
    [2] => a
    [3] => term
    [4] => list
)

Further review of this expression to be sure it works as intended would certainly be appreciated.

cmt_term_*_set and also cmt_term_*_update functions?

// call me crazy, but the way I constructed cmt_term_description_set makes a cmt_term_description_update (which would need a select statement to get the content_id unnecessary)... no, for endorse functions the content_id would be passed with the form and save the SQL.
// however, cmt_term_*_update functions are still unnecessary because it's easier to call cmt_vote($content_type, $content_id) from the submit function for the endorse form.
// so this is deprecated
function cmt_term_description_update($tid, $description, $uid = NULL, $value = 1) {

<

blockquote

// call me crazy, but the way I constructed cmt_term_description_set makes a cmt_term_description_update (which would need a select statement to get the content_id unnecessary)... no, for endorse functions the content_id would be passed with the form and save the SQL.
// however, cmt_term_*_update functions are still unnecessary because it's easier to call cmt_vote($content_type, $content_id) from the submit function for the endorse form.
// so this is deprecated
function cmt_term_description_update($tid, $description, $uid = NULL, $value = 1) {
$result = db_query("SELECT content_id FROM {cmt_term_description} WHERE tid = %d AND description = '%s'", $tid, $description);

db_last_insert_id: what it means and how to use it

Or: What's the right way to auto-increment sequences in Drupal?

Drupal 6, not Drupal 5

db_last_insert_id is not for getting the next available number in a sequence. Repeat, it is not for saying gee, I want to insert something into table foo, what was the last foo_id I put in? Then I'll add +1 to it. No!

Or: What's the right way to auto-increment sequences in Drupal?

Drupal 6, not Drupal 5

db_last_insert_id is not for getting the next available number in a sequence. Repeat, it is not for saying gee, I want to insert something into table foo, what was the last foo_id I put in? Then I'll add +1 to it. No!

The point of db_last_insert_id is that you let the database worry about what the next ID is. You use an auto_incremented (MySQL) or serial (PGSQL) column, and the INSERT statement inserts a number for that column for you.

ibolmo: what's better drupal or modxcms?

So asked some random person in IRC #drupal.

The druplicon needs a stock answer for that... something like "it depends whether you use Drupal for good - http://groups.drupal.org/drupal-for-good - or evil - http://groups.drupal.org/drupal-for-evil "

A few days after promising not to put self-promotional fluff in Agaric's blog...

The Drupal Association has a malformed link to Agaric's site, so we'll using the opportunity to have a special welcome page.

Agaric Design Collective is yet another web design company out to change the world...