To use Wordpress for developing a web application?

2019-01-23 22:18发布

问题:

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 application but for this project I have being thinking about using Wordpress as a framework for my application, the reason is because wordpress 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 do you think ? should I use wordpress as the core of my application or to use cakephp ?

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.

回答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 app that is the core of what you're building

You can then host them under the same domain, and if you setup the same page structure / CSS for both WordPress and CakPHP 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:

  • WordPress section
  • PHPBB section

This does mean you have to maintain 2 page themes (CSS & HTML) and keep them in line with each other, but 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 CakePHPs 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.



回答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 since 1 year and I am an experienced web developer and software architect +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. Eg: It's 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 Cake, Code Igniter etc. So the non-WP developer community is not aware of what WP 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 WP is quite enough for many purposes...

If you still insist on using an MVC approach you can do it; WP 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 overhad). 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 web site. This is why I go for WP.

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



回答3:

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 admininistration interface for the tables/"pods" content).

If you know a bit of PHP (arrays, objects, 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).



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



回答5:

Maybe this has to be on webapps StackExchange? Anyways.

Wordpress is not a Framework but a CMS, it gives you a system to manage content (Content Management System). If you do not have special needs regarding your application, Wordpress may be the right choice.

If you need php pages to display dynamically loaded content, I think Wordpress is not the thing for you. I suppose you already know how to build web applications with CakePhp, so why not use it? If you think you need a less complicated framework, I suggest Toro (it has nothing to do with frameworks such as Kohana or CakePHP; it is very simple).



回答6:

I think that for this project CakePHP is the best choice, because you already know how to deal with it and if you developed another web applications with it, you can grab some code from there for helping you with the user registration and maybe other parts, so you don't really have to build too much and you'll be able to focus on the main features of the new application.

If you want to learn WordPress more than developing your new app, go for WordPress. It's always good to learn new things.



回答7:

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.



回答8:

I know this is an old question, but I thought I'd post an alternate solution for those wishing to embed a PHP application inside a Wordpress page (thus leveraging all of the CMS goodies of WP without having to mantain multiple frameworks/themes). Basically, all you need to do is turn your app 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

Hope this helps!



回答9:

use cakePHP as the framework and wordpress as the backbone