views:

46

answers:

3

Hi, (I've posted this on the drupal forum too btw)

I'm converting the company websites to use Drupal, or at least trying to check that its going to be the best way forward. I have a background in PHP development, and I'm currently using the CakePHP framwork. I've built this site (not my design) and I can see how to replicate most of the functionality using Drupal, most likely using the CCK module.

http://preview.tinyurl.com/yk6u8mt

As you can see from the homepage:

  1. A user chooses a country.
  2. The country is passed using an ajax call to a script that decides which phone is best based on 'in country' network coverage.
  3. A div is shown recommending the visitor the best phone for that country.

I'm wondering how to go about this in Drupal, I'm definitely not after a step by step guide, I just want to know if this kind of thing is possible with Drupal, and what approach to use.

If someone can help that would be superb. Thanks.

+1  A: 

I would look into using CCK and views. you can set up filters for the views. If filters don't work, you have the ability to include php code. I have also successfully added jquery code in the header of a view through which I was then able to have my view filtered by what is typed in a text box.

czuroski
A: 

Coming from CakePHP using Drupal is a pain in the a** - even more for developers.

It's application structure might be designed to ease extensibility but this only means you have a system to enable your own plugins and themes.

While modules are basically the M+C-part the themes are the V-part of an MVC-application. The problem is that this seperation is not very strict in Drupal - in fact you have to break it sometimes in order to make things work (e.g. you have to include a theme_mymodule_myfunction() into your module as default output which you then can override with your theme using mytheme_mymodule_myfunction() ) And don't even bother looking for classes ( see http://drupal.org/node/547518 ).

Also there is no real link from a module to a theme. On many occations this is a good thing as you can switch modules and themes seperatly without creating a problem. For application builders coming from CakePHP (or any other framework) you often feel a lack of "wholesomeness" - you create parts for a base software and have to live with it's drawbacks.

IMHO I wouldn't recommend this step. Drupal is fine if you have to manage a website and might add a few modules to add neccessary value (image gallery etc.) but I definetly don't recommend it as a base for a customized web-app.

stefan
I fully understand were you're coming from stefan, but at the moment the benefits are outweighing the drawbacks
Pickledegg
+1  A: 

Okay, so you've got a path you're defining in hook_menu, which is where your form is being presented - or else you've got it set up as a webform in a node, that could work too.

Either way, in your form you're going to be using AHAH - check out http://api.drupal.org/api/drupal/developer--topics--forms_api_reference.html/6#ahah and http://drupal.org/node/348475 .

Basically, you're going to define another path in hook_menu that's of type MENU_CALLBACK, and which will receive the country as input, and then will return the div that you'll display on the screen.

One core example of AHAH that may be useful to you is where you're entering a password and it lets you know if the password is secure enough - check that out.

Edit: There's also some good examples at http://drupal.org/project/examples.

John Fiala
this sounds interesting, will have to dig into the docs and see if i can fathom it. Thanks ;)
Pickledegg