Drupal

mostra solo

Notes  

Come nascondere i Tabs inutilizzati

tags: Drupal  
drupal tags: search   tabs  

Capita di dover nascondere o eliminare alcuni Tabs di navigazione che Drupal o qualche suo modulo offrono di default.

Per farlo in modo pulito senza mettere mano al codice possiamo sfruttare phptemplate e inserire in seguente codice nel file template.php del nostro tema (o crearne uno appositamente in caso non sia già disponibile):


<?php

/**
* Override or insert PHPTemplate variables into the templates.
*/
function _phptemplate_variables($hook, $vars) {
if ($hook == 'page') {

Notes  

Drupal: how to translate single CCK fields values

tags: Drupal  
drupal tags: translations   CCK   Locale  

Out of the box the localization and translation functionalities of Drupal can translate only the titles of each field created with the Content Construction Kit (CCK). Unfortunately at the moment no translation module (Locale, Localizer, i18n) offers direct support for the translation of cck fields, so we have to fix this ourselves.

In order for a string to get translated it must be enveloped by the t() function in the PHP code. We have to do this manually. Currently, your 'Allowed values' list probably looks like:

Apples
Oranges

First you'd better chage it to::

Notes  

Drupal: hide Log Message textarea in node forms

tags: Drupal   php snippets  
drupal tags: user interaction   phptemplate  

If like me you are not a big fan of the Log Message functionality of Drupal (the one that adds a "Log Message" textarea at the bottom of each node form), then here is a small php snippet override to add to the template.php file of your theme to definitely hide the Message Log:

/**
* Override node form and remove "Log message" textarea
*/
function phptemplate_node_form($form) {
  $form['log']['#access'] = FALSE;
  return drupal_render($form);
}

Make a good use of it ;)

Notes  

Collapse contents in Drupal

tags: Drupal   javascript  
drupal tags: blocks   content  
To show and hide contents in Drupal we can use the javascript library in the core and obtain the same effect that we get by default in the collapsible fields of Drupal forms. All is needed is to invoke the script collapse.js in the body of the content (node or block) we are creating:
Notes  

Translate Drupal front page (i18n)

tags: Drupal   php snippets  
drupal tags: translations   i18n  
If you're using the i18n module to translate a website's contents, and you need also to have a specific homepage for each language, here are a couple of ways to get it:

if you use a custom PHPTemplate front page (page-front.tpl.php

you can call the node of the translation corresponding to the language actually in use:
Events  

Drupalcon - Boston 2008

tags: Drupal  
data: 
Mon, 03/03/2008 - Thu, 06/03/2008
Drupalcon Boston 2008

Drupalcon Boston 2008 takes place from March 3, 2008 to March 6, 2008 at the Boston Convention and Expo Center. Drupalcon is the twice-yearly gathering of Drupalers to learn about, discuss & advance Drupal, and to network with other Drupal community members.

Notes  

Fivestar module: auto refresh after vote

drupal tags: single modules   Fivestar   reload  

Fivestar is a little contributed Drupal module that allows you to cast a vote on any content type. I prefer it to other rating modules because it's simple and elegant, and it can be skinned to your likes easily as well.

Drupal XML Taxonomy Files

tags: Drupal   taxonomy   xml  
bulk import taxonomy terms in Drupal

In Drupal is possible to import and export full sets of vocabularies and taxonomy terms via XML. This can save you the time you would need to insert every single term manually.

You will need the Taxonomy XML module and the XML file containing the terms and vocabularies to import.

Install the module, import your file and that's it: your terms are bulk uploaded into the Drupal taxonomy system.

Here's a list of taxonomy XML files ready to be imported into Drupal:

Notes  

Drupal: show content only to anonymous / authenticated users

tags: Drupal   php snippets  
drupal tags: users   contents  

Is very easy to show some contents to anonymous AND some other to authenticated users in Drupal. You'll only need to adapt the following few lines of php to output your content:

<?php
global $user;
if (!
$user->uid) { ?>

    <div>anonymous content here</div>
<?php } else { ?>
    <div>authenticated content here</div>
<?php } ?>

Yep, that easy.

Notes  

How to add destination to URL in Drupal

tags: Drupal   php snippets  
drupal tags: navigation   user interaction  

Ever had the need to redirect your users to a certain page after they perform a particular task (ie: after they are invited to register to the site)?

Doing it is simple:

just translate the link in your PHPTemplate content-type file (es: node.tpl.php) from:
http://www.mywebsite.com/user/register

to:

Add to calendar
Twitter
Add to Technorati Favorites

Featured:

Archives

September 2010
SunMonTueWedThuFriSat
1234
567891011
12131415161718
19202122232425
2627282930
PureDivs Drupal Themes Conversions
PureDivs Conversione Temi Drupal