Bookmark Us
User login
Video Tags
Recent blog posts
- cck & taxonomy
- Dynamically execute all Drupal cron jobs for an entire server
- Creating a view to show all nodes that exist in user's Organic Groups using argument handling code in Drupal 6
- CCK select option html entity issue
- Create an admin settings page for your module
- user warning: Got a packet bigger than "max_allowed_packet" bytes
- Creating a multipage form using the Forms API
- Defined Variables Scope Tip
- Load a CCK node $form object using drupal_retrieve_form
- Restrict which roles can modify node taxonomy
Navigation
Blogs
cck & taxonomy
Drupal provides two methods for adding structured data to a node.
The first is the out-of-the-box Taxonomy module. Taxonomy allows you to associate a vocabulary with a content type. When creating or editing the node, you are invited to choose a value for the vocabulary from its associated list of terms. In essence, you are associating a structured field with your node. The name of the field is the name of the vocabulary and the value is the selected term.
The second method is the CCK module. The terminology of CCK is less confusing. Using CCK you define fields and associate these with a content type. When creating or editing the node, you are invited to set values for the associated fields. There are a few obvious differences between Taxonomy and CCK
Dynamically execute all Drupal cron jobs for an entire server
You may have a lot of Drupal sites installed on the same server. Instead of creating a cron job for each individual site, you could write a script like this to loop through your sites and execute each cron job automatically. Here's the script I created using PHP, lynx, and find:
Creating a view to show all nodes that exist in user's Organic Groups using argument handling code in Drupal 6
I recently created a view to show all the nodes that exist in a user's organic groups. I originally created the same view in Drupal 5 by adding the filter "OG: Post in User Subbed Groups" is equal to "Currently Logged In User". Unfortunately, I could not find the equivalent filter in Drupal 6 Views, so I decided to use arguments. Argument handling code is structured a differently in Drupal 6:
1) add a new argument
2) for "Action to take if argument is not present" choose "Provide default argument"
3) for "Default argument type" choose "PHP Code"
4) for "PHP argument code" I entered:
return MYMODULE_views_group_nids();It's a personal preference of mine to NOT insert code into my database, so I added the previously called function into a module. IMHO, code belongs in subversion so it can be versioned properly, not in a database. Here's my function definition:
CCK select option html entity issue
I recently created a CCK node that had a few select fields. For some of the allowed options, I used "<" and ">". For example:
lessThanZero|<0
zero|0
greaterThanZero|>0It appears that the html entities were being escape too many times, because the select options contained:
<
>When I viewed the source of my page, the actual HTML was:
&lt;
&gt;Until this issue is resolved, I decided to add a piece of code to my module to correct the issue. The preprocess functionality of Drupal 6 allows you to modify data on its way to your theme, much like the _phptemplate_variables() function in Drupal 5.
Create an admin settings page for your module
Here's a code snippet to show you how to create an admin settings page for your module. In this example, I'll create a form that allows the user to enable/disable checkboxes for each node type. This might be useful if you wanted to modify the functionality of a node and allow the user to choose which nodes.
user warning: Got a packet bigger than "max_allowed_packet" bytes
I just the following error when loading a large cck node form:
user warning: Got a packet bigger than 'max_allowed_packet' bytesYou can resolve this error by adding a line to your /etc/my.cnf MySQL configuration:
[mysqld]
set-variable = max_allowed_packet=32M
Creating a multipage form using the Forms API
Recently I've been struggling with creating a multi-step CCK node form in Drupal 5. I was able to implement a solution that used a combination of form_alter and jQuery, but due to the amount of jQuery, it was too slow. I then attempted the same functionality in Drupal 6, but due to the number of changes in the Forms API, I decided to take a step back. Here's my first successful attempt at creating a multi-step form using a Drupal 6 module and the Forms API. The following code adds the ability to jump to any step of the form, save at any point, and dynamically creates steps based on the number of fieldsets. My next step will be transposing this code to work with a CCK node form.
Popular content
- WAMP + phpBB Forum Software (4,850)
- Install Free Message Board PHP Script (3,150)
- Add external Javascript and CSS on Friendster (... (662)
- PHP Tutorial : Making a comment system without... (593)
- User Signup Page using PHP and MySQL (541)
- Thing Thing 4 Trainer (516)
- Automatically generate meta keywords from a node... (473)
- PHP Tutorials : Login and Register : User... (416)
- Create Remember Me Login using PHP and Dreamweaver (374)
- Access and Modify User Profile using PHP and... (323)
- API GDATA (316)
- Affiliate Link Cloaking Using PHP Redirect (308)
- Basic CSS Tutorial (307)
- 1. Simple PHP Code and the WAMPserver (304)
- WAMP + phpBB Forum Software (280)
- Joomla! Tutorial - Email configuration for RSForm... (273)
- Oracle APEX Tutorial 3 - Creating a Drilldown... (264)
- Zend Framework tutorial 1 MVC basics (261)
- Dynamically resize image dimensions using jQuery (259)
- Create Dynamic Table using PHP and Dreamweaver (247)
- Create User Login using PHP and Dreamweaver (245)
- Flash CS3 AS3 Contact Form with PHP parser -... (239)
- Changing Link Color Using Dreamweaver (235)
- JForms (A WYSIWYG forms component for Joomla 1.5) (234)
- How to open all external links in a new window... (217)
- About Us (210)
- drupal fckeditor wysiwyg in 7 minutes (206)
- Flash WYSIWYG Open Code Rich Text Editor Tutorial... (203)
- PHP Tutorials: MySQL (Part 1) (196)
- Insert data Into Mysql Using PHP - Tutorial (193)
- Create Photo Gallery using PHP and Dreamweaver (190)
- How to make a maze game in Flash CS4 (188)
- PHP - MySQL - Flex 3 Client-Server Application (187)
- PHP-SYSLOG-NG webinstall (185)
- Progress Bar : ajax php (183)
- XAMPP - Make your Computer a Webserver: Apache,... (181)
- REC #94 Cascading Style Sheets level 2 CSS2... (179)
- Drupal Tutorial - Building A Yahoo Answers Clone (179)
- Create Master/Detail pages using PHP and... (177)
- Update- uCoz Site .... What about Webs (176)
- Drupal Tutorial - Breadcrumbs (176)
- PHP Tutorial 1 : Beginners Basics (175)
- Drupal Tutorial - Theming Search Results (175)
- DMC Tutorial - How To Make A Link In Same Page... (175)
- Using Kompozer The Best Free WYSIWYG Editor (174)
- PHP Screenshot Class Demostration (173)
- PHP MVC Introduction - FUSE Model View... (172)
- HTML Tutorial 1 (171)
- Drupal 6 Cache API Example / Tutorial (171)
- scripting tutorial -Css & Html 1_4 (170)
Search This Site
Tags in source
Today's popular content
- WAMP + phpBB Forum Software (4,441)
- Install Free Message Board PHP Script (2,899)
- Add external Javascript and CSS on Friendster (TUTORIAL) (535)
- PHP Tutorial : Making a comment system without SQL. (534)
- User Signup Page using PHP and MySQL (495)
- Thing Thing 4 Trainer (441)
- Automatically generate meta keywords from a node's taxonomy terms (413)
- Create Remember Me Login using PHP and Dreamweaver (324)
- API GDATA (289)
- Basic CSS Tutorial (243)
- PHP Tutorials : Login and Register : User Registration (MySQL) Part 2 (233)
- Affiliate Link Cloaking Using PHP Redirect (223)
- Access and Modify User Profile using PHP and Dreamweaver (219)
- WAMP + phpBB Forum Software (208)
- REC #94 Cascading Style Sheets level 2 CSS2 Specification (174)






















Recent comments
8 hours 43 min ago
2 days 8 hours ago
5 days 10 hours ago
1 week 6 days ago
2 weeks 4 hours ago
2 weeks 6 hours ago
2 weeks 6 days ago
3 weeks 13 hours ago
3 weeks 6 days ago
4 weeks 1 day ago