Welcome Guest, Not a member yet? Register   Sign In
Integration with Wordpress
#1

[eluser]peredurabefrog[/eluser]
I really would appreciate some help on this.

My site has two parts: static/blog pages and data-driven pages. The former are most easily written using a CMS, whilst the latter needs an MVC. WordPress and CI are my preferred tools. What I would like to be able to do is to wrap the MVC part in my WP theme, but I'm not having much (read 'any') success.

I've tried the solutions at:

http://stackoverflow.com/questions/12539...odeigniter

The first:

Code:
require('..path/to/wp-blog-header.php');

works if I change the 'require' to 'require_once', but (as the second solution suggests) returns a 404. So it's not much help.

The second:

Code:
require('blog/wp-blog-header.php');

add_filter('site_url', 'ci_site_url', 1);

function ci_site_url() {
    include('path/to/application/config/config.php');
    return $config['base_url'];
}

header("HTTP/1.0 200 OK");

simply sends the application into an infinite loop, even with a require_once for wp-blog-header.php and even when I replace the custom code in the ci_site_url() function with a hard-coded return value like:

Code:
return 'http://localhost/wlo2admin';

I also tried amending the ci_site_url() function to look like this:

Code:
function ci_site_url() {
    if ( !defined($config))
    {
        include('hard/coded/path/to/application/config/config.php');
    }
    return $config['base_url'];
}

This stops the infinite loop, but returns an error: "Undefined variable: config".

Any help would be very gratefully received. I really don't want to have to repeat all the template coding in the two applications to try to make them look the same if I can avoid it at all.

Thanks in advance


PAE
#2

[eluser]Unknown[/eluser]
Here is the solution that you're looking for:

http://www.bluelayermedia.com/blog/wordp...ntegration
#3

[eluser]peredurabefrog[/eluser]
[quote author="JD45" date="1311369446"]Here is the solution that you're looking for:

http://www.bluelayermedia.com/blog/wordp...ntegration[/quote]

Thanks, I'll take a look at that when I'm back in work on Monday.

Cheers


PAE




Theme © iAndrew 2016 - Forum software by © MyBB