Opened 16 years ago
Closed 16 years ago
#11066 closed defect (bug) (duplicate)
Can't integrate Wordpress 2.8.5 with CodeIgniter
Reported by: |
|
Owned by: |
|
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 2.8.5 |
Component: | General | Keywords: | reporter-feedback |
Focuses: | Cc: |
Description
I haven't tried to embed copies of Wordpress before 2.8.5, but I assume previous versions could be 'embedded' using the instructions on this page: http://codex.wordpress.org/Integrating_Wordpress_with_Your_Website
However, I am now trying to use these instructions to embed into a CodeIgniter project, and am getting an error. The error says: Fatal error: Call to undefined method stdClass::set_prefix() in wp-settings.php on line 270 Checking the forums, it seems a number of other users are getting the same error as well. So far, nobody has come up with a workable resolution. There are a number of threads either dealing with this issue directly:
http://wordpress.org/support/topic/326677
http://wordpress.org/support/topic/322313
http://wordpress.org/support/topic/280905
http://wordpress.org/support/topic/322645
http://wordpress.org/support/topic/309873
http://wordpress.org/support/topic/285890
Change History (11)
#1
@
16 years ago
- Summary changed from Can't embed Wordpress 2.8.5 to Can't integrate Wordpress 2.8.5 with CodeIgniter
#5
@
16 years ago
- Keywords reporter-feedback added; embed integrate wordpress removed
Ok I have had a look at this and cannot reproduce using a simple test script here.
Could you provide an example simple script which doesn't work for you?
Here is what I tried:
<?php require('/Applications/MAMP/htdocs/wp-2.8.4/wp-blog-header.php'); $posts = get_posts('numberposts=10&order=ASC&orderby=post_title'); foreach ($posts as $post) : the_post(); ?> <?php the_date(); echo "<br />"; ?> <?php the_title(); ?> <?php the_excerpt(); ?> <?php endforeach; ?>
The implication from the error message is that the $wpdb global is not an instance of the WPDB class.
Maybe some other code is setting this before WordPress tries?
#6
@
16 years ago
Westi: Try again with the require() inside a function..
Ie.
function require_wp() { require('/Applications/MAMP/htdocs/wp-2.8.4/wp-blog-header.php'); }
While it definitely would not be a regression, I can see that this could cause that error due to wp-settings expecting to have global scope rather than local scope.
#7
@
16 years ago
Thanks - Thats what I get for following the codex example to test :-)
That would break a lot of stuff though including WP in inside a function.
#8
@
16 years ago
That would break a lot of stuff though including WP in inside a function.
I agree.. But i can see some people doing exactly that, And it should provide that exact error message :)
I saw that the title was changed to 'Can't Integrate Wordpress 2.8.5 with CodeIgniter'. While technically correct, if you check the referenced forum posts, this is also an issue with CakePHP, Zend MVC, and practically any simple PHP script. It's not an issue with 'CodeIgniter', per se, but is rather a bigger problem than that.