User login

Drupal Development

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.

Ask Agaric: Where does Drupal store module dependency information?

"I can't see how drupal is storing the dependents. They are not in the system table info column."

Drupal doesn't store dependents, it gets them from the .info file each time:

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

Printing an arbitrary menu just like primary_links and secondary_links

You can find out your menu name by going to admin/build/menu and hovering over it-- the name is a text string, separating the words in the menu title with dashes, and all lower case.

In your template.php

<?php
function agarictheme_preprocess_page(&$vars) {
  $menu = menu_navigation_links("menu-name-here");
  $vars['special_menu_name'] = theme('links', $menu);
}
?>

In page.tpl.php (or page-front.tpl.php or other variation)

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

Syndicate content