Solved

How to make an MVC app fit into wordpress

Posted on 2014-10-12
2
183 Views
Last Modified: 2014-10-13
I have an MVC application which we need to show inside of wordpress.
In other words, we'd like it to fit nicely into the standard wordpress look and feel.

Can this be done and if so, what should I be looking for in order to accomplish this?
0
Comment
Question by:projects
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 70

Accepted Solution

by:
Jason C. Levine earned 500 total points
ID: 40376292
Can this be done

Yes.

and if so, what should I be looking for

There's lots of different ways to go and the exact answer would require a fairly intimate knowledge of the MVC app, so this is, by necessity, a broad answer.

The two easiest ways to integrate non-WP content into a WP site are:

1) Bring the WordPress theme elements into a non-WordPress page
2) Use a custom page template to call/execute your custom code.

For #1, the code would look like this:

<?php
require('../wp-load.php'); // make sure this points to the WordPress Core properly
get_header();
?>

Your other stuff here

<?php get_footer(); ?>

Open in new window


For #2, go to your theme files and copy page.php to a new file (page-whatever.php) and then edit it to add the MVC calls and other code from there.

For both of these solutions, the biggest issues you will have will be the WordPress environment conflicting with the MVC environment.  For example, WordPress doesn't allow access to $_SESSION by default but your MVC might need it.  So to get around this, you would have to add session support to WordPress via functions.php:
add_action('init', 'session_manager');
function session_manager() {
    if (!session_id()) {
        session_start();
    }
}

Open in new window


There will be other conflict, usually related to variable scoping.  Good luck.
0
 

Author Closing Comment

by:projects
ID: 40378715
Thank you, this says it all perfectly.
0

Featured Post

Report: Liquid Web beats Amazon, Rackspace & More

A study by performance analyst firm Cloud Spectator finds that Liquid Web beats rivals Amazon, Rackspace and DigitalOcean when it comes to website and cloud application performance.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Node.js 11 82
Update Set Column Query Not Working as Expected 6 46
phpmyadmin memory error 55 96
Code planning methods/tools? 5 58
I imagine that there are some, like me, who require a way of getting currency exchange rates for implementation in web project from time to time, so I thought I would share a solution that I have developed for this purpose. It turns out that Yaho…
Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
The purpose of this video is to demonstrate how to set up an RSS Feed on a WordPress Website. This will be demonstrated using a Windows 8 PC. Feedburner will be used for this demonstration. Go to your WordPress login page. This will look like the…
The purpose of this video is to demonstrate how to set up basic WordPress SEO. This will be demonstrated using a Windows 8 PC. The plugin used will be WordPress SEO by Yoast. Go to your WordPress login page. This will look like the following: myw…

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question