This forum is in READ-ONLY mode.
You can look around, but if you want to ask a new question, please use Stack Overflow.

Combining symfony and php-gtk

Requests for new symfony features.

Combining symfony and php-gtk

by jsamos » Tue Oct 23, 2007 9:41 am

Hello!

Please, I would like to know if someone has some experience of using php-gth to develop the user interface in a symfony project. Would it be possible?

Best regards,

José
jsamos
Junior Member
 
Posts: 2
Joined: Mon Oct 22, 2007 12:51 pm
Location: Granada (Spain)

Re: Combining symfony and php-gtk

by halfer » Tue Oct 23, 2007 11:34 am

Welcome to the fora.

I very much doubt anyone has tried what you suggest. Symfony is designed for the request-response paradigm of the web, and GTK on the other hand is designed for desktop applications. The user interface in a symfony project is created in a symfony template using "helpers" (functions included as required) and however this is done in PHP-GTK, it will be very different.
halfer
Faithful Member
 
Posts: 10148
Joined: Mon Jan 30, 2006 1:16 pm
Location: West Midlands, UK

Re: Combining symfony and php-gtk

by jsamos » Tue Oct 23, 2007 11:44 am

Thank you for your answer.

I agree with you. But, it would be nice to have the possibity of building desktop applications using symfony. Only the "view" part should have to be changed.

Maybe the symfony development team could consider this posibility in future symfony versions.
jsamos
Junior Member
 
Posts: 2
Joined: Mon Oct 22, 2007 12:51 pm
Location: Granada (Spain)

Re: Combining symfony and php-gtk

by bashman » Wed Jan 27, 2010 10:26 pm

Hello community!.
read:
http://www.symfony-project.org/book/1_2/16-Application-Manag ement-Tools
read:
Using symfony outside of a web context.

Here's one way:

<?php
require_once(dirname(__FILE__).'/config/ProjectConfiguration .class.php');
$configuration =
ProjectConfiguration::getApplicationConfiguration('principal ', 'prod',
false);
sfContext::createInstance($configuration);
// Remove the following lines if you don't use the database layer
$databaseManager = new sfDatabaseManager($configuration);
$databaseManager->loadConfiguration();
//obtiene el municipio 2 de la tabla de municipios
$x = MunicipiosPeer::retrieveByPK(2);
//for test
//echo $x->getMunmunicipio() . " ";
//verificamos si php-gtk esta instalado y configurado

if (!class_exists('gtk')) {
die(":-P ");
}
$wnd = new GtkWindow();
$wnd->set_title('Municipio N 2');
$wnd->connect_simple('destroy', array('gtk', 'main_quit'));
$lblHello = new GtkLabel($x->getMunmunicipio() );
$wnd->add($lblHello);
$wnd->show_all();
Gtk::main();
?>

This is my example, very basic and without reading anything more. This can be improved and extended. You can use the model classes generated by symfony, you can choose your orm, and some other functions and features of the framework. Make no mistake. Apache is not needed, only php and php-gtk, a data model (schema.yml) and an RDBMS installed and operating correctly.

Do not panic. This is a proof/test of concept.

Please test and notify.

--
bashman
Jose Luis Regalado
Linux user 280.381
http://bashman.wordpress.com
bashman
Junior Member
 
Posts: 3
Joined: Wed Aug 06, 2008 9:50 pm