I\'m planning to develop a web application which will have many static pages (about, help, contact, etc.) and other dynamic pages for the application.
Most of the ti
Here is an alternate solution for those wishing to embed a PHP application inside a WordPress page (thus leveraging all of the CMS goodies of WordPress without having to maintain multiple frameworks/themes). Basically, all you need to do is turn your application into a page template:
<?php /* Template Name: WhateverYouWant */ ?>
/wp-content/themes
folderWhateverYouWant
Use WordPress to make your application, and contact WP-specialist bloggers to feature you as one of the "brave" ones to use WordPress. You could probably get a few good backlinks that way and some publicity.
Many people who back WordPress for any kind of website do so because they are highly invested in it (which happens when you spend a lot of time learning a technology). That's why you get a lot of strong opinions on questions like this. The way I see it, WordPress is just a compilation of a lot of PHP files, and if you know PHP, you know how to use that to your advantage. If it adds value (like you said, it has the membership functionality), without adding too much that is extraneous, then use it. Otherwise, keep it simple with CakePHP.
Use WordPress on the admin side for editing the textual content (and even menus). But use a custom CakePHP app to output that content.
CakePHP can read formatted content straight off the WordPress database tables (or a custom views). You need to define a new database connection and a new model (e.g. Post).
Here's a sample example implementation:
A new database connection in /app/database.php:
class DATABASE_CONFIG {
// ...
var $wp = array(
'driver' => 'mysql',
'persistent' => false,
'host' => 'localhost',
'login' => '<wp username>',
'password' => '<wp password>',
'database' => '<wp database>',
'prefix' => 'wp_',
);
}
A new model in /app/models/post.php:
class Post extends AppModel {
var $primaryKey = 'ID';
// Could define relations
}
Any controller now can fetch the content, e.g.:
class XxxController extends AppController {
function index($postName) {
$this->set('post', $this->Post->findByPostName($postName));
}
}
And the view can simply output the HTML content of the post:
<?php echo $post; ?>
Here is a more elaborate example: http://code.google.com/p/cakephp-wordpress/.
To me the best and the way that worked for me was given on the official WordPress documentation here
I just prepend this following piece of code on all the PHP pages of my application
<?php
require('/the/path/to/your/wp-blog-header.php');
get_header();
?>
And it worked without any glitches.
Also, if you want the WordPress footer, just append
<?php
get_footer();
?>
to those files.
Thanks to @Jesse for showing the way