User login

Science Collaboration Framework

Drupal database layer (up to the D6 era) and limit clauses: use db_query_range()

Variables passed in first, and then a start and as stop value for indexing (zero and ten, here).

<?php
$result = db_query_range(db_rewrite_sql($sql), $type, $status, 0, 10);
?>

An example from node module's search integration, node_update_index(), makes it clearer:

<?php
 $limit = (int)variable_get('search_cron_limit', 100);

  // ...

Highlight search words in Drupal autocomplete results

We've done this for SCF in the biblioreference module. Not the cleanest or most universal, but our autocomplete was messy and it's easy to make your own autocomplete function.

Here's the code and a lot of it surrounding it. The biblioreference_match_nodes function immediately below calls the biblioreference_autocomplete_highlight several times, each time before putting any HTML spans around the text, so we don't insert strong highlighting tags into our own markup.

Search from a Drupal 404 File not found page

Search from 404 page does not work
http://drupal.org/node/292565

Oh wow, it's finally been fixed!!! As of yesterday!

Commit to Drupal 6 core announced in comment #67 of the above issue thread.

No need to see if the Blocks 404 module fixes it (but the module is cool too)
http://drupal.org/project/blocks404

COINS feature in Biblio stores the site URL

Kathleen noted that the biblio_coins column was the only place in an entire site database that was storing the site URL, which is annoying when building out and adding content to a site at a URL that is not its final location.

Biblio is doing this as part of its automatic (and to my knowledge unheralded) feature of adding hidden "COINS" data to its output of bibliography entries everywhere, it seems, even the shortest listings.

How does a Drupal module show...? Biblio listing

Situation is that we want autocomplete for referenced bibliography nodes to show authors, journal title, and year as well as article (node) title.

  1. Look at the module's implementation of hook_menu().

    If what you are looking is visible on your Drupal site, it is probably at a specific path. That means it is put there by the menu system, and Drupal modules can define their own menu items by implementing hook_menu.

Getting Views as Data with Drupal 6 Views 2

Is there a standard way to get views as data? (to count the rows and such) or is it expected that this will be done in the preprocess functions, and views methods always return themed output?

Kathleen worked around this by making changes directly in the theme's views-view.tpl.php.

Alternatively,

<?php
function pdtheme_preprocess_views_view__contributions(&$variables) { //...
?>

should let you see the variables. see if $rows exist, and in theory decide how to output from there.

Agaric hereby claims the install* project namespace on Drupal.org for all modules that install and configure

So long as the best way to automate the setup of Drupal modules is in another module, we should claim a namespace for that. For modules not spaces and context, that namespace can be install* or install_*

What I most want this for right now is not for deploying a new site but for doing development work on a site. For instance, it would be fantastic to encode all of this setup in a module:

http://zzolo.org/thoughts/api-module

Close tags in a Drupal so they don't break your site

http://drupal.org/project/htmltidy

The http://drupal.org/project/htmlcorrector module made it into Drupal core. It should handle most issues involving closing tags.

Seeing what HTMLTidy gains, it should capture everything.

Current status: HTML Tidy not ready for Drupal 6.

Resolution

A fatal error without any of your code in the backtrace: check your form_alter

Fatal error: Cannot use string offset as an array in /home/ben/code/pdonline/drupal/includes/form.inc on line 976
Call Stack
# Time Memory Function Location
1 0.0019 64260 {main}( ) ../index.php:0
2 2.7990 23389320 menu_execute_active_handler( ) ../index.php:18
3 2.8490 23579028 call_user_func_array ( ) ../menu.inc:348
4 2.8490 23579192 node_add( ) ../menu.inc:0
5 2.8490 23580296 drupal_get_form( ) ../node.pages.inc:58
6 3.3649 29258140 drupal_process_form( ) ../form.inc:119

Syndicate content