View Full Version : include PHP code (Integrate with Wordpress)
psihoza
10-05-2006, 02:39 PM
I installed eSyndicatPro into root folder of my webserver and Wordpress into /articles, created skins and now those two are well integrated, except one thing: I want to display latest 10 articles from wordpress on homepage of my site. Home page is root category of eSyndiCat. So those two need to show together.
I can query wordpress database, I can connect to wordpress RSS feed and format result... (any other ideas?) but both methods require that I run specific PHP code on just a single page of my directory (index0.tpl).
Is this possible?
psihoza
10-05-2006, 02:52 PM
nevermind, I found the magical {php} tags :)
For those with similar needs... I decided to go with RSS feed and CARP. I'll call CARP aggregator from my index0.tpl and it will pull "latest10" RSS feed from wordpress. CARP caches feeds so performance is no issue here. Customization of look&feel of output is also easy with CARP so wordpress and eSyndiCat will be semplesly integrated. :good:
psihoza
10-05-2006, 09:07 PM
could use help anyway. It's a long shot but it would be appriciated. I read article in Wordpress documentation about including items in other PHP pages (http://codex.wordpress.org/Creating_a_Static_Front_Page). There it says to put those lines of code to make WP functions available
<?php
define('WP_USE_THEMES', false);
require('./wordpress/wp-blog-header.php');
get_header();
?>
I tried to put it in my eSyndiCat template file between {php}{/php} but I get:
errorFatal error: Call to a member function on a non-object in /home/xyz/public_html/articles/wp-includes/cache.php on line 206
any idea how to help to complete PHP newbe?
Michael Hill
10-06-2006, 04:36 AM
Hi,
Try insert your code into php-file...perhaps it will help you.
psihoza
10-06-2006, 08:22 AM
I don't know if I understood you ok but I put the code into wpinclude.php file and then tried 2 methods of including it inindex0.tpl template file:
{php}
include('./path/to/wpinclude.php');
{/php}
{include_php file='./path/to/wpinclude.php'}
both methods produced exactly same results as before.
Dave Baker
10-06-2006, 05:57 PM
Hello psihoza,
The problem with Wordpress seems.
psihoza
10-06-2006, 07:38 PM
but it works in "Normal" php outside eSyndiCat. If I visit include file through my webbrowser then it works. My only guess is that there might be some function with same naming or something in eSyndiCat and WP.
Best I could do is include it through http:
{php}include('http://path/to/wpinclude.php');{/php}
This works but maybe not fastest and most optimal solution. I would like to use Smarty skinning engine custom functions and define some tokens from WP functionality but that method produces yet again same error :(
Cougar
10-07-2006, 10:09 PM
Would you mind posting your url? I would like to see the integration in action as I'm considering doing the same thing.
If you don't want to post it here would you PM me your url?
Cheers!
Mike
psihoza,
Did you ever get it to work?
I'm having the same issue here and can not get it to work.
Could you post your solution here?
Thanks
Happy coding...
Simon Gooffin
02-12-2007, 04:00 AM
Hi issy,
Could you please post errors that you have?
vBulletin® v3.7.0, Copyright ©2000-2008, Jelsoft Enterprises Ltd.