Archive

Posts Tagged ‘symfony’

Website not found by Google

January 12th, 2009

Last week I wanted to check how our latest project, Traiteur Patrick Costers, was doing in Google. The first result was the portfolio page here at CryptoNet. So far so good? I would rather have my clients url at first place than our project page. But this was the beginning of a long quest. Not one url was found in Google.be (Dutch):

traiteur-patrick-costers-in-google

traiteur-patrick-costers-in-google

I did a quick research in Google Webmaster Tools and where I found that the website wasn’t accessible by the Google bot. I fired up the local version on my notebook, expanded the Symfony debug toolbar and indeed, the HTTP headers responded with a 404 Not Found. Appearantly  I was forgotten to change the error404 action in the settings.yml. So I changed it to:

.actions:
default_module:         default   # Default module and action to be called when
default_action:         index     # A routing rule doesn’t set it

error_404_module:       default   # To be called when a 404 error is raised
error_404_action:       error404  # Or when the requested URL doesn’t match any route

In the executeError404() action of the default module, I did a forward to the index page. The HTTP headers returns a lovely 200 status on the homepage and a 404 one on the non existing pages.

To speed up the Google process, I added a xml sitemap to my Webmaster Tools. What do you do to enhance the “let Google find my new project”-process?

Programmatie , ,

Symfony project 1.0 upgrade to 1.1

November 16th, 2008

One of our biggest webdesign and development projects, an online gaming community named X-Power.be, is in need for a total makeover. I think it’s more then one year ago since we planned to make a new version: 4.0. We started developing in Symfony 1.0.x, but in the meanwhile Symfony 1.1 and 1.2 came out. Time to start planning some upgrade tasks!

I’ll give you a (hopefull) quick overview of my upgrade steps. I will perform the upgrade from 1.0.18 to 1.1.4. Later on I will make a second post for upgrading the 1.1 to 1.2.

Let’s start the process:

  1. Follow the nice upgrade tutorial on the Symfony website. I could copy the steps in this blog post, but we developers want to keep everything central :)  Just make a few changes to a couple of files, and launch the upgrade task. It’s very easy! Below those steps you can read some additional information.
  2. The upgrade process is completed. Don’t forget to read the output from the upgrade task, since you have to delete some unneeded files to keep everything clean.
  3. Trying to display the homepage, the following error came up (thanks to sfGuardPlugin) :

Fatal error: Call to undefined method sfRouting::getinstance()

The sfGuardPlugin was still the old version, so we need to upgrade this as well:

symfony1.1 plugin:upgrade sfGuardPlugin

Again something wrong happened :

Plugin “sfGuardPlugin” installation failed: No valid packages found

The plugin:upgrade task tries to install the latest version, which is one for Symfony 1.2 projects. So we have to tell the plugin:upgrade task which version it has to take :

symfony1.1 plugin:upgrade sfGuardPlugin –release=2.2.0

Version 2.2.0 is the latest version for 1.1 projects. You can look it up under the “All releases” tab on the sfGuardPlugin page.

Retrying to display the homepage, the following error came up (this time thanks to the sfSupportPlugin) :

Fatal error: Call to undefined method sfRouting::getinstance() in /PROJECT_PATH/plugins/sfSupportPlugin/config/config.php on line 5

Same problem as the sfGuardPlugin: old version using old & deprecated core functions. Problem with the sfSupportPlugin: no version available for Symfony 1.1 projects, so we need to alter the plugin ourself. Change the content of the plugins config/config.php into :

if (in_array(’sfSupport’, sfConfig::get(’sf_enabled_modules’, array())))
{
$this->dispatcher->connect(’routing.load_configuration’, array(’sfSupportRouting’, ‘listenToRoutingLoadConfigurationEvent’));
}

If you have more old plugins, you have to redo the last step for every plugin. After this you should be able to see the homepage.

Tip: get an error after authenticating?

Fatal error: Class ‘BaseSfGuardUserPeer’ not found

Rebuild your model, do a cache:clear and it should be fixed!

In a couple of days I will write a new post about the upgrade process to Symfony 1.2.

Programmatie ,

Cannot use object of type PEAR_Error as array

September 20th, 2008

While trying to improve the new website of CryptoNet by integrating some feeds and xml sitemap, my Ubuntu terminal raised following error while trying to install the sfSitemap2Plugin:

>> plugin installing plugin “sfSitemap2Plugin”

Fatal error: Cannot use object of type PEAR_Error as array in /usr/share/php/symfony_1.1/lib/plugin/sfPearRestPlugin.class.php on line 92

Now we will try to solve this! There are two possible reasons:

- symfony has a problem to raise an error
- the plugin is not compatible with this version of symfony (ie 1.1.1, instead of 1.1.0)

First check the dependencies in the package.xml file of the plugin. Just download the pear package from the plugin page, and extract it to your desktop. Open package.xml. In my case the max version of Symfony had to be 1.1.0, and since I’m using 1.1.1 that could be the problem causing this fatal error message.

Next step is to change these requirements and archive the whole package. Change the Symfony dependency to:

