Link to home
Start Free TrialLog in
Avatar of Dalexan
DalexanFlag for Afghanistan

asked on

Updating a field with a wysiwyg editor using Drupal?

I have installed Drupal on our internal network and would like to use it to modify fields within our mysql database. I have read and installed CCK but before I dig deeper into this I want to pose this question to see if I'm going in the right direction.

I have a field that I would like to modify in a mysql database on a different server. This field contains HTML that is displayed on a 3rd party application. I simply want to display a wysiwyg editor that loads this fields contents and allows the user to modify and save the field. How can I accomplish this without writing a custom module?

Step 1: user logs into drupal

Step 2: user clicks on a link to modify HTML from the database field

Step 3: Drupal or CCK module selects the field and displays in a wysiwyg
Select value from viewer_text where position = 1

Step 4: user changes the HTML within the wysiwyg and saves
Update value from viewer_text where position = 1

I'm just stepping this out as in how I think this could happen I dont know if this is possible, what modules would I need to install etc...
ASKER CERTIFIED SOLUTION
Avatar of Ultrus
Ultrus
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Dalexan

ASKER

Thanks, That was what I was afraid of. The drupal install is hosted in house and needs to connect to a custom table / non drupal on another server.

Oh well, any help you can give me on writing a very simple module to make this happen?
"Simple" may not be possible. However, here's a few questions to ask and ideas:

Without Drupal, can you connect to your other server's database remotely? Check out php example #2 here:
http://php.net/manual/en/function.mysql-connect.php

If not, proceed no further or: On the other server, try to get it configured to work that way. If you can't, try writing a REST API on that other server unless the data has confidential info or you don't have access to do so...

Maybe try transferring the databases to one server for best ease of use (I know, probably not that easy).

Warning: You'll be running SLOWLY if making MySQL requests from long distance calls on another server.

It looks like Drupal 7 has a nice HTTP request function:
http://api.drupal.org/api/drupal/includes--common.inc/function/drupal_http_request/6

How to make a Drupal module (must read):
http://drupal.org/developing/modules

Let me know if that helps. :)
Avatar of Dalexan

ASKER

Yes, I can connect to the other servers database. These are all in house servers which I have full access to.

There's lots of information in the "How to make a drupal module"

I think I may post another question to get some help creating that module. It should be very simple to do in PHP as a custom module?

Select value from viewer_table where position ='1'

Display the results of this select in fckeditor and allow the user to edit it.

Once the user is done editing it update value from viewer_table where position = '1'
Perhaps that would be another question. However, these might be useful:

TableField (might be just the thing you need?)
http://drupal.org/project/tablefield

and that other Drupal db connect page I mentioned so that you can integrate drupal calls with the db:
http://drupal.org/node/18429

After that, it's beyond my comprehension level for now. Still learning the ropes of module development myself. :)

Best regards,

Chris
Avatar of Dalexan

ASKER

TableField looks like its for building an HTML table on a node dynamically. Its not actually selecting data from a database table and returning it to a node....

I think I can just federate the database/table I need to the local drupal server install to get around remote db connect issues.

I think I will need help with the PHP syntax in coding the custom module to accomplish this.
Ah got it. I wish you success! I'll keep an eye out for answers on your new question as I'm curious about this myself now. I want to create a custom table for an upcoming project, and a handy CCK field would help with that.
Avatar of Dalexan

ASKER

Its best to stick to the short answer for this question " YOU CANT "

Currently there is no module available to tie database tables outside of the drupal database to a form without writing a custom module.