drupal

Drupal search engine does not index my custom nodes!

独自空忆成欢 提交于 2020-01-02 17:34:18
问题 Somebody has posted an hour ago or so a question that was about the drupal search engine and was about like this: I know drupal should index anything that is returned by node_view() but this is not happening for my custom content. Also: are there better alternatives to Drupal built-in functionality? As the question has been removed while I was answering, and didn't want to throw away 20 minutes of my life for nothing ;) I thought to re-create the question a second time. Hope this is fine by

Drupal 6: form_state values empty on submit

☆樱花仙子☆ 提交于 2020-01-02 17:16:16
问题 I'm trying to create a custom form in Drupal 6 and everything seems to work okay with the code below including when submitted a new entry is created in the database however all the $form_state values are empty. What am I missing? <?php function rate_form($form_state) { $form = array(); $form['rate']['name'] = array( '#type' => 'textfield', '#title' => t('Name'), '#size' => 30, '#maxlength' => 100, '#required' => TRUE, ); $form['rate']['description'] = array( '#type' => 'textarea', '#title' =>

Drupal: How to theme a module

痴心易碎 提交于 2020-01-02 12:52:12
问题 I'm trying to theme a modules output. In particular i'm working on http://drupal.org/project/service_links Any idea how that works? Thanks in advance! 回答1: Generally, if you want to theme a module you have a few options. Overwrite theme functions. You can overwrite the theme functions that the module uses/implements to change the markup, one example of such a function is theme_service_links_node_format . You change make a function in your theme's template.php called 'your_theme_name_service

Changing the Node Creation Title in Drupal?

醉酒当歌 提交于 2020-01-02 11:29:17
问题 Let's say I have a node called "product". When I create such a node, it will always display: "Create product" as the title of the node. How do I change this title WHEN CREATING THE NODE? 回答1: you mean you have a content type "product"? the "Create product" title when creating a node of type "product" is set in node_add($type): // ... drupal_set_title(t('Create @name', array('@name' => $types[$type]->name))); $output = drupal_get_form($type .'_node_form', $node); // ... there are at least 2

Valid access arguments

心已入冬 提交于 2020-01-02 10:02:29
问题 How can I look up the valid access arguments? I looked in menu_router, but I believe that only gives some of them. $items['admin/page'] = array( 'access arguments' => array('access administration pages'), ); 回答1: Invoke hook_permission() across all modules: $permissions = module_invoke_all('permission'); If I remember rightly array_keys($permissions) will then give you a list of valid permission machine names. The labels/descriptions/other settings for each permissions are in each individual

Changing timezone of a retrieved date in php

只谈情不闲聊 提交于 2020-01-02 06:15:11
问题 I am retrieving a date in format of 2013-09-15 08:45:00 from the database, which is set in UTC and I need to change it to another dynamic timezone (based on user) So far I've got $datetime = $row->field_data_field_performance_times_field_performance_times_v; $eventDate = DateTime::createFromFormat('Y-m-d H:i:s', $datetime, new DateTimeZone($user->timezone)); $performance_time = date_format($eventDate, 'l, j F, Y, H:i'); But it doesn't change the timezone. Any ideas what's wrong? It should be

how to programmatically create menu items while creating nodes?

懵懂的女人 提交于 2020-01-02 06:00:31
问题 I'm creating some nodes programmatically, thus: foreach ($titles as $t) { $n = new stdClass(); $n->type = 'myType'; $n->uid = 1; $n->title = $t; $menu = array(); $menu['link_title'] = $t; $menu['menu_name'] = 'primary-links'; // this attempt at placing the menu item in a particular place in the // menu hierarchy didn't work: $menu['parent'] = 'primary-links:867'; $menu['depth'] = 3; $menu['p1'] = '580'; $menu['p2'] = '867'; $n->menu = $menu; node_save($n); } I've got a menu structure like

drupal jQuery 1.4 on specific pages

China☆狼群 提交于 2020-01-02 05:28:10
问题 I'm looking for a way to force drupal to use 1.4 on specific pages. This is the same as this old question: drupal jQuery 1.4 on specific pages It look me a while to try the answer which I marked correct. But because I'm new to module dev overall I couldn't figure it out based on the answer. The code from that answer looked like this: /** * Implementation of hook_theme_registry_alter(). * Based on the jquery_update module. * * Make this page preprocess function runs *last*, * so that a theme

Drupal 7 | update multiple rows using db_update

僤鯓⒐⒋嵵緔 提交于 2020-01-02 05:22:07
问题 I have an array like Array ( [1] => 85590762,22412382,97998072 [3] => 22412382 ) Where key is the item_id and value is the value of a column which I need to update against an item. I can use db_update in a loop but i want to avoid this strategy due to performance. I want to update all the rows in a single db call. Also using db_query I think will not be a good idea. So is there any way using db_update to update these rows? According to above data, standard mysql queries will be like update

Redirect to a new page from within a Drupal site

主宰稳场 提交于 2020-01-01 14:06:48
问题 I'm working with a Drupal site, and we want to set up a special URL that redirects to an external site. In other words, if http://www.mysite.com is our Drupal site, we want to have http://www.mysite.com/external redirect to the external site. I have very little experience with Drupal and have no idea how to set this up. Any help is appreciated! 回答1: If all you want is to redirect the users to the same site, when they follow a link that takes them to http://www.example.com/external, then you