![]() |
|
Snippets |
|
... without having trouble with your PEAR directory.
If you use the admin generator but don't like the generated html code, you either can use a custom css file to redo the style, or you have to copy the original theme from
/path/to/$PEAR/symfony/generator/sfPropelAdmin/default
and redo the html here. The problem with that technique is, that you have to manage this PEAR directory from now on, instead having the new theme located in your project folder. That's bad, because your theme will be lost if you clear your PEAR installation or decide to uninstall the symfony version and re-install another one.
After doing some research in the forums and docs, I tried to create the theme in my project directory, with the expected folder structure. I created a folder structure in my projects data dir, like this:
/path/to/$PEAR/data/generator/sfPropelAdmin/$THEME_NAME
I just copied all directories and files from the default sfPropelAdmin theme to this folder, but this didn't worked out. symfony wasn't able to find this theme. So, I created a symbolic link to this folder:
ln -s \ /path/to/$PROJECT_NAME/data/generator/sfPropelAdmin/$THEME_NAME \ /path/to/$PEAR/data/symfony/generator/sfPropelAdmin/$THEME_NAME
Now, you I modify the template to fit my needs, e.g. reset the css classes, add a new table structure and so on. After upgrading/uninstalling/installing a new copy of symfony, don't forget to check if the symbolic link still exists. If not, just re-create it, and everything should work.
If your webserver and php understoods the following of symbolic links (Windows doesn't), you can use this new theme for your sfPropelAdmin generated modules via the theme configuration handle in your generator.yml:
generator:
class: sfPropelAdminGenerator
param:
model_class: ModelClass
theme: $THEME_NAME
Comments on this snippet
With the latest alpha (>2255), you can package themes into a plugin. Just put the theme files into
myPlugin/data/generator/and it should work out of the box.Hi. I trying to make new template to the admin generator. I put the new theme in $PROJECT_HOME/plugins/NAMEPlugin/data/generator/sfPropelAdmin/testTheme. Then chance "theme: testTheme" in generator.yml file. But, when execute the module/action, throws the exception: "The theme "testTheme" does not exist."
How must I do to symfony find it??
Thanks.
When using a plugin, the correct path is : (assuming your theme is called sfBackend)
/project/plugins/sfBackendPlugin/data/generator/sfPropelAdmin/sfBackend
Witch contains skeleton and template directories. (don't forget to clear the cache)
COil
Hi Loïc. Thanks for the post, but it still seems to fail for me...
I use Doctrine so I have moved everything from path\to\symfony-1.2.10\lib\plugins\sfDoctrinePlugin\data\generator\sfDoctrineModule\myAdmin
to path\to\project\plugins\myAdminPlugin\data\generator\sfDoctrineModule\myAdmin
I cleared the cache but then when I try to open a module using this "theme: myAdmin" I get:
Fatal error: Class 'BaseFooGeneratorConfiguration' not found in path\to\project\apps\backend\modules\foo\lib\fooGeneratorConfiguration.class.php on line 11
Any ideas?
C