drupal-6

Drupal: can I place a views filter (Search items) in a website block?

我是研究僧i 提交于 2020-01-06 15:50:49
问题 I'm using Drupal and in the "Filters" list there is also the "Search Term" filter which works great. I use it to search a specific node in my Views list. However such field only displays when I'm in the view page, but I would like to display on any page of my website (let's say as a block) (and when I search for something, the view page is loaded with the filtered nodes. Do you know how could I make it ? thanks 回答1: In your view configuration page there should be a field: Exposed form in

Drupal 6: Only inserting first character of value to MySQL

我的未来我决定 提交于 2020-01-06 03:37:06
问题 I am working with a hook_form_alter on a CCK type (for you drupal-ers). I have a field that is normally a select list in my node form. However, in this instance, I want to hide the select list, and populate its value in the form with an SQL query. Everything was going nicely. I could see that my desired value was showing up in the HTML source, so I knew my query was executing properly. However, when I submit the form, it only inserts the first character of the value. A few of my tests were

How to use hook alter form in module to register a user and also save some data in another table?

烈酒焚心 提交于 2020-01-06 01:57:07
问题 have a general idea on how to use hook alter to modify the feel of the registration form . However the challenge I have is to not only have the user register, but to save some extra data into another table and then redirect user to a new page. How would I get about doing that? Please help 回答1: Again, it'd be easier to plan what you're trying to do and take advantage of common solutions. I suspect what you're after is the Content Profile module. 回答2: add a custom function to your form,

Select the latest node for each defined taxonomy term in Drupal 6

女生的网名这么多〃 提交于 2020-01-05 07:37:14
问题 Can anyone help me out with a query to display 1 node for each taxonomy in Drupal 6? For example, I have 4 taxonomy terms (tid = 21, 22, 23, 24) in a 1 vocabulary (vid = 3). I would like to display a table showing: Taxonomy Term: Taxonomy Description Number of Nodes in Taxonomy Term Title of latest node in taxonomy term Last Commented/Updated Date Thanks, JK 回答1: Actually, just use http://drupal.org/project/views =) You don't need any hooks, etc. and if you need to output this view in your

Drupal 6: Render Views 2 data in a page tpl file

喜你入骨 提交于 2020-01-05 05:47:11
问题 I think the answer might be obvious but I can't seem to figure it out. How do I render a view I've created in Views 2 (Drupal) in a page-pagename.tpl.file? My thought was that it would be some sort of PHP snippet but I can't find documentation about it. Any thoughts that might steer me in the right direction. 回答1: The solution is here: http://views-help.doc.logrus.com/help/views/embed Also "function" can be replaced with "print" and the additional param brackets can be removed. So it will

Adding content created by custom module to drupal search index

狂风中的少年 提交于 2020-01-04 14:12:09
问题 I have developed a module to create content for my site without using CCK. The data will be saved in different tables other than the default tables of Drupal. My requirement is, how can i make Drupal to index the content created by my custom module? 回答1: You will have to implement hook_search in your module that indexes your custom content. 来源: https://stackoverflow.com/questions/4816851/adding-content-created-by-custom-module-to-drupal-search-index

Drupal Views exposed filter of Author name

十年热恋 提交于 2020-01-04 09:05:08
问题 I have a view which I would like to add an exposed filter of the author name. So I can filter all the posts created by "John Smith" etc. I can't seem to see it listed under filter. Is this possible to do? 回答1: Under Build > Views ( /admin/build/views ) add a filter (from filter category user ) click Expose in the filter configuration section (near to the right border). 回答2: This is actually a little harder than it sounds. You need to create a "Relationship" to the "Node revision: User", and

Count number of results in a View

不问归期 提交于 2020-01-03 20:04:16
问题 I need to count how many people belong in pre-defined groups (this is easy to do in SQL using the SELECT COUNT statement). My Views query runs fine and displays the actual data in my table, but I simply need to know how many results it found. However there doesn't seem to be a COUNT option in views. I am guessing I am going to have to use some sort of views hook, and then stick the result in the table. Here's a quick example of what i'm trying to achieve: My Table ---------------------- Group

Check cookie and redirect with Apache

ぃ、小莉子 提交于 2020-01-03 17:24:50
问题 I'd love to get some feedback on this. I'm not sure if it's the right approach. The details I'm running Apache 2 with PHP 5.3/MySQL 4 and Drupal 6 is the platform. I'm developing a site which contains restaurant reviews in a couple of selected cities. When the users arrives at the site it can choose which city is theirs. I store their choice in a cookie and if they haven't made a choice I've selected a default city. Proposed solution Now I want the URL mydomain.com/reviews to redirect to the

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