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.

Drupal Indymedia setup notes from Boston volunteer Developer

ekes' Hidden module for
hiding stories. Ekes is an Indymedia developer and involved with the
larger IMC Alternatives project. It's a pretty good module save for
one issue I'll explain in a second. Here's a quick rundown of all the
modules we're using though:

- Akismet
- Captcha
- CCK (along with calendar, date, link, imagefield, and email fields)
- Hidden
- Imagecache
- MySite (installed by not active)
- Notify
- Panels
- PathAuto
- Token
- Update Status
- Views

<

blockquote>
ekes' Hidden module for
hiding stories. Ekes is an Indymedia developer and involved with the
larger IMC Alternatives project. It's a pretty good module save for
one issue I'll explain in a second. Here's a quick rundown of all the
modules we're using though:

  • Akismet
  • Captcha
  • CCK (along with calendar, date, link, imagefield, and email fields)
  • Hidden
  • Imagecache
  • MySite (installed by not active)
  • Notify
  • Panels
  • PathAuto
  • Token
  • Update Status
  • Views

I'm trying to keep things as close to out of the box as possible so
we're not locked into a heavily customized site that we can't keep

Listing of all possible ancestor paths DEFEATED!

Rube Goldberg has nothing on me.

Here it is, in its last testing phase. It'll get the comments cleaned up, but after-the-fact advice on the way the module actually works would be greatly appreciated.

Rube Goldberg has nothing on me.

Here it is, in its last testing phase. It'll get the comments cleaned up, but after-the-fact advice on the way the module actually works would be greatly appreciated.


