开发者

Drupal & Regular PHP Integration

I'm building a new website which has one core application and many content pages. Content pages are mostly dynamic and I require a way to manage this dynamic content on a regular bas开发者_如何学Gois. The core application's main functionality is a 3 step process or reading user data (input page), reading data from MySQL (product page) and submitting an application to an email address (application page).

Ideally I would like to build the core application in regular PHP and leverage Drupal for its content management capabilities. Can Drupal and regular PHP be integrated as I suggest easily? My feeling is that coding the core application as a Drupal module(s) will add layers of complexity that could be difficult to code from the outset and maintain later on as the system matures - so I would really like to just use regular PHP.

Let me explain where dynamic content (managed by the CMS) intersects with the core application:

Dynamic content such as FAQ data is used both on the 'normal' help pages and also within a mini-feed displayed within core application pages down a right hand side column. In this column, 3 random questions are pulled from the database and displayed as a feed. When users click on FAQ question they are not taken away from the core application product page but are instead shown data in a pop-up window displaying the question and answer. In addition, users can browse other questions and answers through a simple navigation menu within this popup. There are 3 such like feeds as I describe above that I require on the core application product page.

So, what is the ideal solution here in terms of 'keeping things simple' for both the management of dynamic content and the ease of coding the core application? Can 'regular PHP' and Drupal co-exist 'peacefully'? If so, how is this technically possible? Because there is some content managed by Drupal contained within core application pages, can the core application still be coded in regular PHP?

Any advice / suggestions? Thank you! Jim.


This is part of a post I submitted few years ago. Unfortunately the linked article is long gone, but it might still be relevant for your needs:
Importing old-style standalone PHP scripts into Drupal system
Drupal system is a very strong CMS, but taking an existing PHP site and trying to force it on Drupal might be a hard thing to do. The "right" way to convert a site into Drupal is to "Drupalize" it, which means to do everything "the Drupal way", which is really the right thing to do - but is some cases not everybody agrees about that.

I had an example with a company that has many HTML/PHP based sites. They heard about the flexibility and strength of Drupal, and decided it is their choice for the revolution. But, on the other hand, they want not to change anything, and that I will do it as fast as possible.

The "right way" to do it was to break each PHP script they have to its pieces, find the commons, create the right methodology with existing Drupal modules, and finish the gaps with my own additional module.

But this is not what they asked me to do - instead, I looked for a way to just import the existing PHP script into Drupal environment.

Searching for am existing solution brought me to a proof-of-concept described by Dan Morrison. In the bottom line it uses PHP output buffering commands it order to collect everything the old script does, and then to display it as part of a Drupal module. In my case I had to make some small modifications (mainly to pass variables from the request to the PHP in the relevant scope), but in the bottom line it did exactly what I needed. Well, almost... In other cases, in which I wanted to enjoy from Drupal's Form API, I handled it differently, as I will describe later on.


It sounds like you are asking about two things:

  1. Including Drupal content in a custom-built PHP application.
  2. Displaying Drupal content in a pop-up window from the PHP application.

There are a number of different levels of integration- if your need is as simple as pulling content into a page then you may be able to simply create a view (http://drupal.org/project/views) with that content from Drupal that you can make available to and then include it in your web app.

If you are looking for a tighter integration between the 2 including sharing of users, sessions, etc... then it is likely also "possible" but would take additional information to understand what you need.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