Welcome Guest, Not a member yet? Register   Sign In
Wordpress & Codeigniter
#1

[eluser]Spicer[/eluser]
Hi I am writing a CI site currently that will have a blog page. The rest of the site is a custom app but http://www.example.com/blog will be a wordpress site or maybe some plugin you guys suggest.

I figured out how to get CI to let me run an instance of wordpress instead of calling a controller thanks to mod rewrite. My problem is it sort of forces me to have a separate header, footer, css file for the wordpress and the CI app. This seems annoying.

I am mainly using the wordpress for it wp-admin area, SEO friendly urls, and the many plugins it comes with.

I would like to do something like this in my blog controller.

Code:
$this->load->view("header");

<?php run_wordpress() ?>

$this->load->view("footer");

I looked at some of the blogging solutions for CI and it seems they are all blogging platforms written in CI. I would consider not using wordpress if I could find some sort of CI blogging library.

I know I could write my own blogging library for CI just don't want to reinvent the wheel if someone has a better idea or a solution.

Thanks.
#2

[eluser]Stefano G[/eluser]
Mat, if you want to integrate WP+CI you could do "a trick" like the one I did for my CI website explained on this thread I just had to transform my view layout in a WP template (really 1 hr of work) and it worked nicely... this is the easiest solution, the one you are looking for should be quite complicated!

cheers

Stefano
#3

[eluser]Spicer[/eluser]
Hi Stefano,

Thanks for the response. I think what you are talking about is what I am doing now. If I am understanding this correctly. If you have a set of template files, (for example, view/header.php, view/footer.php, css/site.css) file you would really have to maintain 2 different versions of these template files. One set for CI and one set for Wordpress?

The project I am working on, the header and the footer update often so I would have to edit header-CI.php and then edit header-wordpress.php every time there is a header update.

Am I understanding this correctly?

Thanks.
Spicer
#4

[eluser]Stefano G[/eluser]
Spicer, you got the point... for me it works fine this "dirty" situation because I have done it for MY personal site but I imagine that for the mean client that changes his idea everyday it could be a nightmare to maintain 2 version of the same template!

Maybe another solution could be to select the posts directly from WP database and use the admin backend just to insert/edit them but it could be painful as well.

If you come out with a good solution I think that a lot of people could be interested in Smile

Cheers!

Stefano
#5

[eluser]Spicer[/eluser]
Stefano,

Thanks for the help. Just wanted to confirm there was not an simple solution to this problem that I had not found.

~Spicer
#6

[eluser]Dam1an[/eluser]
Spicer, you could always sym-link the files, so the real files live in either CI or WP, and then the other just references them, so it seem them as real files, but if you edit the CI or WP header/footer, both update
#7

[eluser]Spicer[/eluser]
Dam1an,

I like the idea. I think I am going to do that for the css/javacript but I use a lot of CI functions in my header.php and footer.php that would conflict with WP and the other way around. Thanks.

Anyone know of any prebuilt blog controllers or library that someone has done. I looked at just writing my own blog controller, but to have all the features wordpress has it would be a rather complex controller. I like the wordpress admin but I can live without it. The comments (and controls on comments), the blog user management, RSS feeds, SEO friendly stuff, and much much more are nice and seem like a big beast to try to rewrite.




Theme © iAndrew 2016 - Forum software by © MyBB