Syndicate

Feed

A brick came into the mail yesterday

I received in the mail my pre-ordered copy of Pro Drupal Development Second Edition yesterday.

The book is a brick. 667 pages with the index.

I am a little disappointed already... To be fair, I had high expectations. The treatment JavaScript and Ajax would receive was the first thing I'd look into.

AHAH is covered but the example provided is lame. It does not cover modifications to a form... Well it does, but you only inject some text in a field of type markup, so you do not need to fiddle with the cached form, or even read anything from it in the callback function. (The callback function is the PHP function that 'writes' the JSON that's returned to the browser...).

The chapter on jQuery provides one additional example module, besides PlusOne. That other module only attaches an additional JavaScript file to the page, using HOOK_init() and a registered theme function. No Ajax.

PlusOne still doesn't does degrade in this Drupal 6 version (see comments below). The book Learning Drupal 6 Module Development provides an example that does degrade. Meaning: without JavaScript, things won't look broken, as they do with the PlusOne module.

The chapter on jQuery explains how to add a function to Drupal.behaviors, but it does not explain how to pass a variable from Drupal PHP to the client-side Drupal.settings namespace. Learning Drupal 6 Module Development does explain this. It becomes important to use drupal_add_js to pass PHP variables over to our JavaScript to always avoid hard-coding certain values in our scripts.

We learned that in Drupal 6 our JavaScript is themable. Example, please? The book provides none.
(Any module's JavaScript file that produces HTML content must now provide default theme functions in the Drupal.theme.prototype namespace.)

The book does not even show one case where Drupal.t() is used. That function should have been mentioned at least.

Coverage of JavaScript best coding practices (such as... use camelCase for 'variable' and function names, etc.) should have found its place somewhere in that second edition, because the Drupal community and this very book are pushing hard for coding standards.

The book Learning Drupal 6 Module Development has its own shortcomings in its treatment of JavaScript due to the timing of its publication probably. By the way, the author of Learning Drupal 6 Module Development, Matt Butcher, has encouraged Drupal.org to update its handbook JavaScript coding standards page, to extend it based on a more thorough definition. Kuddos to him. JavaScript and Ajax are that important. Contributed modules developer (I am part of them) need to follow some conventions.

Last edited by Caroline Schnapp about 5 years ago.

Comments

Do you have the previous edition?

If so, would it be worth buying the new one?

I have the previous edition and it has proved exceedingly useful.

Also, I really rather like what you've done with the Garland theme. All the little tweaks really round it off especially the feed icon/mug.

This is such a great

This is such a great resource that you are providing and you give it away for free. I love seeing blog that understand the value. Im glad to have found this post as its such an interesting one! I am always on the lookout for quality posts and articles so i suppose im lucky to have found this! I hope you will be adding more in the future...
rip dvd to mp4

Thanks for the valuable

Thanks for the valuable information and insights you have so provided here... website

panic away reviews joe barry

panic away reviews joe barry anxiety Great goods from you, man. I have understand your stuff previous to and you're just too wonderful. I really like what you've acquired here, certainly like what you are stating and the way in which you say it. panic away reviews joe barry anxiety You make it entertaining and you still care for to keep it wise. I cant wait to read far more from you. This is actually a wonderful site. the yeast infection no more system

I am a novice in the world

I am a novice in the world of computers and computer programming. In my opinion, with the drupal module, I can be much easier to operate drupal and also download some apps that I can use in my own blog. my site

university apparel Really

university apparel Really impressed! Everything is very open and very clear reason of issues. It contains truly news. Your website is very valuable. Thanks for sharing.

how do you get cancer I

how do you get cancer I have explain a few of the articles on your website now, and I really like your style of blogging. I added it to my favorite’s blog site list and will be checking back soon…

dallas plastic surgeon You

dallas plastic surgeon You completed certain good points there. I did a search on the subject and found nearly all persons will agree with your blog.

wordpress website I have

wordpress website I have visited to this site multiple times and everytime I find beneficial jobs for me so I would suggest please come to this site and take the chance from here.

Merkur online spielen Triple

Merkur online spielen
Triple Chance kostenlos
When a trail doesn’t get much use it is difficult to keep Mother Nature from reclaiming it.

Nice one..

Congress Vice-President Rahul Gandhi on Thursday assured, while addressing a well-attended Congress election rally in Nagaland, an early solution to the decades old Naga problem which would be 'honourable and acceptable to all sections of the people. sonia Gandhi|
Rahul Gandhi||
Priyanka Gandhi

Re: Advertencia

Here I first time came on the site and watched many good articles which was too much informative and Intresting.Please keep sharing.
artswebdirectory
autosmobiledirectory

My first visit to your site

My first visit to your site is been a big help. Thank you for the efforts you been putting on making your site such an interesting and informative place to browse through. http://www.link-building-techniques.com I'll be visiting your site again to gather some more valuable information. You truly did a good jobA good informative post that you have shared and appreciate your work for sharing the information. Got some interesting information and would like to give it a try.

wonderfull

Interesting article on some of the pros and cons of a "surrogate memory". I expect we'll see more of this as technology continues to advance. vegetable nutrient||soil fertility||fertilizer companies

Learn how to operate your

Learn how to operate your drupal application is not an easy thing for me. According to me, to be able to understand the contents of this module does require a lot of understanding and try to apply this application autodidact. Breitling

recreation-and-sports-articles

I Will Be Coming Back Soon, Thanks for posting Some Great ideas and I'll try to return back With A Completely different browser. recreation-and-sports-articles to check out Things! Also, I put a link to your blog at my site, hope you do not mind?

Nice Article

Catering equipment "Quality is our life", we strictly perform full set of quality control and production supervision system, strictly enforces client's agreed specifications to factory actual production. Hotel wares manufacturers

network cabling houston

The site claims that a sending an eight-pound package with prepaid postage will cost the receiver $25.

Great one

Electric panel We are one of the recognized names in the industry for designing, keeping in mind the specific requirements of the clients, and providing an array of Electrical Panels some of which are listed below. These panels are made of good quality materials in accordance with industrial quality standards. Electrical panel

You completed a few fine

You completed a few fine points there. I did a search on the subject and found nearly all persons will go along with with your blog.
Crimson Tide Planet

Great post I would like to

Great post I would like to thank you for the efforts you have made in writing this interesting and knowledgeable article

I wanted to say the same

I wanted to say the same thing, I agree with you!

hi to all.

yoga pants This is really a fascinating blog, lots of stuff that I can get into. One thing I just want to say is that your design is so perfect.

yes but not accepted all terms

The impact of agricultural cropping systems on water and air resources is continually debated.
sizzling hot free || sizzling hot online spielen gratis ohne anmeldung

This post has helped me to

This post has helped me to have another perspective. I am researching this topic for a paper I am writing. Your article provided me great insight of my topic.

good Article

This is excellent. I haven’t even finished reading it yet because I’ve gotten stalled out in the section Electric space heaters||Space heaters

Know a little about

Know a little about jQuery.Yeap. And do not have registered theme function.

wonderful blog

I love your blog so much, and there are just some differences with others’. Hope there will be more wonderful things in your blog. suction strainers manufacturers||suction strainers manufacturers in India

Thanks for the advice.

Thanks for the advice. Really helped me.

Thanks for the information

Thanks for the information. Your feedback is very good and informative. I was amused by your description of the book as a brick. I still remember in 1978 when I received my first calculator. It was just a basic calculator, all that you could do was add, multiply, divide and subtract, yet the calculator came with a manual of instructions, a thick pocket book. Can you imagine any calculator company providing a small notebook as a manual of instruction today. Even MSDos, microsoft used to provide a thick book as a manual of instructions along with it. Both the manual for the calculator as well as the manual for microsoft have disappeared. Possibly the same would happen to your book too.

Coverage of JavaScript best

Coverage of JavaScript best http://e-papierossy.com.pl/en/e-papierosy/94-e-papierosy-gambit-9812.html coding practices (such as... use http://e-papierossy.com.pl/en/e-papierosy/95-e-papierosy-gambit-5412.html camelCase for 'variable' and function names, etc.) should have found its place somewhere in that second edition, because the Drupal community http://e-papierossy.com.pl/en/e-papierosy/96-e-papierosy-gambit-5609.html and this very book are pushing hard for coding standards.

finance

All you need to do is to get yourself enrolled at such gaming network entrances that are offering you with unlimited connected bingo amusements. financearticledirectory.biz On the other hand, you might happen to run across such sites that even need clients to store a specific product usually called as enrollment expense; nevertheless, there are some that are offering the gaming aid all the more free of charge.

Yes I do

I have the previous edition, and it was extremely useful to me as well. I read it from cover to cover.

I have only skimmed this new revision. From what I see here, and although this may be premature of me to say so, I still believe that it's worth getting for someone who has the older edition.

For someone who never read the first edition, then, by all means, do get this book, but you may be interested in also getting your hands on the Other book, by Matt Butcher. If you get both books, read Matt Butcher's book first. The style is much more engaging, and Matt Butcher is thorough, and is a fantastic writer. The style of the other book allows you to learn module development in one long week-end, and none of the examples in the book are contrived.

Thanks

Hi, Caroline. Thanks for your comments. You're the first person I've heard of to receive the 2nd edition.

I wish I had had you as an additional reviewer for the jQuery chapter!

I do think that the Plusone module degrades well. For me, the only difference is that with JavaScript off there is a full page submit instead of AJAX.

Best regards,

John

Great post I would like to

Great post I would like to thank you for the efforts you have made in writing this interesting and knowledgeable article. www.thomsoncatering.com.sg

You're right

I do think that the Plusone module degrades well. For me, the only difference is that with JavaScript off there is a full page submit instead of AJAX.

Oh yeah! My mistake.

The code is different from its earlier Drupal 5 version. I had missed a snippet of code added to it.

There is only one callback function, still, except that it has a different behavior when JavaScript is disabled.

On page 399:

// Check to see if jQuery made the call. The AJAX
// call used the POST method and passed in the key/value pair js = 1.
  if (!empty($_POST['js'])) {
    // This will return results to jQuery's request.
    drupal_json(array(
      'total_votes' => $total_votes,
      'voted' => t('You voted')
      )
    );
    exit();
  }
 
  // It was a non-JavaScript call. Redisplay the entire page
  // with the updated vote total by redirecting to node/$nid
  // (or any URL alias that has been set for node/$nid).
  $path = drupal_get_path_alias('node/'. $nid);
  drupal_goto($path);

Congratulation, and sorry for biting your head off over that one, this is a major improvement over the First Edition.

To get the redirect $path, though, a simple call to url() will provide the alias if there's one. url() or l() — to get the anchor element, are Drupal developers' best friends. See this page: http://api.drupal.org/api/function/url/6.

  $path = url('node/'. $nid);
  drupal_goto($path);

Yes, I got the book rather quickly. Even Chapters Indigo (that sent the book to me, by normal slow mail), marks it as "pre-order" item, still.

I am lucky :-) I was impatiently waiting for it, that's why.

Does the second edition have

Does the second edition have any info on working with Simpletest? I'd love to see more info on that in book form.

Nothing on SimpleTest, no

There is no entry in the index under SimpleTest.

Under Testing and developing code, there is something, but the pages you are referred to show you how to use the Devel module.

Providing 2 callback functions...

The module PlusOne could, alternatively, provide two menu paths mapped to their individual callback function. There would be one callback function for the JSON 'service' and an other for the non-ajaxified JavaScript-disabled-in-the-browser route.

The JavaScript function executed when the DOM is ready could 'bind' a click event-handler to the vote link, an event-handler that would call the JSON service, reading the JSON URL from Drupal.settings.plusone.jsonUrl, for example — provided we set this property on the Drupal JavaScript object using the drupal_add_js function like so:

$path = url('plusone/json/vote/". $nid');
drupal_add_js(array('plusone' => array('jsonUrl' =>$path)), 'settings'):

There is one limitation to this: there ought to be only one voting widget on the page... as it stands now, the module only shows the widget on the page view so we're fine.

We would then avoid reading from the $_POST array to guess whether JavaScript is enabled or not.

Something else I find a little strange

There is no wildcard used for the node id in the path.

HOOK_menu is defined like so:

/**
 * Implementation of hook_menu().
 */
function plusone_menu() {
  $items['plusone/vote'] = array(
    'page callback' => 'plusone_vote',
    'access arguments' => array('rate content'),
    'type'  => MENU_CALLBACK,
  );
  return $items;
}

While the callback function does take a node id as parameter...

function plusone_vote($nid) {
  global $user;
  $nid = (int) $nid;
  ...

I would have used this HOOK_menu implementation instead:

/**
 * Implementation of hook_menu().
 */
function plusone_menu() {
  $items['plusone/vote/%'] = array(
    'page callback' => 'plusone_vote',
    'page arguments' => array(2);
    'access arguments' => array('rate content'),
    'type'  => MENU_CALLBACK,
  );
  return $items;
}

Both ways are perfectly valid

On page 65 of Chapter 4, The Menu System, we read this:

Any additional parts of the path are automatically passed along. [...] Defining page arguments is useful because you can call the same callback from different menu items and provide some hidden context.

I guess the author meant "not defining page arguments" in the HOOK_menu implementation... can be useful.

What percent of the book is new?

The book has a new co-author. I'm wondering if there are perhaps a couple of new chapters that were written by Dries. Hope his name isn't on it just to sex it up.

Dries only wrote the preface

Actually the book has one less author. Matt Westgate is not authoring the Second Edition — although... the Second Edition still reads like the First Edition with updates whenever applicable, so you could say that Westgate is still behind the Second Edition.

Dries still wrote a preface for this book, as he had for the First Edition.

There is obviously new content, as Drupal 6 has new features.

Right off the bat, I see two new chapters:

Chapter 3: Hooks, Actions and Triggers.
Chapter 23: Installation profiles.

Hey Caroline, I can see why

Hey Caroline,

I can see why your expectations may have been a little higher. You seem to have a far greater knowledge of how it all works. You write some pretty good reviews

Regards,

Andrew

Woah Thank you, Andrew

:-)

To be fair... from the converted... for the love of drupal_json

To be fair, Learning Drupal 6 Module Development has a large section (Chapter 5) that provides some really misleading information about the use of JSON. The example seems to be following Drupal 5 methods complete with a reference to Drupal.parseJson. As a Drupal 6 alternative there appears to be the jQuery function getJSON while I've been using good old PHP based echo(json_encode($someArrayVar)). Thanks to your post Using Ajax in Drupal 6 I've been converted to echo(drupal_json($someArrayVar)).

Thanks, my soul seems more pure some how!

Soul more pure...

my soul seems more pure some how!

I totally know what you mean... :-) Simple and elegant code feels like a tidy apartment, and even more than that: a purer soul. No exaggeration.

