如何更改现场设置的长度? -- 7 领域 和 entities 领域 和 database 领域 drupal 相关 的问题

How to change the length of field settings?


48
vote

问题

中文

我已将一次设置为网站的一个长期限制。现在客户想要将更多字符放入该字段。

我无法从drupal更改最大大小,因为我收到以下错误消息:

数据库中存在此字段的数据。现场设置无法再更改。

然而,必须有一个解决方案。我应该在数据库中更改它(该字段是由 field-collections 模块)实现的

英文原文

I have set once to a website a lenght limit to a field. And now the client wants to put more characters to that field.

I cannot change the maximum size from Drupal because I get the following error message:

There is data for this field in the database. The field settings can no longer be changed.

However there must be a solution. Shall I change it in database (the field is one implemented by the Field-collections module)?

        
         
         

回答列表

90
 
vote
vote
最佳答案
 

Dylan Tack解决方案是最简单的,但是我喜欢探索Drupal数据库的内部病房,以了解那里的事情。

所以,假设您有一个文本字段,您想要长到25个字符的Mield_Text,它为25:

  • 数据将存储在两个表中:field_data_field_text和field_revision_field_text
  • 定义存储在field_config中,用于存储数据,以及此字段的每个实例的字段_config_instance(类似于标签)。

现在让我们做一点心脏手术。

  1. 更改数据表列定义:

      ALTER TABLE `field_data_field_text`  CHANGE `field_text_value` `field_text_value` VARCHAR( 25 )  CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL;  ALTER TABLE `field_revision_field_text`  CHANGE `field_text_value` `field_text_value` VARCHAR( 25 )  CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL;   
  2. 更改定义列,这个是非常棘手的,因为它存储在 blob 中,但这不是一个会阻止你这样做的东西。< / p>

      解剖这个 blob 的肠道:

  3.   SELECT CAST(`data` AS CHAR(10000) CHARACTER SET utf8)  FROM `field_config` WHERE field_name = 'field_text';   
    • 这将为您提供类似的东西:
      a:7:{s:12:"translatable";s:1:"1";s:12:"entity_types";a:0:{}s:8:"settings";a:2:     {s:10:"max_length";s:2:"10";s:17:"field_permissions";a:5:     //a lot more stuff...   
    • 这是一个php 序列化 s:10:"max_length";s:2:"10"; ,这意味着这个数组的属性名为 max_length (哪个名称是10个字符串 - 因此,该值为10(这是2字符长字符串)。它很容易,不是吗?

    • 更改其值与 s:2:"25" 替换为 s:2:"10" 部分。 小心:如果您的新值在字符长度较长,则必须相应地调整"S" 部分。例如,PUTTIEN 100将 s:3:"100" 100长度为3个字符。

    • 让我们把这个新值放回dB中,不要忘记保持整个字符串。

      UPDATE `field_config`  SET data = 'a:7:{...a:2:{s:10:"max_length";s:2:"25";...}' WHERE `field_name` = 'field_text'   
    • 冲洗缓存。
  4. ???

  5. 利润!

顺便说一下,phpmyadmin有一些设置允许,但为什么要走开路?

ps:这也可以节省您的生命,因为代码中的错误,在视图中置于视图中并获得WSOD时。

 

Dylan Tack solution is the easiest, but personally I enjoy exploring the inner wards of Drupal's database to seen how things are managed down there.

So, assuming you have a text field which machine name is field_text of 10 characters you want to grow to 25:

  • data will be stored in two tables: field_data_field_text and field_revision_field_text
  • definition is stored in field_config for the storage data, and field_config_instance for each instance of this field (stuff like label).

Now let's do a little heart surgery.

  1. Alter the data tables columns definitions:

    ALTER TABLE `field_data_field_text`  CHANGE `field_text_value` `field_text_value` VARCHAR( 25 )  CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL;  ALTER TABLE `field_revision_field_text`  CHANGE `field_text_value` `field_text_value` VARCHAR( 25 )  CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL; 
  2. Change the definition column, this one is very tricky because it's stored in a BLOB, but that's not something that will stop you for doing this.

    • Dissect the guts of this BLOB thing:
    SELECT CAST(`data` AS CHAR(10000) CHARACTER SET utf8)  FROM `field_config` WHERE field_name = 'field_text'; 
    • This will give you something like:
    a:7:{s:12:"translatable";s:1:"1";s:12:"entity_types";a:0:{}s:8:"settings";a:2:     {s:10:"max_length";s:2:"10";s:17:"field_permissions";a:5:     //a lot more stuff... 
    • This is a PHP serialized array, the interesting part is s:10:"max_length";s:2:"10";, this mean this array has a property named max_length (which name is a 10 characters string - hence the "s") which value is 10 (which is a 2 characters long string). It's pretty easy, isn't it?

    • Changing its value is as easy as replacing the s:2:"10" part by s:2:"25". Be careful: if your new value is longer in character length, you have to adapt the "s" part accordingly. For example putting 100 will be s:3:"100" as 100 length is 3 characters.

    • Let's put this new value back in the DB, don't forget to keep the whole string.

    UPDATE `field_config`  SET data = 'a:7:{...a:2:{s:10:"max_length";s:2:"25";...}' WHERE `field_name` = 'field_text' 
    • Flush your caches.
  3. ???

  4. PROFIT!

By the way, PhpMyAdmin has some setting to allow direct modification of BLOB columns, but why go the easy way?

PS: This can also save your life when putting some PHP code in views and getting a WSOD because of an error in your code.

 
 
         
         
20
 
vote
  function mymodule_update_7100() {   $items = array();   _field_maxlength_fix('field_name');   return $items; }  function _field_maxlength_fix($field_name, $maxlength = 255) {   _alter_field_table($field_name, $maxlength);   $data = _get_field_data($field_name);   $data = _fix_field_data($data, $maxlength);   _update_field_config($data, $field_name); }  function _alter_field_table($field_name, $maxlength) {   db_query("ALTER TABLE field_data_".$field_name." CHANGE ".$field_name."_value ".$field_name."_value VARCHAR( ".$maxlength." ) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL");   db_query("ALTER TABLE field_revision_".$field_name." CHANGE ".$field_name."_value ".$field_name."_value VARCHAR( ".$maxlength." ) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL"); }  function _get_field_data($field_name) {   $qry = "SELECT data FROM field_config WHERE field_name = :field_name";   $result = db_query($qry, array(':field_name' => $field_name))->fetchObject();   return unserialize($result->data); }  function _fix_field_data($data, $maxlength) {   $data['settings']['max_length'] = (string)$maxlength;   return serialize($data); }  function _update_field_config($data, $field_name) {   $qry = "UPDATE field_config SET data = :data WHERE field_name = :field_name";   db_query($qry, array(':data' => $data, ':field_name' => $field_name)); }   
 
function mymodule_update_7100() {   $items = array();   _field_maxlength_fix('field_name');   return $items; }  function _field_maxlength_fix($field_name, $maxlength = 255) {   _alter_field_table($field_name, $maxlength);   $data = _get_field_data($field_name);   $data = _fix_field_data($data, $maxlength);   _update_field_config($data, $field_name); }  function _alter_field_table($field_name, $maxlength) {   db_query("ALTER TABLE field_data_".$field_name." CHANGE ".$field_name."_value ".$field_name."_value VARCHAR( ".$maxlength." ) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL");   db_query("ALTER TABLE field_revision_".$field_name." CHANGE ".$field_name."_value ".$field_name."_value VARCHAR( ".$maxlength." ) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL"); }  function _get_field_data($field_name) {   $qry = "SELECT data FROM field_config WHERE field_name = :field_name";   $result = db_query($qry, array(':field_name' => $field_name))->fetchObject();   return unserialize($result->data); }  function _fix_field_data($data, $maxlength) {   $data['settings']['max_length'] = (string)$maxlength;   return serialize($data); }  function _update_field_config($data, $field_name) {   $qry = "UPDATE field_config SET data = :data WHERE field_name = :field_name";   db_query($qry, array(':data' => $data, ':field_name' => $field_name)); } 
 
 
   
   
9
 
vote

这似乎是当前文本模块的限制。 text_field_settings_form()有这个评论:" @todo :if $ has_data,添加一个validate处理程序,只允许max_length增加。" 。

作为一个临时解决方法,您可以在第77行附近发表out SELECT CAST(`data` AS CHAR(10000) CHARACTER SET utf8) FROM `field_config` WHERE field_name = 'field_text'; 0 在模块/字段/模块/文本/ text.module中。

我找不到这个特定情况的现有问题,但你可能会在#372330 。

 

This appears to be a limitation of the current text module. text_field_settings_form() has this comment: "@todo: If $has_data, add a validate handler that only allows max_length to increase.".

As a temporary workaround, you could comment out '#disabled' => $has_data in modules/field/modules/text/text.module, around line 77.

I couldn't find an existing issue for this specific case, but you might mention it on #372330.

 
 
         
         
8
 
vote

drupal 7

在Drupal 7中创建文本字段时,必须选择最大值 您的数据的长度。只要您为此字段创建任何数据, 最大长度在Drupal现场设置中变得不变。

它可以理解,这将被禁用减少 最大长度,因为它可能导致数据丢失,但是它 应该可以增加任何字段的最大长度。一种 Drupal 7中的todo文本模块代码显示这是预期的 从未完成过。

需要发生的3件事:

  1. 更改Field_data_ {fieldname}表
  2. 中值列的varchar长度
  3. 更改Field_revision_ {fieldname}表
  4. 中值列的VARCHAR长度
  5. 更新字段的配置以反映新的最大长度设置 以下函数完成所有3个步骤,并且需要2个简单参数,包括字段的名称和最大的最大长度。
  /**  * Helper function to change the max length of a text field.  */ function MYMODULE_change_text_field_max_length($field_name, $new_length) {   $field_table = 'field_data_' . $field_name;   $field_revision_table = 'field_revision_' . $field_name;   $field_column = $field_name . '_value';    // Alter value field length in fields table.   db_query("UPDATE `{$field_table}` SET `{$field_column}`=SUBSTR(`{$field_column}`, 0, {$new_length})");   db_query("ALTER TABLE `{$field_table}` CHANGE `{$field_column}` `{$field_column}` VARCHAR( {$new_length} )");   // Alter value field length in fields revision table.   db_query("UPDATE `{$field_revision_table}` SET `{$field_column}`=SUBSTR(`{$field_column}`, 0, {$new_length})");   db_query("ALTER TABLE `{$field_revision_table}` CHANGE `{$field_column}` `{$field_column}` VARCHAR( {$new_length} )");    // Update field config with new max length.   $result = db_query("SELECT CAST(`data` AS CHAR(10000) CHARACTER SET utf8) FROM `field_config` WHERE field_name = '{$field_name}'");   $config = $result->fetchField();   $config_array = unserialize($config);   $config_array['settings']['max_length'] = $new_length;   $config = serialize($config_array);   db_update('field_config')     ->fields(array('data' => $config))     ->condition('field_name', $field_name)     ->execute(); }   

一旦在自定义安装文件中提供此功能,您可以创建一个新的数据库更新功能,该函数使用此新功能来进行所需的更改。

  /**  * Change max_length of Name field  */ function mymodule_update_7002() {   MYMODULE_change_text_field_max_length('field_name', 50); }   

源: http://nathan.rambeck.org/博客/ 42-MODIFY-DRUPAL-7-文本 - 字段 - 最大长度


Drupal 8

这是 @christopher :

提出的相同函数的版本
  /**  * Utility to change the max length of a text field.  *  * @param string $field_name  *   Field name.   * @param int $new_length  *   Field length in characters.   *  * @throws DrupalUpdateException  */ function MYMODULE_change_text_field_max_length($field_name, $new_length) {   // The transaction opens here.    $txn = db_transaction();    try {     // Update field content tables with new max length.     foreach (['field_data_', 'field_revision_'] as $prefix) {       db_query('       ALTER TABLE {' . $prefix . $field_name . '}          MODIFY ' . $field_name . '_value VARCHAR( ' . $new_length . ' )       ');     }      // Update field config record with new max length.     $result = db_query("         SELECT CAST(data AS CHAR(10000) CHARACTER SET utf8)          FROM {field_config}          WHERE field_name = :field_name       ", [':field_name' => $field_name]     );     $config = $result->fetchField();     if ($config) {       $config_array = unserialize($config);       $config_array['settings']['max_length'] = $new_length;       $new_config = serialize($config_array);       db_update('field_config')         ->fields(['data' => $new_config])         ->condition('field_name', $field_name)         ->execute();     }   }   catch (Exception $e) {     // Something went wrong somewhere, so roll back now.     $txn->rollback();     // Allow update to be re-run when errors are fixed.     throw new DrupalUpdateException(       "Failed to change $field_name field max length: " . $e->getMessage(),       $e->getCode(), $e     );   } }   
 

Drupal 7

When creating a text field in Drupal 7, you must a choose a maximum length for your data. As soon as you create any data for this field, the maximum length become immutable in the Drupal field settings.

It's understandable that this would be disabled for decreasing the maximum length because it could results in a loss of data, however, it should be possible to increase the maximum length for any field. A todo in the Drupal 7 Text module code shows this was intended but never accomplished.

The 3 things that need to happen:

  1. Change the VARCHAR length of the value column in the field_data_{fieldname} table
  2. Change the VARCHAR length of the value column in the field_revision_{fieldname} table
  3. Update the configuration of the field to reflect the new max length setting The following function accomplishes all 3 of these steps and takes 2 easy parameters including the name of the field and the new maximum length.
/**  * Helper function to change the max length of a text field.  */ function MYMODULE_change_text_field_max_length($field_name, $new_length) {   $field_table = 'field_data_' . $field_name;   $field_revision_table = 'field_revision_' . $field_name;   $field_column = $field_name . '_value';    // Alter value field length in fields table.   db_query("UPDATE `{$field_table}` SET `{$field_column}`=SUBSTR(`{$field_column}`, 0, {$new_length})");   db_query("ALTER TABLE `{$field_table}` CHANGE `{$field_column}` `{$field_column}` VARCHAR( {$new_length} )");   // Alter value field length in fields revision table.   db_query("UPDATE `{$field_revision_table}` SET `{$field_column}`=SUBSTR(`{$field_column}`, 0, {$new_length})");   db_query("ALTER TABLE `{$field_revision_table}` CHANGE `{$field_column}` `{$field_column}` VARCHAR( {$new_length} )");    // Update field config with new max length.   $result = db_query("SELECT CAST(`data` AS CHAR(10000) CHARACTER SET utf8) FROM `field_config` WHERE field_name = '{$field_name}'");   $config = $result->fetchField();   $config_array = unserialize($config);   $config_array['settings']['max_length'] = $new_length;   $config = serialize($config_array);   db_update('field_config')     ->fields(array('data' => $config))     ->condition('field_name', $field_name)     ->execute(); } 

Once this function is available in your custom install file you can create a new database update function that uses this new function to make your required changes.

/**  * Change max_length of Name field  */ function mymodule_update_7002() {   MYMODULE_change_text_field_max_length('field_name', 50); } 

Source: http://nathan.rambeck.org/blog/42-modify-drupal-7-text-field-maximum-length


Drupal 8

Here is the version of the same function proposed by @Christopher:

/**  * Utility to change the max length of a text field.  *  * @param string $field_name  *   Field name.   * @param int $new_length  *   Field length in characters.   *  * @throws \DrupalUpdateException  */ function MYMODULE_change_text_field_max_length($field_name, $new_length) {   // The transaction opens here.    $txn = db_transaction();    try {     // Update field content tables with new max length.     foreach (['field_data_', 'field_revision_'] as $prefix) {       db_query('       ALTER TABLE {' . $prefix . $field_name . '}          MODIFY ' . $field_name . '_value VARCHAR( ' . $new_length . ' )       ');     }      // Update field config record with new max length.     $result = db_query("         SELECT CAST(data AS CHAR(10000) CHARACTER SET utf8)          FROM {field_config}          WHERE field_name = :field_name       ", [':field_name' => $field_name]     );     $config = $result->fetchField();     if ($config) {       $config_array = unserialize($config);       $config_array['settings']['max_length'] = $new_length;       $new_config = serialize($config_array);       db_update('field_config')         ->fields(['data' => $new_config])         ->condition('field_name', $field_name)         ->execute();     }   }   catch (Exception $e) {     // Something went wrong somewhere, so roll back now.     $txn->rollback();     // Allow update to be re-run when errors are fixed.     throw new \DrupalUpdateException(       "Failed to change $field_name field max length: " . $e->getMessage(),       $e->getCode(), $e     );   } } 
 
 
     
     
3
 
vote

尝试...这将从文本中更新从文本到long_text的字段数据类型,并将 max_length 从4000更新到最大长度文本长度...希望这有帮助。

  function my_module_update_1001(&$sandbox) {   // Check if our field is already created.   if (field_info_field('sample_text_field')) {     db_query('ALTER TABLE field_data_sample_text_field CHANGE sample_text_field_value sample_text_field_value LONGTEXT');     db_query('ALTER TABLE field_revision_sample_text_field CHANGE sample_text_field_value sample_text_field_value LONGTEXT');     db_query("UPDATE field_config SET type = 'text_long' WHERE field_name = 'sample_text_field' ");      $field = array(       'field_name' => 'sample_text_field',       'type' => 'text_long',       'cardinality' => 1,       'settings' => array(          'max_length' => 0,       ),     );     field_update_field($field);       } }   
 

Try this... this will update the field data type from TEXT to LONG_TEXT and update the max_length from 4000 to max long text length... hope this helps.

function my_module_update_1001(&$sandbox) {   // Check if our field is already created.   if (field_info_field('sample_text_field')) {     db_query('ALTER TABLE field_data_sample_text_field CHANGE sample_text_field_value sample_text_field_value LONGTEXT');     db_query('ALTER TABLE field_revision_sample_text_field CHANGE sample_text_field_value sample_text_field_value LONGTEXT');     db_query("UPDATE field_config SET type = 'text_long' WHERE field_name = 'sample_text_field' ");      $field = array(       'field_name' => 'sample_text_field',       'type' => 'text_long',       'cardinality' => 1,       'settings' => array(          'max_length' => 0,       ),     );     field_update_field($field);       } } 
 
 
3
 
vote

d8

  1. 注释出在 core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorageSchem‌​a.php 中的两行,其中抛出文本的异常"SQL存储无法更改现有字段的模式" 。关于线1312和1403。
  2. 在您的浏览器中,导航到 /admin/config/development/configuration/single/export 。配置类型是"字段存储" ,并选择有问题的字段。复制配置。
  3. 导航到 /admin/config/development/configuration/single/import 。 。配置类型是"现场存储" 。粘贴配置。改变长度。
  4. 提交表格。

注意(如您可能已经知道),如果缩短长度,则将截断现有数据。

 

D8

  1. Comment out the two lines in core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorageSchemxe2x80x8cxe2x80x8ba.php that throw exceptions with the text "The SQL storage cannot change the schema for an existing field". About lines 1312 and 1403.
  2. In your browser, navigate to /admin/config/development/configuration/single/export. The configuration type is "Field Storage", and choose the field in question. Copy the configuration.
  3. Navigate to /admin/config/development/configuration/single/import. . The configuration type is "Field Storage". Paste the configuration. Change the length.
  4. Submit the form.

Note (as you probably already know), if you shorten the length, then existing data will be truncated.

 
 
         
         
1
 
vote

在Drupal 7中,我对PHPMyAdmin的2个表进行了修改,并刷新了缓存。

  1. "field_data_field_lorem" :将"field_lorem_value" 更改为"longtext"
  2. "field_config" :更改为"text_long"
 

In Drupal 7, I made modifications to 2 tables in phpmyadmin, and refreshed the cache.

  1. "field_data_field_lorem": changed "field_lorem_value" to "longtext"
  2. "field_config": changed "type" to "text_long"
 
 
   
   

相关问题

2  Drupal 7站点的前页的关键字和描述  ( Keywords and description for front page of drupal 7 site ) 
我设法使用"页面标题" 模块和关键字和"元标记(快速)" 插件的关键字和描述设置页面标题,但似乎目前没有办法对前面的自定义关键字/描述页。有人知道这个问题吗? ...

2  您如何嵌入Addtion RSS进入主题的<Head>部分  ( How do you embed addtional rss feeds into the head section of your theme ) 
我有5个RSS源,我希望嵌入页面的 <head> 部分。在Drupal 7上完成这一点的最佳方法是什么? ...

0  为什么我的一些模块报告迁移后缺少模块间依赖项?  ( Why are some of my modules reporting missing inter module dependencies after mig ) 
我在主机迁移后解决模块 - 我错过了什么吗?在更改主机之前,我备份了MySQL数据库,列出了所有已旧模块并刻录了DRUPAL根目录的DVD。现在,在我成功恢复5/6站点的数据库之后,三个模块报告模块组中丢失模块间依赖项: 事件 - calendar signup - 6.x-2.x-dev - 取决于:...

3  如何将Feed Item的作者设置为Feed Importer中的Feed Source的作者?  ( How to set the author of the feed item to the author of the feed source in feed ) 
我已经创建了一个Feed Importer。 我不知道如何将饲料项目的作者设置为饲料的原始作者的名称? 有没有办法做到这一点? 或者将适用任何补丁? 欢迎此功能的任何修补程序。 ...

1  在Drupal 7中过滤两个词汇表  ( Filter two vocabularies in drupal 7 ) 
我想在此页面上做类似的过滤器: http://www.nasdaq.com/screening/companies-by -Industry.aspx?行业=技术 我有两个词汇。国家和产业。 我们选择了一个行业,然后我们选择了我们想要公司的国家。 它向我展示了一家公司,女巫在一个普遍存在,一个示例技术和一个国家,...

5  得到这个jquery youtube播放列表工作?  ( Get this jquery youtube playlist working ) 
drupal 7.我正试图让这个工作 - 似乎足够简单。我通过我的主题的.info文件添加了.js文件,它正在挑选起来。我选择"完全HTML" 作为我块的格式,并粘贴了(js和ul)中的代码。只是不起作用。 http:// www。 geckonewmedia.com/blog/2009/8/14/jquery...

3  Drupal CMS - 查找内容 - 如何放弃The Destination = Edit Link中的管理/内容?  ( Drupal cms find content how to drop the destination admin content in the ed ) 
我正在使用drupal 7.当我在URL http://mysite.com/admin/content 上转到CMS时,每个内容记录的编辑链接是 http://mysite.com/node/206/edit?destination=admin/content 我想将URL转换为: http://my...

1  放射性模块。一天中的“如何到”最受欢迎的文章  ( Radioactivity module how to most popular article in one day questions ) 
感谢您阅读此问题的时间。 对我而言,不清楚戒烟措施的概念。如何在一天内获得最受欢迎的文章?我必须在43200秒(12小时)中使用半衰期?改变这个结果时? (每天在这种情况下?),如果我将能量截止为0?如果我想要每天的报告,那么在哪里存储这个结果? 提前感谢。 ...

2  Drupal文件上传  ( Drupal file uploads ) 
我正在使用文件上传的自定义表单,并且无法让表单发布文件。 以下是输入的表单代码: for ($x = 1; $x <= $photo_count; $x++) { $form['photo_'.$x] = array( '#type' => 'file', '#name' => '...

1  表单选择选项导致“已检测到非法选择”  ( Form select option results in illegal choice has been detected ) 
我有一个表单,用户选择他们提交的日期出现在网站上。我正在填充一个"日期" 字段,如: function mymodule_get_date_options($type = 'start') { $options = array(); $start_week = time(); if (date('...

0  用于评论验证的模块  ( Module for comment validation ) 
我正在学习如何第一次创建一个新模块,所以请和我一起裸露。我正在尝试从头开始添加评论表的验证;它只是没有验证,这意味着我的表格在有意填写主题领域时成功地提交。 这是我的代码: /* * Implementation of hook_form_alter */ function my_module_form_a...

7  搜索API面板显示和上下文  ( Search api panels display and contexts ) 
我正在尝试使用搜索API和面板构建页面。我用上下文创建了搜索视图,但我无法在小组页面中查看任何方面。 我的小块以常规块显示出来,但它们不会出现在面板区域。 我已经能够从此找到有关此问题的信息搜索API问题。显然,视图放置在面板中的方式是问题,如果我在面板中重新订购我的刻面和视图,则面部展示正确。 在此问题的注释#2...

1  如何为主题指定自定义模板?  ( How do i specify the custom template for a theme ) 
而不是page.tpl.php,如何在主题中使用自定义模板?我正在使用禅宗主题。 在Drupal 6中,我们将在 theme_preprocess_page() 中指定它,使用 $vars['template_files'][] 数组。我不知道在drupal 7中使用了什么。 ...

0  困惑关于安装apache solr  ( Confused about installing apache solr ) 
这很尴尬,但我必须开始某个地方,对吧?这对安装Apache Solr的担忧。 我已经看到了在尝试安装 apache solr 时的说明,并且每一个都会使用安装Java开始。我很困惑,因为我正在使用Bluehost for Webhosting( http://drupal.org/hosting )。这是否意味着我需...

0  如何在地图上两点之间获得路径?  ( How get path between two point on map ) 
我想使用一个给我两个点之间的路径的API。我知道纬度和经度的价值。 如何在路径之间获得路径,纬度和经度的点? ...

0  如何将Google +1添加到AddThis按钮?  ( How do i add google 1 to addthis button ) 
我正在使用addthis模块6.x-3.0-beta2,问题是Google +1不会作为其中一个服务。有人知道如何解决这个问题?谢谢! ...

6  如何在视图中制作一个字段是另一个字段的链接目的地?  ( How to make a field in a view be the link destination to another field ) 
我试图在侧边栏上创建广告到我的网站。我创建了一个有2个字段的内容类型; image 字段,以及 link 字段。我现在想在视图中显示广告,通过拍摄图像,当您单击图像时,它将您带来 998887666 字段指定的链接。我知道如何用 HTML 在一个块中执行此操作,但我想通过视图动态地进行。有没有办法来做这个? ...

3  清理节点编辑URL  ( Cleaning up the node edit url ) 
说我有node / 111 /编辑,那个节点的路径是my-node。我想要编辑页面 my-node /编辑,而不是node / nid /编辑。 是否存在用于清理节点编辑URL的现有解决方案,例如,自定义模块或Pathauto模块?所有我所看到的Pathauto模块是一个页面模式的地方,但这只能处理页面视图,而不是编...

0  仅显示某个过滤条件是否不存在视图?  ( A view only shows if a certain filter criteria does not exist ) 
我有一个观点,我正在使用列出事件,特别是"今天的事件" 。我使用过滤条件来允许我只显示正在发生"今天" 发生的事件(如前面的问题。我最近意识到,不一定是一个事件" 今天",如果没有,我有一个问题,因为什么都没有正在显示。我想要的是单独的视图(如果可能的话,只能在当前视图中执行),只有在没有事件中"今天" 是什么,我希...

3  阻止某个用户在用户搜索结果中的开发  ( Blocking a certain user from apearing in user search results ) 
我正在寻找一种方法来排除某些用户(按ID或名称)出现在Drupal 7中的用户搜索结果中。 任何想法? ...




© 2021 it.wenda123.org All Rights Reserved. 问答之家 版权所有


Licensed under cc by-sa 3.0 with attribution required.