drupal-7

Drupal 7: Access custom node field in page.tpl.php

左心房为你撑大大i 提交于 2019-12-02 17:44:39
I added a new field "mood" (image) to the page content type. Is there any way to access the image stored in this field in the page.tpl.php? Should be $node = node_load($nid); $node->field_mood[$node->language][0]['value']; There is a new "field_get_items()" function in drupal 7. The $node variable should already be defined in page.tpl so the first line may not be required. This will get the field in the appropriate language. There is also an optional parameter to specify the desired language if needed. $node = node_load($nid); $values = field_get_items('node', $node, 'mood'); if ($values !=

How to generate translation file for a custom Drupal 7 module?

放肆的年华 提交于 2019-12-02 15:58:26
I'm using CentOS 5.5 Linux (without X), PHP 5.3 and Drupal 7.0. The core language of my site is Russian (not English)! I've created a game.info and the following game.module which generates 3 blocks for the front page: function game_block_info() { return array( 'game_main' => array( 'info' => t('Set FlashVars and show the flash game.'), 'cache' => DRUPAL_NO_CACHE, ), 'game_winner' => array( 'info' => t('Show the winner of the last week.'), 'cache' => DRUPAL_NO_CACHE, ), 'game_leader' => array( 'info' => t('Show the leader of the current week.'), 'cache' => DRUPAL_NO_CACHE, ); } function game

Drupal 7 Get image field path

本秂侑毒 提交于 2019-12-02 15:54:48
I would like to get the image path of a field. I'm in a node and I need the Url of image in order to put it as a background-image in inline css. I can't find the solution. Can you help me? To get just the path of an image from it's URI: file_create_url($node->field_image['und'][0]['uri']); More information on file_create_url() can be found here: http://api.drupal.org/api/drupal/includes%21file.inc/function/file_create_url/7 To get the path of an image created using an image style from it's URI use: image_style_url($style, $node->field_image['und'][0]['uri']); More information on image_style

Using JQuery in Drupal 7

三世轮回 提交于 2019-12-02 15:48:30
I'm writing my own Drupal 7 module, and like to use JQuery in it. $('#field').toggle(); But I'm getting this error: TypeError: Property '$' of object [object DOMWindow] is not a function It seems that JQuery is not loaded. Otherwise $ should be defined. Though I actually include it in the header: <script type="text/javascript" src="http://rockfinder.de/misc/jquery.js?v=1.4.4"></script> Do I have to do anything else to activate JQuery in Drupal? Is $ being overwritten by Drupal? That's the website: http://rockfinder.orgapage.de From the Drupal 7 upgrade guide: Javascript should be made

theme_table drupal development

拜拜、爱过 提交于 2019-12-02 13:25:37
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($studentUGentID as $key => $value) { for($i = 0; $i<count($value); $i++) { $tbl_row[] = $value[$i]['value']; }

Put in bold part of description in metatag Drupal module

半城伤御伤魂 提交于 2019-12-02 13:21:45
问题 I'm using Metatag module of Drupal 7. I want to put part of the description in bold . For example, I have the following source code: <meta name="description" content="My new content of web page" /> and I want to put "My new content" in bold. Is it possible? 回答1: This is not possible. The meta-description can only contain text: The value must be a free-form string that describes the page. Even if you’d enter HTML elements, they would just be displayed as text. 来源: https://stackoverflow.com

Username as a path

萝らか妹 提交于 2019-12-02 11:56:50
I would like to have a user's name as a part of a URL, e.g. mysite.com/username. This should redirect to the user profile. I use Profile 2 and Pathauto , but I am not sure how to do this. With pathauto, you just have to configure user paths with a user token, e.g. [user:name] . Pathauto pattern of [user:name] under User paths should do the trick. 来源: https://stackoverflow.com/questions/5961990/username-as-a-path

Virtual Host cannot create with XAMPP server

依然范特西╮ 提交于 2019-12-02 11:00:41
I add the following codes in httpd-vhost.conf file. <VirtualHost *:80> DocumentRoot "C:/xampp/htdocs/mmcast" ServerName mmcast.dev <Directory "C:/xampp/htdocs/mmcast"> AllowOverride All Require all granted </Directory> Although I can run the Apache and MySQL in XAMPP but I cannot call my vhost. I got "Unable to connect" error in when I call mmcast.dev in browser. Do I need to change <VirtualHost *:80> into 81 ? Because I change Listen 81 in httpd file. But, I tried to change 80 to 81 but it still does not work. In httpd.conf file, I change like this but it does not work. <Directory />

How to change image save location in CKeditor Drupal 7?

醉酒当歌 提交于 2019-12-02 10:38:01
I use ckeditor module for my project. In ckfinder folder > config.php, the default image saved folder is ... 'baseUrl' => '/ckfinder/userfiles/', My project folder path is... MAMP > htdocs > drupal > sites > all > themes > bootstrap > images When I upload the image, ckfinder image folder create the location in ... MAMP > htdocs > ckfinder So, the level of drupal theme folder and ckfinder folder is the same.. I don't want to be like this. I want to create the htdocs folder inside the theme folder. ( drupal > sites > all > themes > bootstrap > images > ckfinder folder ). How can I do this ?

Check if term exists and create a node with rules

邮差的信 提交于 2019-12-02 10:08:32
问题 I actually have 2 questions regarding Drupal 7 and Rules.: How to check if a term exists with rules How to make a new node and forward to the node entry with rules Let me sketch the scenario first and then explain in more detail: Im currently creating a simple stock program to be used with a barcode scanner. The barcodes are stored in a taxonomy tree. I have 2 content types, a scan and a product. A user is always presented with the scan content type (one big text input) that the barcode