function cmt_get_ladders($tid) {
// each level is either done, or has the tid (or count?) of the next term to trace
// ladder[0] has levels 0, 1, 2, 3
// level 2 had an extra tid (term 1 had two parents)
// level 1 had two extra tid (had three parents)
// when we reach level 3, the term given has no parents
// return to the most recent fork, level 2
// duplicate ladder [0] to ladder [1], unset everything above level

Views Exposed Filters and Range Filters Problems and Possible Solutions

First thing Agaric does of course is upgrade modules to their most recent version (Relativity 5.x-2.1 and Views 5.x-1.6). Fun, but no effect. Same return on clearing the views cache.

Two issues that seem related:

  • A relativity (parent node) filter and it doesn't seem to work.

First problem came up in the context of Views Fusion - http://drupal.org/node/147274

From my mentors own mouth: "indeed. There are a lot of problems with filters with views 1.6"

First thing Agaric does of course is upgrade modules to their most recent version (Relativity 5.x-2.1 and Views 5.x-1.6). Fun, but no effect. Same return on clearing the views cache.

Two issues that seem related:

  • A relativity (parent node) filter and it doesn't seem to work.

First problem came up in the context of Views Fusion - http://drupal.org/node/147274

From my mentors own mouth: "indeed. There are a lot of problems with filters with views 1.6"

But it applies to any view that you try to expose but uses an add_where command that works in the view but not accessed through a filter or like method. Fago provided a patch: http://drupal.org/node/150094

Delete text between and including identifying strings

Internet answered this question for Agaric, and we'll make it easier for the next person to find the answer!

remove HTML within markers
regexp strip all between two snippets
regexp delete between two keywords
php delete between strings

There's a great, informative post – just in response to a question on a forum – on how to do it with a regular expression here:

Internet answered this question for Agaric, and we'll make it easier for the next person to find the answer!

remove HTML within markers
regexp strip all between two snippets
regexp delete between two keywords
php delete between strings

There's a great, informative post – just in response to a question on a forum – on how to do it with a regular expression here:

http://www.programmingtalk.com/showthread.php?threadid=39966

With this answer:

$string = preg_replace( &apos;/\&lt;body\&gt;.*\&lt;table/Usi&apos;, &apos;&lt;body&gt;&lt;table&apos;, $string ); 

Our modification (main difference, not re-adding the search strings) worked quite nicely to remove unwanted text hardcoded into another Drupal module, the otherwise wonderful Video module in 4.7:

Scale a square's dimensions with PHP

Or determine and apply any ratio.

Agaric needed this for a Drupal module, but this is general PHP that should work for anything.

php scaling function length height
calculate a ratio

Below, Agaric's function for scaling two dimensions maintaining their aspect ratio given a limit for one or both dimensions (or a percentage, but in retrospect it is very silly to wrap multiplication in a function).

Or determine and apply any ratio.

Agaric needed this for a Drupal module, but this is general PHP that should work for anything.

php scaling function length height
calculate a ratio

Below, Agaric's function for scaling two dimensions maintaining their aspect ratio given a limit for one or both dimensions (or a percentage, but in retrospect it is very silly to wrap multiplication in a function).


/**
* Scales two dimensions based on one or two limits or a percentage value.
*
* THIS FUNCTION TAKES VARIABLES BY REFERENCE
* It does not return anything you'll find useful.

Freelance or Small Business, what about Cooperative?

The Web Design Business Kit, by Brendon Sinclair, provides good advice, at least in the free sample chapters.

It does however, set up an absolute two-choice approach: freelancing, or owning a small business.

Not a token nod to a collective, co-operative form of organization? Equality, liberty, fraternity? And this from an Sinclair, who appears to take the view that work-or-starve is its own sort of slave labor in the introduction summary:

Find the next largest key in an array

php find the next largest key in an array
php find the next greatest key in an array

There is undoubtedly a better way, but recursion has melted my brain and search engines aren't saving me.

So this is what I did... actually, I used another approach entirely that didn't need this. But array_keys is how I would have started, then sorted it, and then had a foreach that compared my key to the keys it got as it walked through, and broken out of there with the new key the first one that was larger.

php find the next largest key in an array
php find the next greatest key in an array

There is undoubtedly a better way, but recursion has melted my brain and search engines aren't saving me.

So this is what I did... actually, I used another approach entirely that didn't need this. But array_keys is how I would have started, then sorted it, and then had a foreach that compared my key to the keys it got as it walked through, and broken out of there with the new key the first one that was larger.

    $terms_on_this_level = array_keys($parents);

I know there would have been a better way, but it's moot to me know anyway... until I search for this answer again and find my own, deeply unfulfilling, page.

Freelinking not working? Check WikiTools settings.

There's a setting in wikitools that literally says hijack freelinking . It has to be unchecked.

Dan figured this out.

Agaric Design... figuring stuff out little by little.

There's a setting in wikitools that literally says hijack freelinking . It has to be unchecked.

Dan figured this out.

Agaric Design... figuring stuff out little by little.

Form at a tab in administration section, Drupal 5

The shortcut:

In implementation of hook_menu, may_cache section...

The shortcut:

In implementation of hook_menu, may_cache section...


function cmt_menu($may_cache) {
$items = array();
if ($may_cache) {
//...
$items[] = array(
'access' => user_access('administer community managed taxonomy'),
'callback' => 'drupal_get_form',
'callback arguments' => array('cmt_settings_form'),
'description' => t('Configure Community-managed Taxonomy options that apply to all vocabularies with these settings.'),
'path' => 'admin/content/cmt/settings',
'title' => t('Settings'),

Delete from Drupal variable table where name LIKE

delete from variable where LIKE drupal

There are occasions when the usual approach:
variable_del('cmt_example_variable');
won't work.

This is not recommended as a shortcut, and in fact even here is problematic should there ever be a module called cmt_teaser_

delete from variable where LIKE drupal

There are occasions when the usual approach:
variable_del('cmt_example_variable');
won't work.

This is not recommended as a shortcut, and in fact even here is problematic should there ever be a module called cmt_teaser_

/**
* Implementation of hook_uninstall().
*/
function cmt_uninstall() {
  db_query("DELETE FROM {variable} WHERE name LIKE 'cmt_teaser_%'");
  cache_clear_all('variables', 'cache');
}

So this is bad practice, but I don't see

I'm not going to keep track of all the node types that ever were available to Community-Managed Taxonomy and might have had this variable created. I suppose I could just delete the variables for node types currently available to CMT and possibly leave a few variables, is better than the even slighter risk of deleting another modules variables?