Community

How to pull contents from a table and display with drupal?

Hi,
I've just started using drupal. Actually 6 or 7 years ago I came across drupal but it seemed hard to use so I was writing my own php code to do things.

Now it seems everyone is going in this direction and I installed drupal but don't want to add contents from the control panel. I want to use my own contents that are in the same database but in a separate table.

My Questions:
How can I pull data from a table?
How can I use them to be displayed on the screen the way I want them?
Is is possible to manually add my own include ('file.php') and then that file do all my work? is this efficient or drupal has something fancy and powerful to do this?

I can do it with PHP.

Comments

I recommend you to go with

I recommend you to go with "Drupal way". Not to have some kind of subsystem for your existing data. You have a lots of benefits to use standard Drupal nodes/taxonomy/comment ... to handle you content.

To import your existing data you can use Migrate module.

where to start?

thank you f4o,
so where to start?

To import your existing data you can use Migrate module.

Are you saying that I should import my data inside drupal tables?
if so will drupal allow me to display it my own way?
As I see drupal is always showing paragraph with images. How can I use like items or products name, details, price etc from database?

thanks

That is exactly what I'm

That is exactly what I'm suggesting. Do it in Drupal way.

After you migrate your data into drupal tables, you can arrange their display exactly the way you want. You can do a lot inside Drupal user interface. Each data type can be displayed differently. If you want something unique and a little bit more advanced, you can setup your node--[content-type-name].tpl.php file inside your template with html/css/php to get exactly what you need. There are no limits.

Most of what you need to do ...

Most of what you need to do can be accomplished without writing code if you become accustomed to working with Drupal's fielded entities, Views, and the immense body of contributed modules. On those occasions when you do need to write code, the Drupal API is a rich toolkit and should ALWAYS be used in preference to "the way I used to do it." This especially includes forms and database i/o.

Feeds or Migration module

I suggest you look at using Feeds
http://drupal.org/project/feeds

or Migrate
http://drupal.org/project/migrate

These modules will enable you to pull the content from your old database tables into new Drupal nodes. This will be much easier than creating new entities that get their data from your existing content table.