Home

Primary links

  • top o the deck
  • Drupal for Beginners
  • about
  • links
  • give me some sugar

Drupal stuff

  • EDAM
  • STARDOM
  • Question Bank
  • Drupal musings
  • Drupal tips
Home

Key stuff on this site

Easy Drupal Admin Manual (EDAM)

SEO, Traffic and Revenue: Drupalace's Online Manual (STARDOM)

Drupal for Beginners

Subscribe to posts by RSS or email

Subscribe to Drupal Ace by RSS feed RSS feed 

Subscribe to Drupal Ace by Email

Donate towards my web hosting bill! Get a great host!

Share and save

Share/Save

Random piece of content

2008 is here: the Drupal Ace to-do list

Manuals on this site

  • Easy Drupal Admin Manual (EDAM)
    • Welcome to Your Site
    • First Steps: Please Read!
      • Understanding These Instructions
      • Important Terminology!
      • Best Practices for Site Admins
    • Super Quick Guide (for the experienced and the brave)
    • Logging In
    • Your Administrator Tools
    • Setting Site Basics
      • Setting Site Information
      • Configuring Your Theme
    • Creating Content
      • Node Types
      • Create a Page Node
      • Create a Story Node
      • Create a Blog Entry Node
      • Making Images and Other Files Available
      • Using Text and Image Editors
    • Organizing Your Content
      • Terms, Vocabularies, and Taxonomy: "Tagging" Your Content
        • Taxonomy Suggestions
      • Menus, Links, and Paths: Navigating the Site
        • Content Paths and URLs
        • Creating Links
        • Working with Menus: Administration Form (Drupal 6)
        • Working with Menus: Administration Form (Drupal 5)
        • Creating Menu Items on the Fly
        • Placing Menus on Your Pages
      • Placing Content on pages
        • Creating a page from a Single Node
        • Creating a page from a List of Nodes
        • Setting the Front Page
      • Working with Blocks
    • Maintenance Stuff
      • Maintenance and Construction Notices
    • Other Fun Things
      • Changing Color of Garland Theme
      • Free Aliases!
  • SEO, Traffic and Revenue: Drupalace's Online Manual (STARDOM)
    • Set a Clear Goal
    • Make a Good Site
      • Put out the Welcome Mat
      • Make Great Content
      • Build a Great Brand
      • Make Navigation Easy
      • Tune Site Performance
    • Drive Traffic
      • Promote your Site
      • Get Found with SEO
    • Build a Community
      • Build an Offsite Community
    • Monitor and Improve
    • One-Page Checklist
    • Drupal and the Blogging Starter Checklist
      • Drupal and the Blogging Starter Checklist, Part 1
      • Drupal and the Blogging Starter Checklist, Part 2
      • Drupal and the Blogging Starter Checklist, Part 3
      • Drupal and the Blogging Starter Checklist, Part 4
      • Drupal and the Blogging Starter Checklist, Part 5
      • Drupal and the Blogging Starter Checklist, Part 6
      • Drupal and the Blogging Starter Checklist, Part 7

Recent comments

  • It worked

    adding $GLOBALS['tempUser'] = $user; worked but I find it worth noting that I had to delete...

  • very good document...

    very good documentation for beginners!!!!!! thanks!!

  • del penitential 62

    strike out abject
    eliminate penitent 5

  • Chat

    Thank you a lot about very beneficial to my work was very useful thank you

  • Drupal Resources f...

    I would start learning from the "Diving In" section above. That links to the good beginners'...

more

answered question

How to stop Drupal from logging error messages to screen?

Submitted by Drupalace on Fri, 2010-05-21 18:19
  • admin
  • Drupal 6
  • security
  • answered question
Question

 

Here's a typical error message that can pop up, for authenticated and anonymous users alike, when Drupal chokes on something:

warning: array_map() [function.array-map]: Argument #2 should be an array in /home/your-directory/your-Drupal-installation/modules/system/system.module on line 1015.

The latter part of the path, modules/system/system.module, is generic to any Drupal setup. But the former part, /home/your-directory/your-Drupal-installation/, refers specifically to your own directory setup. That's obviously useful to the admin (should he for some reason not know the path), but is it wise to be revealing such directory info to strangers?

I can't say offhand what that extra info means to a malicious hacker. But following the general maxim of giving such malcreants no info they shouldn't have, is there a way to stop Drupal from revealing paths in its error messages?

Related URL: 

http://drupal.org/node/803946

Question answer: 

I thought there was a simple setting to handle this, but couldn't recall it. Over on the Drupal.org forums, helpful soul ambientdrup set me straight: the solution is as quick as heading to the Error Reporting settings at admin/settings/error-reporting, and setting errors to write to the log only, not both screen and log. The screen messages are helpful while you're developing a site, but once you launch, it's a good idea to turn them off.

