Drupal&常规PHP集成 [英] Drupal & Regular PHP Integration

查看:186
本文介绍了Drupal&常规PHP集成的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在建立一个具有一个核心应用程式和许多内容网页的新网站。内容页面大多是动态的,我需要一种方法来定期管理这个动态内容。核心应用程序的主要功能是3步过程或读取用户数据(输入页面),从MySQL(产品页面)读取数据并将应用程序提交到电子邮件地址(应用程序页面)。



理想情况下,我想在普通PHP中构建核心应用程序,并利用Drupal的内容管理功能。 Drupal和普通PHP可以像我建议的那样集成吗?我的感觉是,将核心应用程序编码为Drupal模块将增加一些复杂性的层,从一开始就难以编码,并且随着系统的成熟而维护 - 所以我真的只想使用普通的PHP。 / p>

让我解释动态内容(由CMS管理)与核心应用程序相交的位置:



因为常见问题数据在正常帮助页面上以及在右侧列中的核心应用程序页面内显示的微型订阅源中使用。在此列中,从数据库中提取3个随机问题,并显示为Feed。当用户点击常见问题时,他们不会被从核心应用程序产品页面带走,而是在显示问题和答案的弹出窗口中显示数据。此外,用户可以通过此弹出窗口中的简单导航菜单浏览其他问题和答案。如上所述,我需要在核心应用程序产品页面上有3个这样的饲料。



因此,这里的理想解决方案是保持简单用于管理动态内容和易于编码的核心应用程序? 普通PHP和Drupal是否可以和平共存?如果是这样,这在技术上是可能的? 因为Drupal管理的某些内容包含在核心应用程序页面中,所以核心应用程序仍然可以在普通PHP中编码?



建议?
谢谢!
Jim。

解决方案

这是我几年前提交的一篇文章的一部分。很遗憾,链接文章已经过去了,但它可能仍然适合您的需求:

将旧式独立PHP脚本导入Drupal系统

Drupal系统是一个非常强大的CMS,但是采取一个现有的PHP网站,并试图强制它在Drupal可能是一件很难做的事情。
将网站转换为Drupal的正确方式是Drupalize,这意味着做一切Drupal方式,这是真正正确的事情 - 但有些情况下并不是每个人都同意



我有一个公司的示例,该公司有许多基于HTML / PHP的网站。他们听说了Drupal的灵活性和强度,并决定这是他们选择革命。但是,另一方面,他们不想改变任何东西,我会尽快做到。



正确的方式做到这一点是打破每个PHP脚本,找到它们,找到共享,使用现有的Drupal模块创建正确的方法,并使用我自己的附加模块完成差距。



不是他们要我做的 - 而是,我寻找一种方法只是将现有的PHP脚本导入Drupal环境。



搜索现有的解决方案带给我概念证明,由 Dan Morrison 。在底部,它使用PHP输出缓冲命令,它收集旧脚本所做的一切,然后将其显示为Drupal模块的一部分。在我的情况下,我不得不做一些小的修改(主要是将请求中的变量传递给相关范围内的PHP),但在底线,它完全符合我的需要。
好​​吧,几乎...在其他情况下,我想从Drupal的Form API享受,我处理不同,正如我将在后面描述。


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 basis. 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.

这篇关于Drupal&常规PHP集成的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