Posts in the “drupal” category

Drupal - How to modify the node/page title for a custom content type

Drupal content type FAQ: How do I modify the node title for the "create" form when I add a new content type?

For my How I Sold My Business website, I added a new, custom content type named "Charity". This allows people who have bought my book to suggest a charity. The problem with this is that I want the Charity node title (also referred to as a "page title") to say "Suggest a Charity", not the default "Create Charity".

Creating new devdaily content types with Drupal CCK and Views

I haven't gotten around to formatting the pages that you'll see just yet, but a cool thing about Drupal is that with the CCK and Views modules, you can very easily create and then display new "content types" on your websites.

For example, I just added the following content types to the devdaily website:

Drupal 6 - The CKEditor is removing/deleting CODE tags

I had a problem using the CKEditor with Drupal 6 where the CKEditor would not display <code> tags properly in the editor, and would then delete trailing spaces after the <code> tag. After some digging around, I finally found that I needed to comment out the following line in the ckeditor.config.js of my CKEditor module installation:

Manual PHP and Drupal 6 web access logging

There was a little funky activity on a client's Drupal 6 website that was hosted at GoDaddy, and without having access to an Apache access log file, I wanted to be able to see what was going on. So I wrote the following PHP code snippet to do some manual logging, and placed it in the Drupal theme's page.tpl.php file:

Help, I can’t login to my Drupal website

Drupal update/upgrade FAQ: Help, I can’t login to my Drupal website after performing a Drupal upgrade!

(Okay, that’s not really a question. But it is a common Drupal problem that might make you panic.)

If you ever happen to upgrade a Drupal website, and then find that after the upgrade you can’t login to your Drupal site, don’t panic, I may have an answer for you.

A Drupal categories block PHP script

A lot of people have written me to ask how I generate the Drupal categories block on this website. There are probably a lot of different ways to generate a Drupal categories block these days, but the way I do it is with the PHP script shown below. (Sorry, I'm too lazy to look to see if there is a new Drupal categories block module/solution; I'm pretty content with what I have.)

A note on using Google Analytics

For a long time I resisted using a tool like Google Analytics on my websites. I don't know exactly why, other than to say I didn't think I needed the information. But these days it's one of the first things I recommend to website customers. Simply put, if you want to be successful -- and not waste your time -- you need to know what pages visitors are looking at when they come to your website, and how they got to your website.

Drupal front page meta tags

Drupal front page meta tags FAQ: How do I get meta tags to show up on the front page of my Drupal website?

After converting my website about living in Alaska to Drupal several months ago, I just realized that I made a mistake on the Drupal front page configuration, and forgot to specify any meta tags on the Drupal front page(!). Looking at it again now, front page meta tags aren't a really obvious configuration setting in Drupal, so I thought I'd briefly describe how to fix this problem.

Drupal 7 meta tags module - latest information

Drupal 7 meta tags FAQ: Is there a meta tags module for Drupal 7? (Or, what's going on with the Drupal 7 meta tags module?)

(Note: This article was last updated on March 24, 2011.)

Drupal 7 meta tags module information

Having just gone through the meta tags process with a Drupal 7 website on February 9, 2011, here's what I know:

Drupal block/view tip - How to insert a block or view into your content area ($content)

Drupal block/view FAQ: How do I insert a Drupal block or Drupal view into my HTML content area ($content)?

There are several different approaches to this problem, depending on what you really want to achieve.

Insert a Drupal view into your HTML content

If you really want to include a Drupal view into your Drupal content, you can use the Insert View filter, as described on this Inserting Views page on drupal.org.

A custom Drupal favicon.ico (Drupal 6 or 7 websites)

Drupal FAQ: How do I set the favicon.ico icon file for my Drupal website?

There are a number of ways to do this, but one of the best ways is through the Drupal admin interface. From there you can upload your favicon.ico file and it won't be clobbered whenever you update your Drupal website.

To add a custom favicon.ico file to a Drupal 6 website, go to Admin > Themes > Settings, which in the case of one of my websites using a version of the Austin theme resulted in this browser path (URI):

Searchable Drupal API function examples

Summary: A Drupal API/functions experiment - A searchable collection of Drupal projects to demonstrate Drupal API function examples.

I just started a new Drupal API examples experiment recently. The basic concept is to make it easier for Drupal programmers to be able to find working, real-world Drupal API programming examples as a way to help document the available Drupal API functions.

Drupal menu nesting problem (module development)

Drupal menu nesting problem: I just had a problem with menu nesting while developing a Drupal 6 module, and thought I'd share the problem and solution here.

The problem was that in developing my Drupal module, I was trying to created a nested menu structure, something like this:

- My App
  - Reminders
    - Add Reminder

Somewhere in the process of developing my module, this Drupal nested menu got out of sync, and my menus appeared in a flat structure, like this:

Drupal 6 SQL insert examples (and syntax)

Drupal 6 SQL insert FAQ: Can you share an example of how to write a Drupal 6 SQL insert statement?

There are at least two ways to write a SQL insert statement in Drupal 6, and I'll demonstrate both of those here.

A Drupal 6 SQL INSERT example using db_query

The first method involves writing an old-fashioned SQL INSERT statement with the Drupal 6 db_query function, like this:

Drupal database configuration files - development, testing, and production environments

Drupal database configuration file FAQ: Is there something I can do to quit having to change my Drupal settings.php file every time I go from my Development Environment to Testing and Production?

Yes! One of the things I didn't like about Drupal when I first started working with it was the settings.php file in the sites/default directory. I thought that was THE database configuration file, and you had to keep changing it when you went from Development to Testing to Production.

Drupal iPhone apps and mobile themes

Drupal iPhone mobile themes, special introduction: In this article I take a quick look at the existing Drupal iPhone themes. The reason I say this is a "quick look" is because none of the themes seemed to work very well out of the box. This is a bummer for me, not only because I have a lot of work to do, but because I normally like to share solutions to problems.

A Drupal jQuery Mobile theme (tutorial)

Drupal jQuery Mobile FAQ: How do I get started developing a mobile Drupal app using the jQuery Mobile project?

In an attempt to create a mobile Drupal iPhone app, I'm currently writing a Drupal mobile app using jQuery Mobile, and although I still have a few kinks to work out, the basics are now working.

A Drupal jQuery Mobile theme - screenshots

Summary: A Drupal jQuery mobile tutorial/demo.

As I wrote yesterday, I just started working on a mobile Drupal app (web app) that uses jQuery Mobile to make the app look and function like a true mobile app. Yesterday's article was about creating a Drupal mobile theme using jQuery Mobile.

I didn't get a chance to work on this any more today, but I thought I'd share a couple of screenshots from this Drupal mobile web app to show you what I'm doing.

A Drupal form textfield example

Drupal form textfield FAQ: Can you share an example of how to create an HTML textfield in a Drupal form (Drupal 6 or Drupal 7)?

Assuming that you're already comfortable with creating a Drupal form, you can create a Drupal form textfield as easily as this:

# an html textfield for our drupal form
$form['first_name'] = array(
  '#title' => t('First Name'),
  '#type' => 'textfield',
);

That code creates an HTML textfield with the label "First Name", as you can see here: