Drupal: .htaccess Access Deny
August 21, 2014 – 7:59 am | No Comment

In this article I will tell how to forbid access to certain resources for some clients. The instructions will include descriptions of different directives.

Read the full story »
CSS Templates

Contain reviews and news about CSS Templates.

Freebies

Contain freebies such as icons, graphics, headers and images for your websites.

Fun Stuff

Contains other fun stuff for entertainment or interesting site showcase.

How-To

Contain technical elaborations on some specific workarounds or common tweak.

Joomla Templates

Contains reviews and news about Joomla templates.

Home » How-To

Drupal: Auto-Generating of Document Title

Submitted by on April 23, 2010 – 5:28 amNo Comment

In article I would tell how to

  • Disable title output
  • Auto-fill the title
  • Disable necessary filling in of title

 


Solution:

You can use Automatic Nodetitles module for the automatic title generating. The module can:

  • disable necessary filling in of title,
  • do not show title field and fill the title automatically,
  • fill the field if it is left blank.

If you need to create title automatically (the title should be unique in addition – it should have some letter or number index, for example, K-123) then you should use document number (nodes). The problem is that document has no node when title generating. drupal.org supposes to get index from the base and add 1 to it.

$name = db_prefix_tables(‘{node}_nid’);
$id = db_result(db_query("SELECT id FROM {sequences} WHERE name = ‘%s’", $name)) + 1;
return $id;

Letter index
To add letter index before digits, you should change it in the following way:

$name = db_prefix_tables(‘{node}_nid’);
$id = db_result(db_query("SELECT id FROM {sequences} WHERE name = ‘%s’", $name)) + 1;
return <strong>"AК-".</strong>$id;

Leave a comment!

Add your comment below, or trackback from your own site. You can also subscribe to these comments via RSS.

Be nice. Keep it clean. Stay on topic. No spam.

You can use these tags:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

This is a Gravatar-enabled weblog. To get your own globally-recognized-avatar, please register at Gravatar.