drupal

Redirect to a new page from within a Drupal site

为君一笑 提交于 2020-01-01 14:06:14
问题 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

Custom Drupal 7 Field only saves the first character

走远了吗. 提交于 2020-01-01 12:26:08
问题 I'm essentially trying to create my first field type module using the new Drupal 7 Field API. I've managed to get it to display correctly in the "edit" view. However, when I try to save some data it only saves the first character. Here's the module: <?php function youtubefield_field_info() { return array( 'youtubefield_video' => array( 'label' => t('Youtube video'), 'description' => t('This field stores a youtube video ID and displays the video associated with it'), 'settings' => array( 'max

Where to declare variables common to different include files in a module - Drupal

[亡魂溺海] 提交于 2020-01-01 12:00:33
问题 I have a Drupal Module 'example'. I have split the admin and client side functionality of the module into two include files example.admin.inc and example.pages.inc. I declared constants (define()) in the example.module file, which are accessible in both the pages.inc file and admin.inc file. But how can I declare normal $variables in a centralized location so that they can be accessible in both the admin.inc file and pages.inc file. I tried to declare $variable in example.module, but couldn't

Drupal - use l or url function for mailto links

六月ゝ 毕业季﹏ 提交于 2020-01-01 08:43:47
问题 Does anyone know how to use the l() or url() function to create mailto links? I am running drupal 6. 回答1: 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> 回答2: 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)); 回答3: Preferably none: l() is useful for the output of internal links: it

Field data in one table, not many. for drupal7

浪子不回头ぞ 提交于 2020-01-01 06:26:24
问题 I am working with the commerce module to create an online store. I am modifying the products .install file to create a content type (as I have been told this is required) and as part of that content type, I need to create lots of fields. The list will be around 50-60 different pieces of information. Ideally I would like to store these in a single table with the productID at the beginning and all the other information along, but this doesn't seem to be the case; all the fields are stored in

Preventing form_token from rendering in Drupal “GET” forms

久未见 提交于 2020-01-01 02:49:07
问题 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? 回答1: Yes, there is a way, but use it consciously (see warning below): If

Drupal 7 Default .htaccess

…衆ロ難τιáo~ 提交于 2020-01-01 02:34:13
问题 I am after the default .htaccess code for Drupal 7, for some reason the install did not update the .htaccess file at all and it is blank. Any help would be greatly appreciated as I can't find this anywhere. 回答1: Actually, the official Drupal source code is on GitHub: https://github.com/drupal/drupal. The requested .htaccess file can be found here. 来源: https://stackoverflow.com/questions/5864861/drupal-7-default-htaccess

Modificate content profile form to show checkboxes in the matrix

橙三吉。 提交于 2019-12-31 07:20:24
问题 I need to show matrix like this http://eugen.gotdns.com/test/zeitplaner.png in content profile form. I can arrange checkboxes with CSS in this way, but i need also some labels on the top and on the left. Should i work with $form array to add some labels? Can this be done with css maybe? 回答1: I agree with Mike Crittenden that the way to do this is to use tables, I don't agree with the way he want to do it though. The best solution is to make a custom theme function for the form. Basicly what

theme_table drupal development

女生的网名这么多〃 提交于 2019-12-31 05:36:05
问题 update I have made this table: I have 2 array's UGentArray and InternshipsArray. How can I set these in my table? instead of "Row column 1 data" and "Row column 2 data". My question is: I want the values from UgentArray and InternshipArray as 2 columns under Each title UGentID and Internships enter code here// Make table and display on screen. $tbl_header = array(); $tbl_header[] = array("data" => "UGentID"); $tbl_header[] = array("data" => "Internships"); $tbl_row = array(); foreach(

Using Drush Site-Install in C#

僤鯓⒐⒋嵵緔 提交于 2019-12-31 04:43:29
问题 I'm trying to do a Drupal site install using Drush in C# as part of a full Windows Server site installation using MSI. The Drush commmand I am using is the following one. C:\ProgramData\Drush\Drush.bat -y si application_name --db-url=sqlsrv://admin_name:password(local)\SQLEXPRESS:/database_name --account-name=admin --account-mail=name@test.com --account-pass=Password1234 --site-mail="admin@company.com" --site-name="Site Name" install_configure_form.site_default_country=GB install_configure