0

I'm looking to have a full integration between Zend Framework and WordPress. For clarification, this does not mean I want to use Zend Libraries within WordPress, but rather delegating the page loads for a single site between both systems.

I've done a fair bit of research, I've come across several items, but nothing quite like what I'm looking for. I want to be able to load a page from the MVC if it exists and is available, otherwise load from WordPress or vice versa.

Now, I think I could approach this in a manner of combining the index files of WordPress and Zend Framework. Doing so, I would need to have a type of "check" against the incoming requests to decide which system to hit. I would suppose I would have a something in cache, containing all the Wordpress uri's to check against (that would be updated through a cron job / daemon), if not, serve up the bootstrap from Zend Framework.

Any suggestions would be greatly appreciated.

Peter O.
  • 32,158
  • 14
  • 82
  • 96
wesside
  • 5,622
  • 5
  • 30
  • 35
  • Do it. But please don't complain if that is hard-word and you need to re-write both Wordpress and Zend Framework. – hakre Oct 17 '12 at 18:34
  • Real douchy comment. Keep them to yourself. – wesside Oct 17 '12 at 18:35
  • Oh that was not meant douchy at all, really. Are you actually comfortable with Wordpress and Zend code-base in-and-out? – hakre Oct 17 '12 at 18:36
  • Alright then I apologize, tone gets lost on the web sometimes ;) Honestly, I don't want to integrate this, I would rather just build it, but we have a lot of wordpress lovers around here and honestly I'm tired of people complaining about things not being exactly like wordpress. – wesside Oct 17 '12 at 18:38
  • I can gurantee that at the end, you'l rewrite the 90% of wordpress codes. So in a practical sense, it wouldn't be merging of wordpress and zend. Good luck btw. – itachi Oct 17 '12 at 18:44
  • I just integrated it in 5 minutes, what are you talking about? Pick a minimal theme, and copy your navbar/header into the theme's header.php, and do the same with the footer. Done.Optionally use some .htaccess rules to pretty up the URLs. – Josh Ribakoff Aug 24 '13 at 16:46
  • @JoshRibakoff you should learn to read. – wesside Aug 27 '13 at 21:50
  • Not sure what you're implying. I was able to skin wordpress to "look like" my ZF2 site, which provides a seamless user experience if you aren't worried about integrating the admin panel/comments/etc. I'm simply refuting itachi's statement that to accomplish this you have to rewrite code. I did not rewrite any code. – Josh Ribakoff Sep 03 '13 at 14:07

2 Answers2

2

One thing I can imagine is that you pretest any request. So you send a sub-request with apache to wordpress, and if it's status 404 you delegate the request to zend.

All non 404 requests then need to be delegated (again) to wordpress.

But handle with care. I don't think this is really what you want.

hakre
  • 193,403
  • 52
  • 435
  • 836
  • Not to mention that all typos of users would also be delegated to ZFW in this case. – PeeHaa Oct 17 '12 at 18:39
  • 1
    sure, it's far away from ideal, fragile, bloaty etc. Perhaps it works to just make the 404 theme template of the wordpress theme including Zends bootstrap file ;) – hakre Oct 17 '12 at 18:40
  • heh +1, I wish I could find a decent CMS for Zend. I hate WP. – wesside Oct 17 '12 at 18:44
  • You might need to remove some headers to get that working: http://php.net/manual/en/function.header-remove.php – hakre Oct 17 '12 at 18:47
  • Well, my suspicions were confirmed, Wordpress is still not a solution. – wesside Oct 17 '12 at 19:02
2

If all you're trying to do is have a Wordpress blog on a ZF site, then just put the blog on a subdomain or use mod_rewrite to rewrite all requests to blog/ to Wordpress.

If you're trying to do something more complicated that requires interaction between the two systems, I would suggest you route all requests to ZF (using the standard rewrite rules). Then let ZF decide whether or not it can handle the request, and if not, include the Wordpress index.php and let Wordpress do it's thing. See the answer here for some more detail: Converting a Brownfield PHP Webapp to Zend Framework.

You want to avoid making any changes to Wordpress itself if at all possible, as otherwise upgrading WP will become a painful process.

Community
  • 1
  • 1
Tim Fountain
  • 33,093
  • 5
  • 41
  • 69