Answered

if ($variable) not always the same as if ($variable == 0)

Agaric school of coding mistakes lesson of the day

This, when $node->price equaled zero (actually, and significantly, 0.00), did not give the proper result:

        if ($node->price) {
          $default_value = $node->price;
        }

While this did work as expected:

        if ($node->price > 0) {
          $default_value = $node->price;
        }

Moral of the story: don't be lazy.

by Benjamin Melançon
Posted on Sun, 2007-09-16 15:42
in

Ask Agaric: Getting started with Drupal

I have a quick question for you. I have started to play with Drupal as CMS, with plug-ins and themes etc. . . Is there a good resource out there to learn the ropes? Nothing too involved, something like Drupal for Dummies (or for Smart People).

In truth, nothing great-- the documentation is being reworked and that should help.

by Benjamin Melançon
Posted on Sun, 2007-09-16 11:25
in

Taxonomy image with Category.module (Drupal 4.7)

Using taxonomy_image with category module (Drupal 4.7)

This works, but you need to know the direct path to the taxonomy image administration page (not its settings page).

The taxonomy help page - admin/help/taxonomy_image - says to do configuration at 'administer >> categories >> images'

If the Category module is installed, taking over the core taxonomy module's functions, there will be no link to image or images anything in the menu or as a tab.

Instead, you can navigate directly to the taxonomy_image admin page here:

/admin/taxonomy/image

by Benjamin Melançon
Posted on Sun, 2007-09-16 10:47
in

Ask Agaric: Views of comments in Drupal 5

how do I make a view that displays only recent comments made on a certain content type?

This is basic views functionality.

Simply filter by node: type to restrict the view to specific content types.

by Benjamin Melançon
Posted on Sun, 2007-09-16 09:58
in

Ask Agaric: Page not publishing

> I just added a member but it says that it is not public:
> http://example.com/member-organization/council-canadians
>
> please make it public and give me back authorization to publish.

I'll be providing way more detail than necessary in an educational, about Drupal manner...

For this problem simply, when editing the page or creating it in the first place, click on publishing options (right above the Preview/Submit buttons) and select Published, and submit.

by Benjamin Melançon
Posted on Tue, 2007-09-11 10:53
in

Ask Agaric: Unable to edit a page

> I also can't edit this page:
> http://example.com/but-i-can-see-revisions

three users all created 11 weeks 11 hours ago had the role of "submin" -- here they are and their last access.

Not-Agaric Member 3 weeks 4 days ago
Alsonot Agaric 6 weeks 3 days ago
Stillnot Ourfault 11 weeks 11 hours ago

We probably weren't clear enough at all, but submin (borrowing from the modesty, falsely or not, of Subcomandante Marcos) is the user we grant all powers to-- just blindly checking off every box, because that makes it easier for us.

by Benjamin Melançon
Posted on Tue, 2007-09-11 10:26
in

Switch is for equality comparison only, not for greater than / less than

No less than or greater than statements allowed in switch statements?

Apparently not.

comparison operator in switch statement

WRONG! - this syntax caused a parse error

  switch ($value) {
    case '<20':
      return 1;
    case <100:
      return 5;
    case <200;
      return 10;
    case <500;
      return 20;
    case <2000;
      return 50;     
    default:
      return 100;
  }

Again, the above is BAD. It causes this:

by Benjamin Melançon
Posted on Sun, 2007-09-09 21:53
in

Adding CSS IDs and anchor name fragment to a node title in teaser lists

drupal theme node titles for teasers
drupal add anchor to node links on front page, views, and lists

I want to be able to have a link to http://example.com/big-ol-teaser-list-of-drupal-nodes#node-123 so I go to the right space on the page.
I would say what Drupal version I'm using, but I'm ashamed to say it's 4.7.

by Benjamin Melançon
Posted on Sat, 2007-09-08 11:25
in

How to Disable Comments

Agaric's posted this before, this page should be consolidated with another one somewhere else, but people keep asking...

You can disable comments by going to Administer » Content » Content Types, and then on Blog Post (or the content type of your choice) edit it and make sure comments are off by default. You can also turn off comments on a given post (while editing it) under 'comment settings' I think.

by Benjamin Melançon
Posted on Wed, 2007-09-05 08:19
in

Ask Agaric: Why can't I post content? (Login issue)

To a user:

When you have to get the replacement login it's because you'd forgotten your permanent password, and your regular password is wiped out when you use the temporary login. So when you use the link or temporary password to login you have to replace it with the password you want by taking the opportunity to set a new password.

Liz Burbank wrote:
> thanks, but why am i periodically unable to log in and post? i used this
> temporary login just for that reason, i do not wish to change my regular
> password!
>
> on 9/3/07 7:46 PM, Agaric Auto Support wrote:
>

by Benjamin Melançon
Posted on Wed, 2007-09-05 08:05
in