Hi There

Im a Newbie in this Drupal. I just install Drupal and did the configurations.Its up now.But my problem is that I have a Database-driven website flat files(MySQL Quesries within them) that i want to convert to Drupal CMS.

I developed this website with XAMPP(PHP/MySQL) platforms using Dreamweaver as my development Tool. How do I take all my pages and put then is Drupal? Can somebody explain to me on how to do this? Any tutorial of this kind? Please help. I find this Drupal excting...less work for me as a developer.

Please help.
9911782

Comments

aitala’s picture

Hi,

You might want to start here - http://drupal.org/handbook/migrating - and look here - http://drupal.org/handbook/modules/node_import .

Eric

__________

Eric Aitala - f1m@f1m.com
The Formula 1 Modeling Website
www.f1m.com

__________
Eric Aitala - ema13@psu.edu
Penn State

224b8605113373e086cb27708ff301ba18ce394db1996e7e22928e4555e0d20b1b6cecc7f67c9bd9e536cb915779c485

9911782’s picture

Im still confused here...it does not explain clearly to me...

just need to convert all my dynamic webpages to Drupal. Process mentioned here are still confusing me

thanks

aitala’s picture

What you will probably need to do is look at the examples of moving content from the various CMS's to Drupal and see how you would do it with the information in your DB.

Things like titles and body text is pretty obvious, but knowing how to handle nid's (node IDs) and vid's (which can be version ID in the node and node_revisions table but are IDs in the vocabulary and term_data table) .

You'll also need to know how to deal with the various rows in the sequences table as Drupal does not use auto-incrementing primary keys.

Eric

__________

Eric Aitala - f1m@f1m.com
The Formula 1 Modeling Website
www.f1m.com

__________
Eric Aitala - ema13@psu.edu
Penn State

224b8605113373e086cb27708ff301ba18ce394db1996e7e22928e4555e0d20b1b6cecc7f67c9bd9e536cb915779c485

9911782’s picture

Hi

Im a Newbie on developing the websites in CMS. I've just register now on Mambo. I've used PHP5/MySQL to develop my Web-based Application(database-driven application). In this application...we are able to Add/Edit/Delete the records in the Database...these are coded in Back-end using PHP & Javascript. I want to be able to do the same thing even in CMS. How do I do that in Drupal, so far, i am still not clear as to how to fit all this in Drupal.

Can somebody tell me ps?

Thank You
9911782

alihammad’s picture

Ah! I remember those days when I had to convert my site to drupal. It was a nightmare. Especially due to lack of resources available on the matter. But you will be glad to know that it has paid off. Drupal is pure elegance. I'll now explain what I had to do with little code. Don't panic, the php below is pretty simple.

I had two choices i) completely drupify my old site using mysql only and no drupal application framework or ii) completely drupify my old site using drupal application's framework . I chose the second option since it made my life a lot easier, why you ask? Well, because there is a lot of drupal coding done for things that we would have to redo with the option i (its like reinventing the wheel).

I had a website with few content types like books,articles,forums,etc. The first thing I did was install drupal. I downloaded a module called cck (content construction/creation? kit). This module allowed me to develop content types with the field types of my choice e.g. a new content type I created was articles. I created a couple of fields with cck like first name author,last name author,timeline,etc.

Then I retrieved old values from my previous manually created database using mysql/php to drupal database using php/drupal api.

I opened a node from drupal and wrote this php code.

// over here you connect to your old database and retrieve the values like this till the end

	  while ($row= mysql_fetch_array($resultwithlimit)) {

	  $a1 = $row["YourTitlefield"];
	  $a2 = $row["firstnameauthor"];
	  $a3 = $row["lastnameauthor"];
	  $a4 = $row["otherfield42"];
	  $a5 = $row["themistfield"];
	  $a6 = $row["body"];
	  $a7 = $row["field2"];
	  $a8 = $row["wordsvalley"];
	  $a9 = $row["randomfield29"];



$mynode = array();

$mynode['title'] = "$a1";

$mynode['type'] = "yourcontenttype"; // all content types have names which are given at the time of the content type creation. visible at content types page when you drag your mouse over the list of content types

$mynode['name'] = "thenameoftheusersubmittingthepage";//not necessary

$mynode['body'] = "$a6"; // You can remove the body field from your content type if you want.

$mynode['status'] = 1;//stands for published=1 or unpublished=0 content

$mynode['uid'] = 121;//uid is user id, the user id 1 being the id of the one who makes first id after a drupal installation, uid 1 has all prvilleged, make sure your user id comes with all privileges,preferably use userid 1 to save yourself from the hassle.

$mynode['promote'] = 0; // promote =0 doesn't promote the content to the front page , whereas promote=1 promotes the content to the front page

$mynode['comment'] = '2'; // comment 0=off , comment 1=readonly, comment 2=allowed

$mynode['field_friendlytitle'] = array(array('value' => "$a4" ));// field_friendlytitle is the field I presumably created using cck for the content type. Notice how I am filling in the value for field_friendlytitle using array in an array. 

$mynode['field_firstnameauthor'] = array(array('value' => "$a2" ));
$mynode['field_lastnameauthor'] = array(array('value' => "$a3" ));
$mynode['field_fieldIcreatedwithcck'] = array(array( 'value' => "$a9"));
$mynode['field_fieldIcreatedwithcck1'] = array(array('value' => "$a8" ));
$mynode['field_fieldIcreatedwithcck2sjhdshjdj'] = array(array('value' => "$a7" ));

$mynode['format'] = '2'; // inputformat, format=0 means Filtered HTML,format=1 means PHP code , format=2 means Full HTML 


//You can also specify $mynode['nid'] followed by a number which will be the nid but I presume that it wont be of use to you at the moment. Not mentioning it will lead to a sequential auto generation whereas mentioning a static number will overwrite the old content each type you save the node!;




$mynode = node_submit($mynode);
node_save($mynode);

unset($mynode);

}

The two most important functions in this code are node_submit and node_save. You can view how they work at the drupal api website.
http://api.drupal.org/api/function/node_save/6,
http://api.drupal.org/api/function/node_submit

Ali Hammad Raza
WordsValley

9911782’s picture

Thanks a Million Ali

you gave me a vivid idea about Drupal...Do I have to download these noded to my website now? and how do you create those aggregator modules...I mean where in Drupal website? I have a website on my PC already.

alihammad’s picture

First things first, Create a new node be it article , story or your own content type(for which you need cck module downloaded & installed first), choose php filter, copy and paste the code above in the body, give any title in the title field.

Now, make sure that you alter the code according to your own field names and content type. I didn't understand what you meant by "creating an aggregrator module". Could you please clarify further?

Ali Hammad Raza
WordsValley

lastcowboy’s picture

Hi Ali,

you wrote "I opened a node from drupal and wrote this php code."

i am trying to convert my asp.net / mysql site into drupal.

I am unfamiliar with drupal and know a little about php.

What do you mean by open a node from drupal and wrote the php code?

Please advise.

thanks.