Now looks who's misleading...

To be clear... $.getJSON is on the jQuery side while json_encode() and drupal_json() are on the Drupal/PHP side. Perhaps my confusion but Learning Drupal 6 Module Development did not make the process clear to me.

As always, thanks your efforts I seem to be going in the right direction now.

By studying drupal, I

By studying drupal, I learned how to operate more optimally. In my opinion, it is a good thing to do so that I can develop a blog that I have a more perfect as I was aiming to develop my blog so that more visited by others. log home builders

Great stuff!

Great stuff!

Well I was going to get it

I had planned on getting this book cheap online, because it is a little outdated nowadays. You aren't the only blogger so far that I've heard bad things about this book from though. I think I'll just have to cut the losses and buy the current edition for a higher price, because I don't think its worth the few bucks I'll save by buying an older edition. Thanks!

I have been seeking

I have been seeking information on this topic for the past few hours and found your post to be well written and having solid information.

I am amazed about your

I am amazed about your writing skills. I have saved your blog and intend on coming back during the next days.

Lots of content

667 pages of content and you're disappointed? Then it really was no good at all!

You made some good points

You made some good points there. I did a search on the topic for quite some time and found most people will agree with what you said. I certainly do.

Superbly written article, if

Superbly written article, if only all bloggers offered the same content as you, the internet would be a far better place..

