drupal-6

how to make content's title unique

折月煮酒 提交于 2019-12-04 06:29:48
I am new to drupal and i want my content title unique so is there any module available for it or if i can implement autocomplete to view my past title name. please give answer in detail Thanks in advance :) You can use http://drupal.org/project/unique_field module. It performs additional validation when a node is created or updated by a user to require that a node's title or other specified fields are unique. Scenario #1 - Unique Node hook_node_validate() is what you need, if you are working with Drupal 7 Either you can simply use this below mentioned code in your custom module or you can take

Drupal: Views, can the displays have different styles for the view?

烈酒焚心 提交于 2019-12-04 06:15:12
问题 I've created several displays for my View. I thought that I could assign different styles (Gallery, Table, etc) of the view for each display but I realized that only 1 Style is used for all Displays. The reason I wanted to change is because I'm using DraggableViews, and I would like to keep the same order for all displays, when the user drag some items on the display with draggable nodes. THanks 回答1: They can. See http://drupal.org/node/352970 The idea is to use specific names for template

Fundamental understanding of how Views and Pathauto work together

廉价感情. 提交于 2019-12-04 03:09:25
I am having fundamental problems understanding when to use a pathauto rule, and when to use a views page path. I have several custom content types, and I am using blocks to display certain parts of nodes on certain paths. Then I use a views page to display the main node on a path. When I do this, I can't use pathauto, as it overrides the paths I set in views. Eg.. If I set up a views page path of "location/%", and set a pathauto rule for Location content types of "location/[title-raw]", when I browse to mysite.com/location/mylocation pathauto wins, and simply displays the full node. And if I

Drupal - use l or url function for mailto links

非 Y 不嫁゛ 提交于 2019-12-04 01:58:10
Does anyone know how to use the l() or url() function to create mailto links? I am running drupal 6. You need to use the absolute option: l('Mail me', 'mailto:jim@hotmail.com', array('absolute' => TRUE)); will generate <a href="mailto:jim@hotmail.com">Mail Me</a> A good practice is to use the t() function with strings. Code should be then: l(t('Mail me'), 'mailto:jim@hotmail.com', array('absolute' => TRUE)); Preferably none: l() is useful for the output of internal links: it handles aliased paths and adds an 'active' class attribute to links that point to the current page (for theming)" see

Drupal 6 Views 2: Setting Date Arguments

删除回忆录丶 提交于 2019-12-03 22:44:33
问题 Passing uid as an argument works fine with this code: $bouts = views_get_view_result('Results', 'page_1', array($user->uid)); The key line in views_get_view_result that sets arguments is: $view->set_arguments($args); But what about passing date ranges? Also, if something is specified as a filter on a view, is there a way to prorammatically alter it? views_get_view_result: /** * Investigate the result of a view. * from Drupal.org. * * @param string $viewname * The name of the view to retrieve

How to create a forum topic programmatically?

三世轮回 提交于 2019-12-03 21:37:02
I just gone through how to create forums and containers programmatically with the below link http://www.unibia.com/unibianet/drupal/how-create-drupal-forums-and-containers-programmatically But never see any post(google) which create forum topic pro-grammatically, whether i should go with node_save() or any alternative. please help me guys, Thanks, Edvin A quick, safe and easy way to create new nodes programmatically is to use node_save() : <?php // Construct the new node object. $node = new stdClass(); // Set the values for the node $node->title = "My new forum topic"; $node->body = "The body

Drupal Installation PDOException

陌路散爱 提交于 2019-12-03 17:17:57
http://localhost got problem: PDOException: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'drupal_test.semaphore' doesn't exist: SELECT expire, value FROM {semaphore} WHERE name = :name; Array ( [:name] => variable_init ) in lock_may_be_available() (line 165 of /var/www/drupal/includes/lock.inc). This is my database configuration: $databases = array ( 'default' => array ( 'default' => array ( 'database' => 'drupal_test', 'username' => 'root', 'password' => 'XXX', 'host' => 'localhost', 'port' => '', 'driver' => 'mysql', 'prefix' => '', ), ), ); What to do? a lot of times simply

Adding HTML to Drupal closure?

情到浓时终转凉″ 提交于 2019-12-03 16:52:56
To add javascript, you can use: drupal_add_js And similar for css: drupal_add_css But what if I just want to add html at the end of my page. I.e. Add a div with some text in it at the end of the page? A lot of suggestions here work if you want your alteration to be theme-based, but if you want this to come from a module, using a block region, page template or page prepocess won't cut it, because you're tying the alteration to the theme. From a modular standpoint, the following options are best: hook_footer() -- http://api.drupal.org/api/function/hook_footer/6 :: my_module_footer() should

Drupal return number of results in a View

僤鯓⒐⒋嵵緔 提交于 2019-12-03 11:50:49
问题 I have a view in Drupal that filters my content. It brings back 7 rows. All I want to return is the number or results returned(7). Is this possible? I tried using the View result counter but it returns a number for each results 1 2 3 4 5 6 7 I just need the 7 part. So in SQL I would do a select count(*) 回答1: what you can do is to activate php for the views header/footer and add the following snippet to it: <?php $view = views_get_current_view(); print $view->total_rows; ?> This will print the

Preventing form_token from rendering in Drupal “GET” forms

梦想与她 提交于 2019-12-03 06:43:56
Drupal inserts a form_token as a hidden field when it renders forms. The form_token is then checked on form submission to prevent cross-site request forgery attacks. The form data that is submitted is guaranteed to have come from the original form rendered by Drupal. However, forms using the "GET" method shouldn't need this token. All it does is lengthen and uglify the resulting URL. Is there any way of suppressing it? Yes, there is a way, but use it consciously (see warning below): If you create the form yourself, adding $form['#token'] = FALSE; to the form definition array should prevent a