WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] integrated existing web app into wp (not the other way around) (3 posts)

  1. psychomachine
    Member
    Posted 6 years ago #

    Hi,

    I've been working on a web app (PHP, MYSQL). now i am trying to integrate it with wp. the idea is simple: wp in root directory, application as a subdirectory of the root directory.

    http://www.website.com --> WP
    http://www.website.com/app/ --> webapp served rom root/app subdirectory

    i'd like the webapp's output to be placed in the main content of the page (where normally you'd see posts), but i'd still want WP to be responsible for header, sidebar and footer, as it is in regular wp posts.

    could somebody give me a hint or two how to achieve this? would this be the stuff for a plugin? or just a matter of redirects? i don't know where to start. my web app is fully functioning, but i don't know how to start building the bridge to wp.

    all best,
    tench

  2. Samuel Wood (Otto)
    Tech Ninja
    Posted 6 years ago #

    Use a Page Template.

    http://codex.wordpress.org/Pages#Creating_your_own_Page_Templates

    Basically you're going to make a new PHP file in your WordPress theme. It's going to start like this:

    <?php
    /*
    Template Name: Whatever you want
    */
    ?>

    Then you're going to make a new Page in WordPress (using Write->Write Page). This page will use this Template (look on the right hand side of the page and choose your template). Set the slug for this page to "app", thus giving you the example.com/app/ URL. Your app won't actually be inside the "app" subdirectory anymore, you'll have to move it somewhere.

    Finally, your Page Template will be custom coded to call your application. But before it does that, it'll call get_header(), get_sidebar(), and finally get_footer() to display those things. Other than that, it can run any PHP code you like.

    That's not the only way to do it, but it is perhaps the simplest and most easily customizable to fit into the site properly.

    Other possible ways:
    - Write a plugin that catches the "app" name and redirects it.
    - Make your app include the wp-blog-header.php file and then call the header/sidebar/footer functions from the app itself.

  3. psychomachine
    Member
    Posted 6 years ago #

    dear otto,

    many thanks for your reply -- that's exactly what i needed.

    all best,
    tench

Topic Closed

This topic has been closed to new replies.

About this Topic