Symfony2 + WordPress

I once asked about the possibility to integrate a symfony2 app into a wordpress page. And I did get a nice response here. I quoted the response here below as well:

What I would suggest is checking to see if you have a route match in your Symfony2 front controller (ex: app.php) and if there is no match, bootstrap and forward to drupal[wordpress].

You’ll want to add a symlink in the/web directory to drupal[wordpress], in order to get this to work. You can then modify your request object to use this directory as it’s web directory, and all routes will be passed through transparently. Stick the code below in drupal’s[wordpress’] front controller:

class DrupalRoutedRequest extends \Symfony\Component\HttpFoundation\Request 
{
    public function getBasePath()
    {
        if (null === $this->basePath) {
            // add your symlink
            $this->basePath = $this->prepareBasePath() . '/drupal';
        }
 
        return $this->basePath;
    }
}
// in app.php
$kernel = new AppKernel('dev', false);
$kernel->loadClassCache();
 
$response = $kernel->handle(\DrupalRoutedRequest::createFromGlobals());
 
if ($response->getStatusCode() != 404) {
    $response->send();
    return;
}
// do drupal bootstrapping / regular front-controller goodness

I hope this helps!

Code Highlighting in WordPress with Symfony2 style

This post is for those blogging on symfony2 and with a self-hosted wordpress.org platform:

Follow these instructions:

install this plugin here http://wordpress.org/extend/plugins/wp-syntax/other_notes/

and also this other plugin

http://wordpress.org/extend/plugins/wp-syntax-hacktify

and download this this stylesheet here

and save it into your wp-content/plugins root folder.

Enable all and use these syntax:

<pre lang="php">
   <?php //your php code or whatever here ?>
and close the pre tag of course ...
<div id="foo">
<?php
  function foo() {
    echo "Hello World!\\n";
  }
 
  $link = $crawler->selectLink('Go elsewhere...')->link();
  $crawler = $client->click($link);
 
  $form = $crawler->selectButton('validate')->form();
  $crawler = $client->submit($form, array('name' => 'Fabien'));
 
// Form submission
$client->request('POST', '/submit', array('name' => 'Fabien'));
 
  // Form submission with a file upload
  $client->request('POST', '/submit', array('name' => 'Fabien'), array('photo' =>'/path/to/photo'));
 
return false;
 
namespace Acme\UserBundle\Entity;
/**
 * @ORM\Entity
 */
class User implements UserInterface
{
    /**
     * @ORM\Column(type="string", length="255")
     */
    protected $username;
 
    // ...
}
?>
{# src/Acme/StoreBundle/Resources/views/Default/index.html.twig #}
 
<form action="{{ path('store_product') }}" method="post" {{ form_enctype(form) }}>
    {{ form_widget(form) }}
 
    <input type="submit" />
</form>
</div>

Subordinate Powerful Symfony2 to Weak WordPress: Part I

I have been trying to integrate powerful Symfony2 to a page under weak WordPress platform.
I was referred to http://codex.wordpress.org/HTTP_API , and i also have read about how to directly using the more base curl commands here http://stackoverflow.com/questions/4932436/retrieve-username-password-parameters-passed-through-curl. However, it seems using the API method is more convenient for now.

So for that i will come back when i am done with my sf2 project and it is ready to be embedded into a wordpress page.

Thanks for reading and provide comments!

Resucitate a Store to 3.8 life 1: Products Image permissions

I have imported product images onto my new WP e-Commerce 3.8 install however the thumbnails of the images were not showing because they were somehow set to a very low level permission.

For that I had to go under the uploads directory and issue a chmod 644 to the images that needed that adjustment, in particular the original images. The other images such as thumbnails etc, did not need the change of permissions.

After I had done that all my images were showing.