Use the Wordpress Codex in Symfony2 Twig templates

The last couple of months we have been busy developing a Symfony application. Aside of that we developed a Wordpress website. Now I'm busy integrating the Wordpress website into the Symfony application, which I've separated in two steps.

Step 1: Handling the request. Symfony2 or Wordpress should handle the incoming request. This step is important for the deployment structure of the entire application.

Step 2: Including Wordpress into the Symfony2 Twig templates. Because Symfony2 hasn't a CMS out-of-the-box.

The first step went great, I've found a quite good snippet on https://gist.github.com/1170134 and implemented this into the Symfony app.php file. The wordpress installation now lives into the /web directory of the Symfony installation

The second step is a bit harder, and is the part I can't get fixed. The problem isn't solved by installing a WordpressBundle like https://github.com/kayue/WordpressBundle . I tried starting with integrating the Wordpress footer (footer.php of the template dir). My questions:

  • How can I make use of the Codex php functions in the Twig templates? I tried it by following the Cookbook on http://symfony.com/doc/2.0/cookbook/templating/PHP.html Is the method as explained at http://inchoo.net/wordpress/twig-wordpress-part2/ the best solution for making use of the Codex?
  • How can I include and php files into my Twig template? Embedding the footer.php works, but the php does not gets executed. I did add php as rendering engine to my config.yml. I would like to include the Wordpress template footer.php file in my Symfony2 template
  • When above problems are solved, what is lasting for the future is:

    Step 3: Using Twig in the Wordpress template

    Step 4: Using Symfony2 variables in the Wordpress template

    To solve step 3 I've found https://github.com/cordoval/Twig-for-WordPress. What I don't know is or this package is maintained enough to follow the Symfony release pace.

    For step 4 I have not found anything yet. That actually doesn't matter for now, but I could imagine that there are many more people that are strugling with all those 4 steps as mentioned above.

    链接地址: http://www.djcxy.com/p/63144.html

    上一篇: 我应该如何对我的非实施进行验证

    下一篇: 在Symfony2 Twig模板中使用Wordpress Codex