<dependencies>
<required>
<php>
<min>5.1.0</min>
</php>
<pearinstaller>
<min>1.4.1</min>
</pearinstaller>
<package>
<name>symfony</name>
<channel>pear.symfony-project.com</channel>
<min>0.8.1</min>
<max>1.2.0</max>
<exclude>1.2.0</exclude>
</package>
</required>
</dependencies>

Save the file, and make an archive of the package.xml AND the plugin folder (in my case sfSitemap2Plugin-0.0.2). You can archive it to .tar for example. Rename it to .tgz afterwards.

Final step we have to do is install the plugin, with the path to your self-made archive. Get back to your terminal and execute following command (of course you need to change the path according to yours):

symfony_1.1 plugin:install /home/../sfSitemap2Plugin-0.0.2/sfSitemap2Plugin-0.0.2.tgz

In my case I use symfony_1.1 for my Symfony 1.1 commands. Don’t forget to change this if you used to using “symfony”.

Thanks to Johny_the_french for this solution.

Algemeen , ,

Symfony plugins page provides better overview

August 1st, 2008

The plugin section on the Symfony framework website has been improved…a lot! The problem was, after Symfony 1.1 was released, users couldn’t see if a plugin was suitable for Sf 1.1, or only for 1.0.x.

I recently created a Symfony 1.1 project for the new CryptoNet website, for which I needed a couple of plugins to experiment with, such as SIFR and TextReplacement. The plugins weren’t ready to install them with the refactored plugin system of Symfony, but I managed to install them manually.

With the reorganised section on the official website, you are able to get a list of all plugins, only those for Sf 1.0.x or 1.1 or 1.2. A nice extra feature is that developers can claim their plugins, so other users can search for all the plugins created by a certain developer.

symfony-plugins-version
a quick overview for 1.0, 1.1 and 1.2

On the right side in de plugin section one block in particular is sweet, to view the recently updated plugins:

recently updated plugins

recently updated plugins

A nice stats block is inserted. At the time of writing, these were the totals:

  • 212 plugins
  • 106 developers
  • 3651 users

Nice improvement guys! I will take a deeper look into the plugins available for 1.1, and make a decision to upgrade or keep working with 1.0.x for a brand new version of X-Power.be.

What do you think of the new layout and function on the plugin page?

Programmatie , , , ,

Symfony 1.1 beschikbaar voor gebruik

June 30th, 2008

Het is zover: Symfony 1.1 is gelanceerd als stabiele versie. Tijdens de ontwikkeling, en de verschillende beta en RC releases, zijn er heel wat bugtickets aangemaakt en gesloten geweest, maar is er ook al aan een heleboel documentatie gewerkt. Zo is er ook een belangrijk onderdeel, voor de ontwikkelaars onder ons die graag hun 1.0.x projecten upgraden naar versie 1.1.

Vooral het formulier gebeuren is een groot onderdeel dat ingrijpend aangepast is. Zo kunnen formulieren zeer snel en makkelijk opgebouwd worden, op basis van het databasemodel (schema.xml of schema.yml). Neem gerust de “Symfony Forms Book” even onder de loep om een idee te krijgen over de aanpassingen en nieuwe structuur.

Ik geef graag nog wat extra informatieve links mee (met dank aan Stefan van Symfony-framework.nl) :

Aangezien ik bezig ben met een volledige nieuwe codebasis voor X-Power v4, vind ik het de moeite om dit project te upgraden naar 1.1. De andere (reeds afgewerkte) projecten laat ik nog mooi lopen op de 1.0.x versie. Versie 1.0.17 is trouwens vandaag ook gelanceerd, vergeet dus niet je symfony versie te upgraden.

Neem je ook de stap en upgrade je je project(en) naar versie 1.1 ?

Programmatie , ,

Integreer Symfony in Eclipse PDT

April 2nd, 2008

Symfony Project wordt dagelijks uitgebreid, zowel op gebied van functionaliteit als de community die zich mee op dit open-source framework gooit.

Sinds ik met Symfony werk, zijn de repititieve taken enorm geslonken, en is het programmeren er een heel stuk leuker op geworden. Een goed en uitgebreid framework ter beschikking hebben ligt mee aan de basis van het programmeren, maar daar blijft het niet bij. Een overzichtelijke ontwikkeltool is minstens even belangrijk, aangezien je er uren in bezig bent. Tot op heden heb ik hoofdzakelijk met Zend gewerkt, maar door de integratie met Symfony heb ik Eclipse PDT een nieuwe kans gegeven.

Het is open-source, biedt de typische features en functionaliteiten aan wat je van een IDE mag verwachten. Eclipse integreert ook het WTP platform voor webapplicaties en er zijn een heleboel beschikbare plugins om de IDE uit te breiden of aan te passen.

Voor de Symfony framework gebruikers onder ons is er een schitterende plugin voor Eclipse PDT, namelijk Symfoclipse. De plugin integreert de volgende zaken in de Eclipse IDE:

  • Symfony Commando’s
  • Een YAML editor en validator

