Needs Updating

hook_luceneapi_facet()

Last modified: October 23, 2009 - 14:40

Definition

hook_luceneapi_facet($op, $module, $type = NULL)

Description

Invoked by modules that define facets for Search Lucene API modules.

Parameters

  • $module: A string containing the module handling the search.
  • $type: A string containing the type of content $module indexes, NULL if no type.

Returns

An array of facets.

hook_luceneapi_index()

Last modified: October 23, 2009 - 14:41

Definition

hook_luceneapi_index($op)

Description

Invoked by modules that manage a Lucene index.

Parameters

$op: A string containing the operation being performed.

Returns

Varies dependent on $op:

  • 'path': A string containing the filesystem path to the Lucene index. It is possible for multiple modules to manage the same index.
  • 'type': A string containing the type of content being indexed.
  • .

Creative Commons and Copyrights

Last modified: January 11, 2009 - 09:09

I tried out the excellent http://drupal.org/project/creativecommons_lite module (and a few years ago, back when 4.7.x was the rage http://drupal.org/project/creativecommons) and even filed a feature request for head links and internationalization which is fixed through this little recipe for a copyright system.

Create a Copyright Node Type

NOTE: If you are using translation/internationalization, be sure to turn on translation workflow on your Copyright node type. I translate the copyright nodes, but you can set them to language neutral (I HOPE) and it will show up in node reference fields for any lanugage. If you set it to any certain language, it will only be available for nodes of that language, so be sure to test out in your environment.

First turn on the "content copy" module (included in cck) if you haven't already. Then import the following cck node type:

$content[type] = array (
'name' => 'Copyright',
'type' => 'copyright',
'description' => '',
'title_label' => 'Copyright',
'body_label' => 'Description',
'min_word_count' => '0',
'help' => '',
'submitagain' => 0,
'node_options' =>
array (
'status' => true,
'promote' => true,
'sticky' => false,
'revision' => false,

Dublin Core and Head link tags

Last modified: March 12, 2009 - 16:52

This code might work in a template file with some tweaking.

Dependencies

No longer dependent on a 6.x only function (drupal_html_to_text), will now work in 5.x, I've been told. Tnx to luko28 for pointing out the dependecy.

If available, the following modules will be exploited:

pathauto

pathauto enabled nodes will use the path assigned by pathauto in all links created by this module. Degrades gracefully to use /node/$nid type of links.

taxonomy_vtn

taxonomy_vtn if available will cause this code to create a html head link to "index".

search

If core search is enabled then the code will create a html head link to "search".

print

If the print module is enabled the code will create html head link of type "alternate", media="paper" and with the apropriate document types for either text or x-application/pdf.

NOTE: I do not check if you have enabled the printing for the current node type, nor if pdf is installed.

taxonomy author

Transactions

Last modified: September 20, 2009 - 13:16

Drupal also supports transactions, including a transparent fallback for databases that do not support transactions. However, transactions can get quite complicated when you try and start two transactions at the same time. The behavior in that case also varies between databases.

A similar problem exists with nesting locks in C/C++. If the code has already acquired lock A and attempts to acquire lock A, the code will deadlock. If you write code that checks if it already has the lock and doesn't attempt to acquire it again, you avoid the deadlock but could release the lock prematurely.

In SQL, we have the same problem. If your code is already in a transaction, starting a new transaction has the surprising and unfortunate consequence of committing the current transaction and starting a new one.

Java solves the nesting problem with its locks by implementing support for a nesting structure similar to what we test below. Java allows you to mark functions as "synchronized," which causes the function to wait for lock acquisition before running and release the lock when no longer needed. If one synchronized function calls another in the same class, Java track the lock nesting. The outer function acquires the lock, the inner function performs no locking operations, and the outer function releases the lock when it returns.

Displaying Search form Block in a custom theme file

Last modified: January 3, 2009 - 18:42

To display a "search form block" (a drupal core block) in a custom theme file

<?php
echo (module_invoke('search', 'block', 'view', 0); 
?>

The above function will return

Array
(
    [content] =><form action="/drupal5/"  accept-charset="UTF-8" method="post" id="search-block-form">

<div><div class="container-inline"><div class="form-item" id="edit-search-block-form-keys-wrapper">
<input type="text" maxlength="128" name="search_block_form_keys" id="edit-search-block-form-keys"  size="15" value="" title="Enter the terms you wish to search for." class="form-text" />
</div>
<input type="submit" name="op" id="edit-submit" value="Search"  class="form-submit" />
<input type="hidden" name="form_token" id="edit-search-block-form-form-token" value="ac4853e8f1f0280b08a1208def60093e"  />
<input type="hidden" name="form_id" id="edit-search-block-form" value="search_block_form"  />
</div>
</div>
</form>



    [subject] => Search
)

if you want to apply custom css style to your search form block refer
http://drupal.org/node/108467

This is my first snippet will write more in future (thanks to dereline #drupal)

Syndicate content
 
 

Drupal is a registered trademark of Dries Buytaert.