Embed Wordpress gives error

Permalink 1 user found helpful
Hi,

I need to embed a Wordpress list of posts in a Concrete5 page.

The following code works fine on the same server in a .php file:

require($_SERVER['DOCUMENT_ROOT'] . '/events/wp-load.php');
     query_posts('showposts=100');
     while (have_posts()): the_post();
      echo '<h2>' . the_title() . '</h2>';
     endwhile;


But when I inset it into a Concrete5 page using PHP block I get errors, including:

<b>Fatal error</b>:  Call to undefined method stdClass::set_prefix() in <b>/home/metalaps/public_html/neworleansairlift/events/wp-settings.php</b> on line <b>287</b>


Anyone got any idea why this is happening?

I'd really like to use the Blog module but I can't for this site.

Thanks,

Pat

 
Mnkras replied on at Permalink Reply
Mnkras
i have been having problems with that block as well, if you go to the Dev section you can basically make a block from that it takes 2 seconds, the example block is called hello world.
patgilmour replied on at Permalink Reply
Hi Mnkras,

Thanks for the quick reply.

When you say the Dev section where do you mean? Sorry, I'm just getting off the ground with Concrete5 though I was able to put together a website in just under 2 hours which amazed me:
http://www.neworleansairlift.org/...

Pat
patgilmour replied on at Permalink Reply
Hi,

I reread the above (thanks Mnkras) and went to:
http://www.concrete5.org/help/building_with_concrete5/developers...

where I followed the tutorial for making a block.

I made a block with a simple echo() and it worked fine.

But when I replaced the echo() with the code from above I got the same error.

I also tried putting the code above in a separate file and using an include() but I still got the same error.

So there's something else up - does anyone have any idea?

Thanks, Pat
Mnkras replied on at Permalink Best Answer Reply
Mnkras
hmm there must be something in concrete5 that is messing with it, i would wait a few weeks for the new version of concrete5 and see if that fixes it,

if you want to embed wordpress in your concrete5 site is suggest taking a look at the addon incurl in the marketplace
patgilmour replied on at Permalink Reply
Mnkras,

You just restored m mental health in a few well-placed words.

Thanks you so much - that is exactly what I needed.

Just got to tidy the styling on the blog now.

Thanks!

Pat
Mnkras replied on at Permalink Reply
Mnkras
ah lol i suggest your rate that post above as the answer so other people can find it
ScottC replied on at Permalink Reply
ScottC
i had the same issue, this one is kind of complex really....

I wrote a bridge to concrete5 that pulled in wordpress posts based on urls, which changed mid-beta to where doing this wasn't possible in a scalable re-distributable manner so i abandoned it.

the Loader::db() method will accept a number of args which will allow you to connect to another db..in my case to a wordpress db on the same server, and you can pull in all the data available there as you see fit, then do a $db = Loader::db() to return the db to default settings afterwards.

For one off installs you can basically take a controller single-page or page_type controller and provide a method that will take the "blog_post" argument and look it up via a method in the controller. but i think that method has to be named whatever you want your parameter to be to bridge to these blog posts.

The url mapping is something i haven't looked into for a few weeks so I could and probably am wrong, but hey it reads right ;)
patgilmour replied on at Permalink Reply
Thanks Scott.
I only needed to pull in one multi-post page (no single post pages) so my requirements were pretty simple and icurl does the job just fine.

That said, I'm about to try and link to a custom mysql database of artists I've created and I haven't yet looked into this but the Loader::db() method looks like the place to start so thanks.

BTW, this is my first run with concrete5 and I was blown away by the fact I got an entire site up and running in a couple of hours (barring the blog issue). It ain't the prettiest site in the world but you should have seen it before (and now I don't have to update it for them!):

http://www.neworleansairlift.org/...

Pat