Hieronder zal ik een snel overzicht geven hoe je een Symfony project aanmaakt in Eclipse PDT, hoe je de Symfoclipse plugin installeert, en als laatste breng ik nog even een andere handige plugin ter sprake: Clay.

1. Installatie Eclipse PDT

Features:

  • Automatische code aanvulling
  • Templates
  • Class inspection
  • Code folding
  • Refactoring

Je kan het pakket download op de volgende url: http://download.eclipse.org/tools/pdt/downloads.

Indien je Symfony geinstalleerd hebt als PEAR package

Voeg Symfony toe als een library:

  • Open de PHP Navigator
  • Rechtsklik op je project
  • Selecteer “Configure Include Path”
  • Selecteer de “Libaries” tab
  • Klik “Add External Folder”
  • Navigeer naar “\route\to\PEAR\symfony”

Indien je de Sandbox versie gebruikt van Symfony

Doe de volgende zaken:

  • Kopieer je applicatiefolder in de Eclipse Workspace folder
  • Voeg een nieuw PHP Project toe
  • Kies als Project contents Directory je applicatiefolder

2. Installatie Symfoclipse Plugin

Symfoclipse bevat 2 plugins:

  • Symfony Command line plugin
  • Symfoclipse YAML editor plugin

De YAML editor werkt bijzonder goed, en zal menig Symfony ontwikkelaar aangenaam verrassen, wegens de automatische YAML validatie. Je kan dit gedeelte van de plugin automatisch door Eclipse laten installeren, door een nieuwe Remote Site in te geven in het Find and install menu : http://noy.cc/symfoclipse.

Indien je de command line functies wilt gebruiken, moet je het Symfony path in je PATH omgevingsvariable plaatsen.

3. Clay: database design hulptool

Onze laatste Eclipse plugin dat we bespreken is Clay, wat een tooltje is om een database visueel te ontwerpen. De mogelijkheden zijn :

  • grafisch een database model aanmaken
  • een database model maken op basis van een bestaande database
  • SQL (DDL) code genereren voor je database

Indien je Clay wilt uitproberen, kan je hier terecht: http://azzurri.jp/en/software/clay/index.jsp

Programmatie , , , , , ,

Upgrade Symfony plugins

March 20th, 2008

Door een probleem in het ‘PEAR channel’ van het hele Symfony project, werd bij het installeren van een plugin steeds de oudste versie genomen, in plaats van de laatste. Eventuele bugs en foutieve code zijn vervolgens aanwezig, en kunnen de ontwikkelaar weer wat kostbare tijd laten verliezen.

Dit probleem is opgelost, en je kan op makkelijke wijze de geïnstalleerde Symfony plugins vervangen door hun meest recente versie. Bekijk je lijst met plugins met het volgende commando:

php symfony plugin-upgrade symfony/myPluginNamePlugin

Upgrade elke plugin individueel door het volgende commando aan te roepen:

php symfony plugin-list

Vergeet dus niet je Symfony plugins te upgraden! Er wordt bijna dagelijks gewerkt aan verschillende bestaande en nieuwe uitbreidingen. Er zijn ongeveer een 210 nieuwe plugins in ontwikkeling om de wensen van de webontwikkelaar tegemoet te komen. Gaande van een ORM vervanging tot een integratie met Facebook.

Programmatie , , , , , , ,

Integreer Wordpress in een Symfony website

February 28th, 2008

De Symfony community mag dan wel een eigen blog plugin ontwikkeld hebben, toch kan de voorkeur van de webmaster uitgaan naar een uitgebreider blog-instrument, zoals Wordpress.

Symfony is echter zo opgebouwd, dat alle urls opgevangen worden door een routing bestand (routing.yml), dat de link omzet en intern doorstuurt naar de juiste module en actie. http://www.cryptonet.be/portfolio wordt doorgestuurd naar de portfolio module, en een bepaalde actie (meestal executeIndex). Wanneer men nu een voorgemaakte applicatie wilt integreren, zal deze geen gebruik maken van de symfony modules en acties. Om het externe script toch toegankelijk te maken, dienen we het htaccess bestand aan te passen:

Options +FollowSymLinks +ExecCGI
RewriteEngine On

# uncomment the following line, if you are having trouble
# getting no_script_name to work
# RewriteBase /

# we skip all files with .something
RewriteCond %{REQUEST_URI} \..+$
RewriteCond %{REQUEST_URI} !\.html$
RewriteRule .* - [L]

# we check if the .html version is here (caching)
RewriteRule ^$ index.html [QSA]
RewriteRule ^([^.]+)$ $1.html [QSA]
RewriteCond %{REQUEST_FILENAME} !-f

# no, so we redirect to our front web controller
RewriteRule ^blog/wp-admin/(.*)$ /blog/wp-admin/index.php [L]
RewriteRule ^blog/(.*)$ /blog/index.php [L]
RewriteRule ^(.*)$ index.php [QSA,L]

Op deze manier wordt de blog url niet naar de Symfony engine doorgestuurd, maar onmiddellijk naar de Wordpress blog directory.

Programmatie , , , ,