And that's it. My thanks to ambientdrup!

  • Add new comment

How to make Lightbox2 work for Views images and inline images?

Submitted by Drupalace on Mon, 2010-04-19 23:01
  • images
  • overview
  • answered question
Question

This should be very simple for a good Drupaller:

I'm using Lightbox2 on a new site. I've set Lightbox as the handler for Image node settings, via the Lightbox2 "Automatic image handling" settings page (settings/lightbox2/automatic). One click on the "Attached image" of a content node summons a familiar large-size Lightbox image. No problem.

I also have Views displaying a random image node in a block. I'd like a click on that block's image to trigger Lightbox, but nothing happens.

From perusing bits and pieces on drupal.org, my understanding is that I need to:

1) Give the image(s) displayed by Views a unique class; and
2) Specify that class under the "Custom class images" option at settings/lightbox2/automatic .

The HTML currently generated by the site includes the following, for the random image Views block:

<div class="content"><div class="view view-Random-image view-id-Random_image view-display-id-block_1 view-dom-id-1">

      <div class="view-content">

        <div class="views-row views-row-1 views-row-odd views-row-first">

  <div class="views-field-image-image">

                <span class="field-content"><img src="[path to image]image.JPG"  class="image image-preview " width="280" height="210" /></span>

  </div>

That offers plenty of classes to play with. I don't know which should be usable as the trigger for Lightbox, but I've tried them all in the Lightbox "Custom class images" setting – image image preview , field-content, views-field-image-image, everything appearing above – and nothing triggers Lightbox in my Views block.

Am I fundamentally mistaken in my understanding of what I need to do to have a Views-generated image trigger Lightbox?

Related URL: 

http://drupal.org/node/769734

Question answer: 

Yes, I was fundamentally mistaken in my understanding of what I need to do to have a Views-generated image trigger Lightbox.

Re-reading the Lightbox2 settings more carefully, I see the key phrase "Choose how URLs for [such-and-such] images will be automatically handled" repeated for many settings.

Ah, that may be what I was skipping over. Perhaps Lightbox2 is looking for URLs, not certain classes, attached to the images. Going back to the Views settings for my random image block, I found the desired setting under the Fields section, where I had specified "Image: Image" as the field to appear in the View. The settings for that field include the option "Link this field to its node". I had originally left this unchecked, as I don't want clicks on images taking users to a page built on the image node. But, as I soon confirmed, that's not a worry; with a link URL in place on the images, Lightbox2 intercepts those links and performs its magic, opening a big floating image on the same page. Boom!

Now, what about inline images in my general nodes, the ones embedded helter-skelter amidst node text via my WYSIWYG text editor (TinyMCE and IMCE, if you must know)? I was getting no Lightbox2 click love there either. "Ah", I brilliantly surmised after enough tequila, "Perhaps you want a URL there as well, Lightbox2?" Ever so gently, I adorned my inline image with – for lack of a better idea – a link to its actual location in the file system (files/image.jpg or whatever).

"Now you understand me", breathed Lightbox2, and graced my inline with that old popup hoodoo. She/he/it have been like this (crosses fingers) ever since. 

I don't know that the above is the way to best work Lightbox2 into a site, but as a quick solution to what I was looking for, it did the trick for me.

  • 2 comments

How to fix "Access Denied" for visitors?

Submitted by Drupalace on Fri, 2008-01-04 12:08
  • access
  • Drupal
  • answered question

Just as I earlier had a problem with admins unable to access a Drupal site, I had a problem with visitors unable to access a new site. That is, I could see everything fine as admin, but checking from another (non-logged-in) browser, only the default "Welcome to Drupal" content would show up. (Blocks were visible, but links to nodes in those blocks wouldn't reveal anything. In short, visitors could not access any node.)

Click here and read more!
Question answer: 

Once again, the forums to the rescue. Here's the thread that helped:

http://drupal.org/node/134505

And the comment with the solution that worked for me:

http://drupal.org/node/134505#comment-219661

I went to phpMyAdmin, called up my site database, and ran the indicated SQL query. Shazam, things worked!

I'll have to leave explanation to the pros; this is the kind of wizardry that still rings esoteric to my ears. But it did the trick, and I am grateful to solution poster briandelicata, as well as everyone posting in the thread. Great stuff!

(Oh, and one note: Before playing with your database per this solution, be sure to BACK UP THE DATABASE!)

More notes 

Here's a claim that the taxonomy_access module can cause the problem too: http://drupal.org/node/239951 

  • Add new comment

How to change a node's type?

Submitted by Drupalace on Sat, 2007-12-15 00:05
  • Drupal
  • answered question

Hide your eyes, conservatives: it's a node-change operation, the shocking switch from Blog Entry to Page, or Story to Review, whatever your desires demand. Call it a miracle or call it a travesty, modern Drupal science makes it possible... and seductively easy.

Question answer: 

I'll answer this question as quickly as I ask it – because I just tested it out while moving Drupally questions of various breed into a single node type on this site, the node type called "Drupal Questions" I created for my Question Bank. (It's a nice CCK-created node type with fields for the question, for the answer if available, and for a related URL.)

