By swordsman1 on
I am trying to integrate Wordpress into Drupal by following instructions from this website:
http://codex.wordpress.org/Integrating_WordPress_with_Your_Website
This website describes steps for a webpage to use The Loop (http://codex.wordpress.org/The_Loop).
I included the blog header file with the following code:
require('./blog/wp-blog-header.php');
This works in a non-Drupal php page. However, when I use it in a Drupal page (with PHP Code enabled), it displays an entirely blank page.
Does anyone know how to fix this?
Comments
Don't fix it. Integrating
Don't fix it. Integrating Wordpress into Drupal is like integrating your Ford into your Jeep. If you need a car, you choose one, but integrating does not make sense. If you can tell us what you need, we can probably help you decide which is better for your needs.
Why do you want to do this?
Why do you want to do this? That would be the question to answer.
If your answer is "we want most of the site to be on drupal, but the existing blog needs to remain on wordpress", You can install drupal at the root of your site, and install wordpress in a sub-directory or sub-domain and they will co-exist peacefully. If you want them to visually match, you'll have to code identical themes for both systems.
example.com <-- drupal
example.com/nameofblog <-- wordpress
or
nameofblog.example.com <-- wordpress
Sure, that's possible, but
Sure, that's possible, but that is not integration, it's co-existence. The OP is writing about running Wordpress code in a Drupal environment. I cannot imagine a situation where that would be the best solution. Drupal can do anything that Wordpress can, so if you're looking for Wordpress-like behavior in a Drupal site, just learn how to do it in Drupal.
Drupal does not like tokens in menu links
Here's an explanation of why one Might want to do it. I worked with WordPress and Expression Engine (even ASP) before coming to Drupal. I now want to put up a web development site that shows a variety of my skills, just in case someone wants either of those two frameworks rather than Drupal, or they have existing Web sites in those that they want worked on. So, I have installed WordPress into my Drupal site (currently still in local development) in a "wordpress" subdirectory (and themed it to look like Drupal). But I cannot get Drupal to accept a relative URL of "wordpress/" for the link into the folder from the Main menu because "wordpress" is not defined as a Drupal path. Nor would one want it to be, since that would cause a Drupal topic to overlay the wordpress installation, which would never be seen.
Is there some way to use a relative URL (wordpress) rather than a fully qualified URL (http://www.mysite.com/wordpress) to point to a subdirectory installation of another program like wordpress? The reason I ask is that it is friendlier to keep everything relative internal to a site so that all you have to do is FTP the whole shebang up to the server, rather than have to edit the full URL.
Now that I am talking about it, perhaps a base url "token" of some sort might be inserted into the URL.
I tried the following two, but Drupal red-bordered (error) the path dialog box for the menu link when
[site:url]wordpress
[site:url]/wordpress
So Drupal apparently doesn't like tokens in menu URLs.
Any other suggestions (other than just using the full URL that will have to be edited when uploaded)?
Have a look at the .htaccess
Have a look at the .htaccess file. You'll see a comment saying "Pass all requests not referring directly to files in the filesystem to index.php." I think the best method is to add an exception there, telling Apache not to redirect the path 'wordpress' to Drupal's index.php.
It would be a very bad idea to create a 'wordpress' menu callback inside Drupal, because you would be spinning up two CMS'es for each page you visit in the wordpress site. That would be a real performance killer.
IMHO, if you want to show that you're a skilled professional, you should not build things for yourself that you wouldn't build for a client. If a client would ask me to integrate Wordpress in a Drupal site, I would tell him "No. That is probably not the best solution to your problem" (in which the word "probably" is just a matter of being polite).
Thanks
Thanks. I appreciate the info. Unfortunately, I am developing in WebMatrix on Windows (since I have a Windows 7 laptop). This might be considered laziness, but WebMatrix allows quick installation of multiple programs in addition to Drupal, which makes it tempting for putting installing a variety of things, especially if you already have a Windows machine. As you may be aware, WebMatrix uses IIS and an XML "web.config" file rather than .htaccess. Theoretically, I could shift everything over to a WAMP installation, but I'll see if something can't be done with the "web.config" file.
I actually inherited a web site that had WordPress working inside of Expression Engine. The boss insisted on having his own WordPress blog. Needless to say, there was no seemless login or site search. So I would normally say NO to that (and recommend using Drupal forums on a Drupal site), but bosses sometimes insist on things when they are not advisable.
In my case, I don't want to have to create six different web sites to demonstrate six different skill sets. And all I really want is for some Drupal menu links to go into the subdirectories (the Drupal section itself will contain a variety of Drupal projects). It should be pretty clear that one generally does not develop a "real" site that way, but it seems kind of pedantic and "purist" to insist that one should only use Drupal when someone might also want you to fix their WordPress site.
MORE
MORE: After some thought, I believe the best solution is going to be to use SUB domains for the various other CMS options that I want to demonstrate: For example "wordpress.mysite.com" (it requires the same amount of configuration work in either case). You're right that a sub-DIRECTORY might be a trap if you allowed it for a client. Someone on that team might choose "wordpress" as a URL alias and end up creating an overlay over the WordPress subdirectory. I might not do it on my own site, but a client might not know not to do it. So you are right that you wouldn't really want to recommend it for a client, in addition to the other issues of non-integrated login. So I think use of subdomains would be the best solution, for my own site. If I were doing a client Drupal site, I would probably recommend using Drupal's native forums for seamless integration, although being recent to Drupal, I have just begun working with things like that.
.
I don't know much about IIS but I believe web.config should be able to do pretty much everything .htaccess can do. I understand your situation and I trust that you will be able to make the right decisions.