Hi!
I am building a new site, and have chosen drupal as the cms platform.

I want to use drupal as good as possible, and not just insert my php scripts wherever enable.

My site is a sort of providers yellow pages. I have a list of all countries, when the user choses a country, a list of all available providers is available, with a brief description for each.

When a provider is chosen, a specific provider page is open. With various information available, such as address and contact details, offered services, technology that is in use and so on.

Users can suggest providers(drupal forms?) in a few steps registration.

In addition various articles will be available, but this is a general drupal or any cms feature.

For now, I have an independent system, with database tables, and additional php pages that I intend to use inside of drupal pages.

I need a specific page for every country (Argentina.php, USA.php) and specific providers pages (shinyprovider.php).

How can I design it according to Drupal's vision? Add countries and providers into the vocabulary? Nodes? Any modules I can find useful? Should I develop some new modules(how the hell do I do it?!)

Any help,opinion or reference will be highly appreciated,
Thanks a lot,
Michael

Comments

nevets’s picture

I would write a module, let's call it yellowpages and have it use paths like yellowpages/usa and yellowpages/argentina. At a high level the module will need to implement at least the menu hook to establish the path ('yellowpages') and map it to a callback function. Something like this

<?php

function yellowpages_menu($may_cache) {
  $items = array();

  if ( $may_cache ) {
    $items[] = array(
      'path' => 'yellowpages',
      'title' => t('Yellow pages'),
      'callback' => 'yellowpages_page',
      'access' => TRUE
    );
  }

  return $items;
}

function yellowpages_page($country = NULL) {
	// You would put your real code here
	// This is just so it does something
	
	if ( ! $country ) {
		$output = '<p>';
		$output .= t('Please specify the country you want listings for');
		$output .= '</p>';
	}
	else {
		$output = '<p>';
		$output .= 'Listings for ' . $country;
		$outputn .= '</p>';
		// Change the title to include the country
		drupal_set_title("Yellow pages: $country");
	}
	
	return $output;
}

This is actually a working example, you can make a directory under modules called 'yellowpages' and save the code into a file called yellowpages.module. Then under administer -> modules enable the module. You can then visit http://www.yoursite.com/index.php?q=yellowpages or http://www.yoursite.com/index.php?q=yellowpages/somecountry to see what it does.

To learn more about module develope you can visit the Module developer's guide

rentex’s picture

You should definitely use the builtin category-system (taxonomy) for this project.
Try and understand the taxonomy system and unleash it's true power: flexibility.

In addition there are loads of Taxonomy-module-addons, that might be very practical.

I guess you could just create normal nodes, instead of page.php (the url will then lack the php part).

Tip: When you click on a term above any node, then you'll be redirected to a page that lists several nodes categorized under that very same term.