I had an old blog entry on a certain Drupal puzzle, and thought that node should be reworked into a Drupal Question. I was prepared to simply copy its content into a brand new node. But lo, that blog entry had a couple of comments, and I'd hate to lose those. How would I also move the comments from the old node to the new node I'd be creating? I dunno.

Hmm, a better idea: instead of making a new node, how about transforming the old blog entry node into a new type? I seemed to recall a module claiming that transfigurational wherewithal...

And here it is: Nodetype. http://drupal.org/project/nodetype

I downloaded the module and, before touching anything else, backed up my site database! That done, I installed Nodetype. It offers no admin options, and only shows up when you edit a node: you see a simple drop-down list of node types into which you can change the current node (complete with nice warning to only change the node type if you "know what you are doing"!)

In my case, I selected my custom node type "Drupal Questions" from the list. Doing a Preview of the node showed no changes, but hitting Submit put the change into effect. It worked great, and – the thing I was most hoping for – left the node's comments attached and intact. Nodetype, you swinging switch-hitter, you're all right by me!

You can see my results here:

http://www.drupalace.com/blog_entry_trick_bin_hiding_node_title_2007_07_03

That node was a Blog Entry but is no longer; only its URL alias hints at its original configuration. (Kind of like the Adam's apple on "Lucy" in that Phuket night clu... no, the Ace is speaking too much here. Full stop.)

Now, I haven't used Nodetype enough to give out any handy tips, but the following safety procedures would seem wise:

1) Back up your database before dabbling in node DNA like this.

2) Your target node type may have different fields from your original node type, and I would imagine that data gets lost when a field gets dropped. Copy all major text field data from your original node before changing its type, to avoid loss.

3) Experiment first with a dummy node, if you really want to be safe before operating on the real thing.


If you've ever agonized over what node type to use for some piece of content, worried about getting "stuck with" the wrong decision, you can relax a bit with Nodetype in your arsenal. Bring out the tranny in your nodes! Good stuff.

  • 9 comments

How to display date and time?

Submitted by Drupalace on Fri, 2007-12-14 16:50
  • Drupal
  • PHP
  • answered question

How does one display the current date and time on a Drupal site?

Related URL: 

http://drupal.org/comment/reply/199982

Question answer: 

Time for this newbie to take the plunge, and touch... oh, sweet mother of mercy... touch PHP!

A Drupal.org forum visitor asked about displaying the date and time on a site. I know there are countless ways to do this using web technologies, including any number of "widgets" available out there. For all I know, there may be a Drupal module that tosses up a block or something, too.

But I know this is the sort of task one can also do easily using PHP, the real guts of Drupal (well, part of the guts, anyway... maybe the pancreas). And it should be easy, too. So as a farewell to my... ahem... chastity with regards to PHP, let me take this oh-so-newbie challenge upon myself.

Google turns up all kinds of stuff. Like this couldn't-be-more-basic, one-size solution: http://www.totallyphp.co.uk/code/display_date_and_time_with_php.htm

Besides some code comments, there's just one line of key code there:

<?php  echo date("l, F d, Y h:i" ,time()); ?>

Let's try! I make a new block... turn off rich-text input (TinyMCE)... select PHP as my input format... and paste in the code. I save the block and make it display... and there it is, to the left! Stupendous!

Now, that's the barest of starts; I'll add more to this page as I play with more formatting and other options. (Like time zones: that's pretty important!) But wow, I'm now PHP-experienced and it didn't hurt at all. Before long I'll be up for CSS/HTML/PHP themeing three-ways til the break of dawn. Mmm, break out the mango love butter.

  • 3 comments
  • 1
  • 2
  • next ›
  • last »

Learn Drupal, hands-on

Get the beginner-friendly ebook that teaches community site building via a live case study.

Drupal 6 Ultimate Community Site Guide

Read the review

Drupal mini tip

Site visitors seeing your ugly error messages on the screen (along with details of your Drupal installation path)? Once your site goes from dev to launch, you probably want to have errors recorded in the log but not splashed across the screen. Head to the handy Error Reporting settings found at admin/settings/error-reporting. 

It's a deal!

Dreamhost dealsDrupal Ace presides over his domain, proudly ensconced in his DreamHost eyrie. Won't you join me?

Promo code deal!

Just enter the code 49ER when you register for an account, and save $49 off the already-low price. No strings!

Read my hosting service review

Powered by Drupal, an open source content management system

Copyright 2007 and forever after. Made with Drupal, of course. On OS X, of course. Served up by DreamHost. DreamHost

RoopleTheme