This was a really

This was a really interesting article. I'm a big fan of this site for quite a while.

crucial aspects

You have mentioned some crucial aspects here! I bookmarked it and will be back to check some more later.

Thanks

Thanks for sharing this article, I will be looking forward to read more of your posts.

Surely Great stuff

You certainly put a brand new spin on a subject that's been written about for years. surely Great stuff, just great.
Himachal Honeymoon Packages | Himachal Pradesh Tour Packages

This is my first time visit

This is my first time visit here. From the tons of comments on your articles,I guess I am not only one having all the enjoyment right here! East Longmeadow MA

rejoice this visit

I’m thoroughly enjoying the appearance and arrangement of your website.

sydney escorts

Learn drupal is something interesting. Although I am a novice in this field and not easy to understand how to operate drupal, but I followed the steps given in stages.

Randeep Grewal

What you say on this page seems quite reasonable and can be applied in practice. I will try to practice the application that you suggest here, but I am a bit confused to enter the codes correctly.

Cool great story bro!

The details is completely modern. I am certain it will eventually most likely guide numerous individuals to crystal clear their concerns. Nice function, make sure you keep writing. web host top

I use this application on a

I use this application on a computer at home, and I think this app could make an appearance on my computer to be better and not boring.

I will use that source code

I will use that source code for my needs. I am sure that I can adapt it somehow after my needs. This is a really nice approach.

I know you are passionate

I know you are passionate about drupal, but is it really worth buying books these days? I mean, you can find these days almost anything you need on the net, especially forums and communities.

The chapter on jQuery

The chapter on jQuery explains how to add a function to Drupal.behaviors, but it does not explain how to pass a variable from Drupal PHP to the client-side Drupal.settings namespace.

The book Learning Drupal 6

The book Learning Drupal 6 Module Development has its own shortcomings in its treatment of JavaScript due to the timing of its publication probably

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <css> <html> <javascript> <mysql> <php> <span> <a> <b> <i> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <sup> <sub> <dd> <del> <blockquote> <img> <q> <p> <div>
  • Lines and paragraphs break automatically.
  • You can enable syntax highlighting of source code with the following tags: <css>, <html>, <javascript>, <mysql>, <php>, <rails>, <ruby>.

More information about formatting options

CAPTCHA
I have to wonder if you're a human spammer or a machine, or less likely someone who cares to leave his or her thoughts behind.