Welcome Guest, Not a member yet? Register   Sign In
Wordpress into a CodeIgniter website
#1

[eluser]Référencement Google[/eluser]
I tried to search in the forums but I didn't found a real answer that solve my simple problem:

I just want in a website to include Wordpress, it does not matters that the backend is separate from the website backend, I also don't need to have interactions between the 2 systems. Really what I need is simple: A tab menu named "Blog" which have the same layout as the rest of the website, so let's call that a Wordpress integration into CI.

Can somebody explain me the steps to achieve this or point me to tutorials?
#2

[eluser]Pascal Kriete[/eluser]
Could you just drop wordpress into a folder - let's call it blog - and then link to that? You will need to copy your template over, but that shouldn't be much of a problem.
#3

[eluser]Référencement Google[/eluser]
I will do that if I don't find another solution, but I wanted first to find a way to have a common header and footer managed by CI (because of the navigation mainly)
#4

[eluser]xwero[/eluser]
I don't know how much dynamic information you have in your footer, header but instead of generating the content on request you could generate it on change. That way you just have to include the footer and header.
#5

[eluser]Référencement Google[/eluser]
Xwero, I didn't understand what you mean
#6

[eluser]xwero[/eluser]
Most of the time you have a mix of static and dynamic components in your view.
Code:
<ul>
&lt;?php foreach($navigation as item){ ?&gt;
<li><a href="&lt;?php echo $item['url']; ?&gt;">&lt;?php echo $item['text']; ?&gt;</a><li>
&lt;?php } ?&gt;
</ul>
This is generating content every time you load the page, if you don't use cache of course.

If in your back end your function to alter the menu items writes the change direct to the view file, and to the database if you want, you generate your content on change. Basically you create your own cache file.

Because those view files are (semi-)static you can include them where ever you want and you know they are up to date.
Now i don't know how to include files in wordpress templates but i guess there will be a way and if all else fails there is always the trusty include function.
#7

[eluser]Référencement Google[/eluser]
Thank you for clarification. That's one way to do yes, but in my case the menus are static and directly included in a template (not included), they only are multilingual (4 languages) and pull the menu name in a CI language file.

I could also retrieve Wordpress posts via RSS (that would make things slow and heavy) or pull directly the posts in Wordpress DB tables, but how would that be easy to do? I am real not sure that would be the best way to do.

I must say also that I am not specially attached to Wordpress. Inktype could do the trick too but the website is already done and I can't change all so easily, there's a lot of forms and a profile management application inside, the client ask me to add a blog to his website, so I am looking for an easy way to do that.
#8

[eluser]elvix[/eluser]
What I've done in the past (for clients) is to create the template in Wordpress, based off a WP page created on a custom theme file (with special text codes to be replaced by CI content). This is a slightly different situation, because the client's site is a blog and the CI app is in a subdirectory.

I then modify my base CI template to pass everything (CI content & data) to a custom render page function, which essentially just does a search and replace, inserting all CI content into different places of the WP page. The final composed page is then passed back to $this->output->set_output().

For inserting snippets, like WP posts, you can do the same thing: create a WP theme file that will generate the content you want in the format you want, and then create a page in WP using that new template. Then have CI include that new WP page with a file include function (curl is often most flexible way).
#9

[eluser]Référencement Google[/eluser]
Elvix, I don't imagine yet how I can do this, but you maybe gave me some ideas. Including in the website directly a Wordpress template could do the trick (first I have to look how the WP templates are generated)




Theme © iAndrew 2016 - Forum software by © MyBB