To use WordPress for developing a web application

11,338

Solution 1

One option to consider is setting up WordPress to serve your static pages (to avoid spending time reimplementing a CMS for this content) and using CakePHP to develop the dynamic application that is the core of what you're building.

You can then host them under the same domain, and if you set up the same page structure / CSS for both WordPress and CakePHP then it should be seamless to users.

A similar example I have is a site running WordPress for content management, and phpBB for a forum, both styled to look the same:

This does mean you have to maintain two page themes (CSS & HTML) and keep them in line with each other, but it does give the advantage of playing to WordPress's strengths of managing static content (about pages) and also time-based content (news articles) with a low time / effort investment, allowing you more time to concentrate on playing to CakePHP's strengths for your dynamic application that is the core of what you're building.

If you mostly use WordPress as it comes without doing much customisation / development, you should be able to get it running pretty quickly with a low learning curve, allowing you time to concentrate on your core application.

Solution 2

I read many of the analysis on towards deciding for a base framework for my next project. Here are the conclusions;

(PS: I am heavily coding in WordPress for the past one year, and I am an experienced web developer and software architect for more than 18 years)

Argument 1 - 'WordPress is a CMS / blog engine, but not an application framework'

It is like saying 'Microsoft is a technology company'.

Which is simply not TRUE. (Yes, Microsoft creates good technology, but it is a marketing company. E.g.: Its competitive edge is not creating the best technology on earth, but pushing what it does successfully on to business decision makers.)

WordPress is a solid application platform and CMS/blog functionality is the default application that comes in the box. I think the main reason why WordPress is under estimated as a development platform 1) custom post types / custom fields functionality is so new; we haven't seen enough applications benefit these features. 2) A very high percentage of the WordPress community is non-technical people (designers, bloggers etc.) compared to other 'low-level platforms' such as CakePHP, CodeIgniter, etc. So the non-WordPress developer community is not aware of what WordPress can really do.

Argument 2 - WordPress is not based on MVC so it is not a credible development platform.

Sorry, but it is not TRUE.

MVC is not new-age religion that everybody should follow. Yes, it simplifies debugging, development with it structural approach to coding. At the end of the day it is an approach (among many others) to make your life easier as a programmer and save you company's valuable investment embedded into your code.

Plugin architecture and theme based UI-logic isolation in WordPress is quite enough for many purposes...

If you still insist on using an MVC approach you can do it; WordPress MVC like plugins.

Argument 3 - WordPress is slow and it is not scalable for high-traffic web sites.

Not true.

Yes, WordPress is slower to render a page compared to your hard-coded PHP code, (due to additional process execution overhead). BUT if you are relying on your code rendering performance in order to high scalability, sorry, you don't know anything about scalability.

WordPress comes with a zillion caching and performance plugins that will deliver a better site performance that you can hardly match with your own effort.

Final conclusion;

I don't want to be the 3,434,533th developer to build a login/password recovery functionality for his/her web site. This is why I go for WordPress.

At the end of the day, our time is limited in this world.

Solution 3

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:

  1. Write you application sans support content (header/footer)
  2. Prepend the following code to your app: <?php /* Template Name: WhateverYouWant */ ?>
  3. Upload it to your /wp-content/themes folder
  4. Create a new page in WordPress and set the page template to WhateverYouWant

Solution 4

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

Solution 5

If you already have the database built, I would probably go with CakePHP because you are already proficient with CakePHP.

But if you are in the process of creating your database, you might want to look into using a WordPress plugin called Pods CMS, which creates custom tables of your own content (called "pods") inside of the WordPress database.

The Pods CMS plugin is heavily supported and there is also a plugin called Pods UI which works in the built-in WordPress Admin (to create an administration interface for the tables/"pods" content).

If you know a bit of PHP (arrays, objects, and loops) Pods CMS is easy to use and you often end up writing less code than if you are just working with the WordPress Codex. There are also helpers to let you write SQL that interacts with the existing WordPress table structure (pages, posts, categories, tags, etc.) which otherwise is a little complicated unless you really study the database.

WordPress also offers something called "custom fields", but this isn't often ideal as it just adds content into the existing WordPress tables. But custom fields work better with a lot of WordPress plugins (for things like feature sliders and widgets) if you really like using those kind of plugins.

All this being said, WordPress isn't the fastest and, depending on your setup (hosting, WordPress cache plugin) you could end up with a really slow site. If you do decide to go with WordPress I would try to get a hosting service that is recommended for WordPress and use a cache plugin to speed things up (like WP Super Cache).

Share:
11,338

Related videos on Youtube

AFT
Author by

AFT

Updated on June 04, 2022

Comments

  • AFT
    AFT almost 2 years

    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 time I use CakePHP to develop any of my applications, but for this project I have being thinking about using WordPress as a framework for my applications. The reason is because in WordPress it will be easy to create the static pages (easy to write the static pages contents) and because the user registration in WordPress already exists (I don't have to build it).

    But on other hand, CakePHP is easy for me, and I will be focusing in building my application, not learning a new framework.

    Let me know what you think. Should I use WordPress as the core of my application or use CakePHP?

    PS: my application will be mainly a search engine using Sphinx to look up large data in a database and display the result for the users and some other easy PHP (dynamic) pages.

    • jondavidjohn
      jondavidjohn over 13 years
      Wordpress is not an app framework, it's a CMS...
    • BoltClock
      BoltClock over 13 years
      WordPress is a Web application in its own right.
    • jondavidjohn
      jondavidjohn over 13 years
      ...which is what a CMS is, a web application.
    • Admin
      Admin over 11 years
      Why not use Drupal? It has both the CMS and web application development capabilities.
  • jondavidjohn
    jondavidjohn over 13 years
    "If you do not have special needs regarding your application..." then it is not an application...
  • Donovan
    Donovan over 13 years
    «Need php pages to display dynamically loaded content»: this is a special need. Otherwise, Wordpress will do the job.
  • jondavidjohn
    jondavidjohn over 13 years
    "display dynamically loaded content" is completely ambiguous and could be used to define exactly what wordpress does.
  • Donovan
    Donovan over 13 years
    Please, read the question. «PS: my application will be mainly a search engine using Sphinx to lookup large data in a database and display the result for the users and some other easy php (dynamic) pages.» This is not what Wordpress does, as far as I know. There's a plugin for Sphinx at Wordpress--but I still think it is a bad idea.
  • chanchal118
    chanchal118 about 10 years
    Please consider to provide more detailed answer with context of current time as this question is 3 years old.
  • Fred Randall
    Fred Randall about 10 years
    Great answer / comment. Wordpress is highly underestimated and is a very powerful tool!