views:

509

answers:

5

Hi guys, I know ASP.NET C# very well. I make a lot of stuff like surveys and custom web applications.

I'm having a lot of trouble wrapping my head around Drupal and figuring out how to do 'special' programmatic things, like searching a list of clients, or creating a web application.

1 - I've been reading books and drupal API but I'm still having a lot of trouble getting started with anything at all. Where does custom code go in respect to pages, modules, snippets...? How do I replicate form X that I did in ASP.NET into a new page in drupal? Etc. It is super hard to wrap my head around Drupal, it seems so large and easy and extensible yet also like it is difficult for me to code. What can you recommend for an ASP.NET application programmer to learn to work with/in Drupal?

2 - Sometimes we write complete ASP.NET applications for clients, and these applications are not indended for clients to go editing them. For example, we will have our entire website in drupal, but inside of that website we will have a place for users to use a special search for database information. We don't want simple website editors and content providers trying to edit this specially coded page(s). How do I handle not wanting clients to edit anything in a Drupal application? Is it handled via page/user permissions? Is the best thing to develop and host an application completely outside of drupal? Is the drupal application it's own drupal instance inside of a drupal website (nested drupals?) ?

3 - Lastly, how do I handle databases? I understand Drupal and PHP are set to work best with MySQL. We have MS SQL databases that are used by multiple applications and would like to use them for new applications as we start using Drupal. For example, we have a Staff directory that feeds ASP.NET reporting application, ASP.NET Staff Listing application, and want to make a new Drupal PHP application that also uses (and perhaps inserts/updates more information into) that database. What is the best/easiest way to handle MS SQL databases and/or MySQL databases being used and updated by multiple Drupal and ASP.NET applications? Would it be easier to have all the applications use the MS SQL databases, or maybe to replicate the databases on MySQL for the Drupal/PHP apps and somehow sync the two databases?

I hope it is alright if I ask multiple related questions in a single post.

+2  A: 

I'm afraid that I don't have any experience with Drupal so I can't offer any insights into your first or second questions, but on the third question:

What is the best/easiest way to handle MS SQL databases and/or MySQL databases being used and updated by multiple Drupal and ASP.NET applications?

If you are going to perform CRUD operations from both your ASP.NET applications and your PHP/Drupal applications, then I would recommend against trying to sync data back and forth between MySQL and MSSQL since this will cause latency problems plus you'll then have to deal with the differences between the two database management systems.

Instead, I would recommend that you look at using stored procedures to control all database accesses. This way you can ensure that all of your database CRUD operations conform to same rules and logic.

Using MSSQL in both ASP.NET and PHP shouldn't be a problem, especially not with the very excellent PDO library that provides a standard interface for accessing a number of popular database management systems. It should allow you to quickly and easily connect with and begin using your MSSQL databases within your PHP applications.

Noah Goodrich
I agree. CRUD and, for that matter, any other database tasks should be wrapped in stored procs. You don't want to have to recompile/redeploy an app every time you make a db change, and you never know when it's going to be necessary to perform the same database op from different code/application/whatever.
David Lively
+1  A: 

rlb,

I've done quite a bit of Drupal and have strong ASP.NET experience. You really need to read up to get your mindset straight. They use layers in an MVC-like fashion that is very foreign to WebForms & ASP.NET MVC developers ... and quite frankly at first seems odd.

Here's a list of things I did to get really, really good quickly:

  1. Get a host like at hostgator for $8 which will let you install Drupal
  2. Get the book Pro Drupal Development for Beginners ... excellent and really covers a lot of areas http://www.amazon.com/Pro-Drupal-Development-Second-Beginning/dp/1430209895/ref=sr%5F1%5F2?ie=UTF8&s=books&qid=1257545528&sr=8-2
  3. Get on the Drupal forums
  4. Be ready to contribute. Drupal has a lot of features, but in the end the best way is to be someone who contributes code back

There are a number of IDEs to consider, but to start a text editor should be fine.

Good luck.

Nissan Fan
+1  A: 

First of all, I think what's important to understand Drupal's limitations, there are things it's not really made for. It's sort of a web application framework but if you're doing a lot of custom work with your own custom datamodelling and stuff, Drupal might not be the most flexible or easily implementable solution to your kinds of problems. A more general framework like for instance Zend Framework might be more suited.

An important lesson in learning Drupal is: don't hack core or other modules. This will make upgrading core or modules very time-consuming. Instead "do like Drupal" and override using hooks. In theming you can also override with hooks, but also in other ways. Overriding is powerful so understand that concept well.

  1. I'd say, pick a way of learning that is your style, screencasts, IRC, hacking, user meetups IRL, books, articles or any combination and look for material on Drupal. Just start mucking around and get a feeling and understanding of how Drupal works. Understanding the jargon is an important part, so what are: nodes, blocks, regions, hooks, modules, themes.
  2. Drupal has a very flexible permission system, and it's probably the best choice to use that instead of making your own. You can write your own modules that add to or alter the behavior of Drupal. So if you want to write a new application that works with Drupal you can write a module performing the functionality the application has to have and make use of all the facilities Drupal offers, including users, the permission system, etc, etc. I don't really understand the last part of your second question "Is the drupal application it's own drupal instance inside of a drupal website (nested drupals?) ?". Drupal is a collection of PHP files on a server that, together with a slew of tables in a database serves request made to it. Multiple Drupal websites (so different PHP files) can reference the same database or parts of it (for example the user table). There's not really an "instance" of a Drupal site, as there's not really an "application". I could of course be too unfamiliar with these terms but I don't think PHP works with "instances" of "applications".

  3. That's a hard problem, afaik Drupal doesn't work with MS SQL, so any connections in that direction you might have to make yourself. I'd also ask around the Drupal forums or on IRC.

Good luck!

Niels Bom
+1  A: 
googletorp
+1  A: 

Some good answers here, so I'll just fill in some brief items.

1 - Learning Drupal: Pro Drupal Development is the best book for this. Getting into the issue queues and interacting with developers is a way to get familiar with specifics. Your question about forms relates to how Drupal handles forms. The FAPI is pretty robust in Drupal, and protects you from security gaffes. Also api dot Drupal dot org is where the code is documented, though there are docs elsewhere. Google is your friend. (On the Drupal site itself, use the native search to get faceted results.)

2 - This is a user permissions issue. You can limit creation and editing permissions based on content type. For access control (read), you will want to use one of the many modules for access control. It really depends upon your use case.

3 - Drupal has the most community support for MySQL, but people run Drupal on MS SQL as well. In Drupal 7, you will likely see much more support for non-MySQL as this release introduces database abstraction.

Probably the worst thing to do is hack around the margins. It really pays to learn the ins and outs of the Drupal basics -- administration and coding -- so that you can truly leverage the power Drupal brings to the table.

And if you're hunting for modules, http://drupalmodules.com is your friend. ;)