Showing posts with label Symfony2. Show all posts
Showing posts with label Symfony2. Show all posts

Wednesday, July 4, 2012

Symfony2 and EXTJS4.1: Load the ExtJS client into Symfony2

I have a JavaScript Client with the following file/folder structure:

./client
./client/index.html --- main html file in the ExtJS architecture where are loader the libs and the resources
./client/app --- folder with the extjs architecture
./client/app/data
./client/app/model
./client/app/store
./client/app/view
./client/app/app.js
./client/libs  --- folder with the external libraries
./client/libs/ext-4.1.0-gpl
./client/libs/jquery-1.6.4
./client/resources --- folder with my resources like, css and images
./client/resources/css
./client/resources/images

After installing Symfony2, copy your JavaScript Client (ie. client) inside the Symfony/web/ so you can access in your browser the Symfony/web/client/index.html without bothering with the assets stuff. The assets are useful for your PHP server business logic, not for your full HTML/JavaScript client.


Thursday, June 28, 2012

Symfony2: The above URL assumes that localhost points to the web directory of your new Symfony2 project

Reading the Symfony2 book, in the "Creating Pages in Symfony2" section in the "The "Hello Symfony!" Page" subtitle. I found an advise:

"The tutorial assumes that you've already downloaded Symfony2 and configured your webserver. The above URL assumes that localhost points to the web directory of your new Symfony2 project. For detailed information on this process, see the documentation on the web server you are using. Here's the relevant documentation page for some web server you might be using:


 - For Apache HTTP Server, refer to Apache's DirectoryIndex documentation.
 - For Nginx, refer to Nginx HttpCoreModule location documentation."

The apache issue consist in being able to access to the same page ussing two different urls, one is the default:

http://localhost/Symfony/web/app_dev.php/hello/Symfony

and the other is the page that the tutorial assumes you have already configured. Note that "Symfony/web"  is missing:


http://localhost/app_dev.php/hello/Symfony

Your can get that configuration going to the file : "apache_installation_dir\conf\extra\httpd-vhosts.conf" and setting the following configuration:



NameVirtualHost *:8082
Listen 127.0.0.1:8082


<VirtualHost *:8082>
  ServerName local.myproject
  DocumentRoot "E:/Programs/windows7/xampp-win32-1.7.4-VC6/xampp/htdocs/Symfony/web"
  DirectoryIndex index.php
  <Directory "E:/Programs/windows7/xampp-win32-1.7.4-VC6/xampp/htdocs/Symfony/web">
    AllowOverride All
    Allow from All
  </Directory>


  Alias /sf "E:/Programs/windows7/xampp-win32-1.7.4-VC6/xampp/htdocs/Symfony/lib/vendor/symfony/data/web/sf"
  <Directory "E:/Programs/windows7/xampp-win32-1.7.4-VC6/xampp/htdocs/Symfony/lib/vendor/symfony/data/web/sf">
    AllowOverride All
    Allow from All
  </Directory>
</VirtualHost>

Note: be aware of changing the routes and changing the port. In my case I preferred to use 8082 port so I could access to the url http://localhost:8082/app_dev.php/hello/Symfony