drupal-7

drupal 7 custom schema error datetime

旧巷老猫 提交于 2019-12-23 15:53:16
问题 I have the following schema (generated from an existing table with the schema module (7.x-1.0-beta3) in a custom module. function myproject_entities_schema() { // --------------------------------------------------------------------------------- // MESSAGE // --------------------------------------------------------------------------------- $schema['myproject_entity_message'] = array( 'description' => 'The base table for myproject message instances', 'fields' => array( 'id' => array(

Does anyone know of a faceted search solution for Drupal 7?

人走茶凉 提交于 2019-12-23 12:25:42
问题 Faceted Search module is not being moved to Drupal 7. What are my alternatives? 回答1: The Search API module is new for Drupal 7, and allows you to choose from a variety of backends, including Solr, Xapian, native database and others. It supports faceted search irregardless of which backend is used. 回答2: One option is an apache solr integration http://drupal.org/project/apachesolr or a self written lucene search module. 回答3: I have set a faceted search up in Drupal 7 using the Search API which

Theming Drupal 7's Ubercart “/cart” page

前提是你 提交于 2019-12-23 11:55:15
问题 I'm trying to theme Drupal 7's Ubercart 3 /cart page, but I'm struggling to find the theming function to do so. I believe the right code may be located in template.tpl.php , but I am not sure. Where in Drupal is the code to theme this page? 回答1: Create a new template file and name it page--cart.tpl.php For more information about Drupal theming suggestions: http://drupal.org/node/1089656 (Don't forget to clear the cache after adding the new template file) Another way to use Devel module with

jQuery replace all HTML

Deadly 提交于 2019-12-23 05:05:29
问题 I'm trying to replace all the HTML (including the HTML tags) with another page. What I'm trying to do is having a website acting as an app even when navigating the another page. Here is the code : (function($) { Drupal.behaviors.loadingPage = { attach: function(context,settings) { $('a').click(function(event) { event.preventDefault(); // Create the loading icon // ... $.ajax({ url: $(this).attr('href'), success: function(data) { $('html').replaceWith(data); } }); }); } }; })(jQuery); I've

How to add new fields to user profile in Drupal 7 programmatically

爱⌒轻易说出口 提交于 2019-12-23 04:45:18
问题 I want to develop a module that add fields to user profile in drupal 7, like phone number and CV ... and I don't know how to do that (using Database or using fields API) pls help me. Any clear tutorials will be appreciated. 回答1: Try to follow the following code $myField_name = "NEW_FIELD_NAME"; if(!field_info_field($myField_name)) // check if the field already exists. { $field = array( 'field_name' => $myField_name, 'type' => 'text', ); field_create_field($field); $field_instance = array(

How to add an HTML attribute to a CCK image field

和自甴很熟 提交于 2019-12-23 03:58:27
问题 I am trying to add an attribute of "id="background" to the actual image tag. <?php print render($content['field_bg_image']); ?> I've looked up tons of articles and they are all concerned with hook_form_alter and this is not a form. This is simply just an image field, I just need an ID attribute on it with a value of background. I know I can use javascript but I want to use Drupal and not add any more javascript. 回答1: The image render is run through theme_image_formatter() which doesn't let

How to hide a field on node data entry form in drupal?

自作多情 提交于 2019-12-23 01:18:35
问题 I'm using hook_node_presave to pre-populate taxonomy field with group's audience value. Thus, I'm trying to hide taxonomy field on a node data entry form. I tried hook_form_alter, but it didn't work for me. Is it possible to hide it? 回答1: <?php function mymodule_form_alter(&$form, &$form_state, $form_id) { if ($form_id == 'contenttype_node_form') { unset($form['somefield']); } } ?> This works for me just fine. Just change the form id and key of the form field you are targeting, and the field

How can I migrate a Drupal site to Amazon Web Services EC2?

半世苍凉 提交于 2019-12-22 14:18:35
问题 I have a working local Drupal 7 site (with local MySQL Database), but now I'm trying to migrate it to Amazon Web Services (which is currently running a test Drupal site successfully). I have all of my drupal files in a directory mydrupalsite on the EC2 instance server and the database has been added to the remote MySQL, but I don't know what to do now in order to configure apache to show the new site. What I have tried so far: I added the file in /etc/apche2/sites-available (copied the old

How can I migrate a Drupal site to Amazon Web Services EC2?

好久不见. 提交于 2019-12-22 14:18:04
问题 I have a working local Drupal 7 site (with local MySQL Database), but now I'm trying to migrate it to Amazon Web Services (which is currently running a test Drupal site successfully). I have all of my drupal files in a directory mydrupalsite on the EC2 instance server and the database has been added to the remote MySQL, but I don't know what to do now in order to configure apache to show the new site. What I have tried so far: I added the file in /etc/apche2/sites-available (copied the old

Where is the user's picture stored in Drupal 7?

▼魔方 西西 提交于 2019-12-22 10:38:28
问题 I'm using a SelectQuery object to retrieve and display a list of users, but I don't know where to get the user's picture from. The users table has a column called picture, but the data in there is just an integer. Is the picture stored in a blob field somewhere or is there a link to the picture in another table? 回答1: The image file itself is stored (usually) somewhere in /sites/default/files . The reference to that image is stored in the file_managed table, the picture column in the users