background preloader

Drupal

Facebook Twitter

My-portfolio

Shorten. How to create a CCK formatter | manuee – Putting the puzzle together. CCK formatters are pieces of code that allow you to render a CCK field content how you want. In Drupal 6 this basicaly means a theme function. As an example, we will build a formatter for the field type 'nodereference'. This type of field, which is part of the standard CCK package, allows you to "reference" a node inside another. The formatter that nodereference has by default, prints a standard link to the referenced node. We are going to give the users other options, allowing them choose if they want the link to open in a new window or, if they have the popups module activated, that it opens in a jQuery modal window. Let's call our module 'formattertest'. Step 1: Declare our CCK formatters To do this, the only thing needed is to implement our hook_field_formatter_info() in our module: <? It's important to remember that the array keys you use, in our case 'newwindow' and 'popup', will be used later on to construct our functions hook_theme and theme_. 2.

<? 3. <? Conclusion. Mustardseed Media Inc. Add a language switcher link to $primary_links. Last updated October 31, 2007. Created on October 31, 2007.Edited by seanberto. Log in to edit this page. I'm posting this theming snippet that I added to page.tpl.php because it took me so long to debug, given the somewhat complex way that the translations.module api works.

That's not a dig on the module - it's pretty amazing! Basically, I have a English/Spanish site and wanted to add a single menu item to my primary links that switches from English to Spanish and vice versa. The complexity comes in how URLs are translated verses how links to a translated node work. Anyway, perhaps this will help someone build a cool bi-lingual site. This snippet is taken from a zen-based theme I am developing. Looking for support? Cufon your Drupal Theme in 4 Steps | SooperThemes. I love Cufon. It's easy, lightweight and fast. Cufon is scripts that embeds external font files in your webpage and it's gaining popularity rapidly. I see more and more implementations it mostly it just looks impressive. The headings on this site are also Cufon. Heads up: you can familiarize yourself with Cufon+Drupal without doing the work, by downloading the Free sooperthemes.com basetheme. Step 1: Downloading the Cufon package You can download the minified version free of charge.

Step 2: Get yourself a Cufon font Making fonts for Cufon is easy, you can take any TrueType or OpenType font and upload it to the Cufon Generator. Filesize can differ hugely between fonts. They may look great, but is it worth the large download time and resulting flicker that may occur during reading. Download the .js file from the generator to your theme folder.

Step 3: Invoking Cufon The Cufon script doesn't do anything by itself, you need to tell it where to go. Cufon.replace('h1, h2, h3, h4, h5, h6'); Using Views Relationships, Arguments, and Attachments. This article is also available in French from KolossalDrupal. There's an incredible amount of functionality that can be provided by the Views module, especially when it is combined with intelligent use of Node Reference fields. When you relate your site's nodes with Node Reference fields, these relationships can be easily leveraged to create some very useful views. I'm going to build a view for a sample music site. In the site, I have 3 related content types for "Band" nodes ("Black Eyed Peas", "Linkin Park", etc...), "Album" nodes ("Back in Black", "Bat Out of Hell", etc...), and "Events" (concerts, television appearances, etc...)

Each of these content types has only the minimum fields to demonstrate the Views functionality that is the subject of this article. For example, the "Event" content type doesn't have any location or date fields - they can be easily added at a later time. Band Info[Band Name] Albums[Album 1][Album 2][Album 3] Events[Event 1][Event 2][Event 3] Basic Settings Arguments. Via positiva. Articles | 2bits.com, Inc. - Drupal Development, Customization and Consulting.

Nick Lewis: The Blog | Drupal, CSS, Web Development, and the Myriad Iconoclasts.