drupal-6

Drupal: File upload required?

落爺英雄遲暮 提交于 2019-12-07 05:32:21
问题 For some reason, my form breaks when I try to make a file upload required. Here is the code for it: $form_id = "upload_form"; $form[$form_id] = array ( '#type' => 'fieldset', '#description' => t('This is a utility to import nodes from a Comma Separated Value file. To begin, pick a node type, and upload a CSV.'), ); $form[$form_id]['type'] = array( '#title' => t('Enter node type'), '#type' => 'textfield', // '#autocomplete_path' => '', TODO: autocomplete for node types '#required' => TRUE, '

How to list CCK fields by content type in Drupal

泄露秘密 提交于 2019-12-07 00:58:58
问题 To get a list of a content type's cck fields, I was hoping to use: drupal_get_schema('content_type_mycontenttype'); but that leaves out fields with multiple values. Is there a simple call to use to get such a list? 回答1: Take a look at the content_fields function, and if doesn't that have the information you need, there is _content_type_info. Additionally, once you have the field information, you can extract the table storage and column names using content_database_info. 回答2: For Drupal 7,

Drupal 6: best practice for changing contributed module's JavaScript

牧云@^-^@ 提交于 2019-12-06 16:48:37
I've a question about how to customize drupal modules avoiding hacks. Let's say I've downloaded Lightbox2 module and I want to change the javascript file to display differently my lightbox. At the moment I'm modifying the Lightbox2 module, so I cannot update it anymore, so I know it is not the best practice. I was wondering if I can customize the javascript file of this module with a hook, and how. Thanks To alter just the JS, you shouldn't need to hack the module at all. Instead, you can use the theme system to alter what scripts are sent to the page. In your template.php preprocess page:

How to add a custom word to my domain URL for every request?

非 Y 不嫁゛ 提交于 2019-12-06 14:40:56
问题 Consider my domain name is www.mydomain.com Consider a page request www.mydomain.com/user/register I want to add a custom word after base URL for every request inside mydomain.com.example www.mydomain.com/customword/ www.mydomain.com/customword/user/register Can we do this using URL rewriting in htaccess file ? Actually it should execute 'www.mydomain.com/user/register' internally...but externally the URL should look like www.mydomain.com/customword/user/register. 回答1: You could create the

How to just show NodeQueue block on included nodes?

ε祈祈猫儿з 提交于 2019-12-06 14:40:44
On my blog I have a series of posts on a common subject that I'd like to link together with a common navigation block, so that readers can easily jump forwards or backwards through the series. I've used NodeQueue to collect all the blog entries together in sequence. Putting the associated block in my sidebar gives me the navigation that I want BUT the block appears on every page of my site. What I want to do is limit the visibility of the block so that it only appears on pages that are included in the queue. How can I do this? I know that NodeQueue creates it's blocks using Views , so I guess

Changing the Node Creation Title in Drupal?

让人想犯罪 __ 提交于 2019-12-06 09:23:25
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? 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 options to change this: change the translatable string 'Create @name' (indicated by the t() it is passed

Changing the Admin Theme in Drupal 6 Directly in Database

天涯浪子 提交于 2019-12-06 08:13:53
I'd like to restore the default admin theme in Drupal 6 via the database. Anyone know where this is stored? Btw, there is a great answer describing how to change your site's public theme in the database here ...I just could not get it to update my admin theme. List of themes you can find in {system} table, filter by type = theme, there you can set status = 1 Default theme you can find in {variable} table, filter by name = theme_default, change it to you theme name, as it is written in system table (for example, garland, not Garland). After this clear cache table. Follow these steps via the db:

Search hook for filtering results?

a 夏天 提交于 2019-12-06 07:58:09
I have been going through the docs and source code looking for something without luck. Is there a Drupal 6 hook that gets called after hook_search(), but before the $results gets handed off to the template system? I need to do a fairly custom pruning and reordering of results that get returned. I could just reimplement hook_search(), but this seems like overkill. Thanks. There isn't; search_view() (which displays the results) calls search_data() , which invokes hook_search() then immediately themes the results. Re-implementing hook_search() is probably the most straightforward route. With that

Disabling /node view and other hidden views in Drupal?

£可爱£侵袭症+ 提交于 2019-12-06 07:00:01
问题 Many long nights spent on my site, and now I've started doing all sorts of security checks and stumbled upon the following: www.mysite.com/node That shows the latest x nodes that a user has access to. I DON't want this view visible to users. And I certainly don't want any other views similar to this available. So, my questions are: How do I disable this view? Are there other hidden views that I'm not aware of that an anonymous user can use to access several nodes at once? 回答1: You want to use

Caching a Drupal site with session-specific data on every page

时光毁灭记忆、已成空白 提交于 2019-12-06 06:50:17
问题 We have a site written in Drupal 6. We want to use Drupal's caching mechanism to improve performance, but when we turned it on, we found problems because our site has session data displayed on every page. Drupal's caching system only works for static content page, and our session data effectively means that none of our pages are static. We've come up with two solutions to this: Rewrite the block that shows the session data such that it loads the non-static data using Ajax, so that the main