Page 1 of 1

Anyone familiar with the symfony framework?

Posted: Wed Mar 28, 2007 5:56 pm
by Chris Corbyn
I'm having a bit of a "basic" crisis. It's my first few hours using symfony to re-code an existing website which didn't use a framework at first.

The View layer in symfony seems really well thought out so I'm sure there's a simple one-line answer to my question.

There are various View components that are available to use (Layout, Templates, Components, Partials, Slots) but I'm not sure what to use here. In the layout I have some dynamic "components" that need to appear on every single page. These are trivial things like hit-counters and RSS readers.

Unless I'm missing something, I don't appear to be able to create a "global" component that applies to all modules. I have to create the component within a module. This feels like a bit of a hack since a hit-coiunter for example should not be so tightly linked to any one part of the system. Partials can be global, so why not components? :(

Thanks in advance if anyone knows :)

Posted: Thu Mar 29, 2007 7:55 am
by Benjamin
Dude you wrote swiftmail, why not create your own custom framework?

Posted: Thu Mar 29, 2007 11:25 am
by Chris Corbyn
Because other people will do it better and I'm of the opinion that you should use the best tool for the job ;) I got a response over at the symfony forum this morning and well, I just have to create a module along the lines of "utils" and use it as a container for such things. Seems to work, but it seemed a bit odd at first.

On a side note, symfony does keep making my jaw drop in awe. It's really a beautiful framework, although I'm not sure it will appeal to the wider audience (when put alongside Cake) being PHP5-only and with a (relatively) steep learning curve.

Posted: Thu Mar 29, 2007 11:32 am
by Maugrim_The_Reaper
http://www.symfony-project.com/book/tru ... %20Helpers

If it's a simple repetitive element, define your own view helper. Put in a new directory and either use the "use_helper" function to include it (need to follow the view helper add process the above link describes) or to the settings file so it's automatically included for all templates. View helpers are basic PHP functions returning HTML snippets so they make for good static/dynamic elements in Symfony views ;).

Posted: Thu Mar 29, 2007 6:00 pm
by Chris Corbyn
I thought about that, but since I need to access the model I thought a Component was more useful since I can add business logic to the sfComponents class. I'll probably throw most of these little View utilities into components since I've created the utils module purely to house them :)

Posted: Tue Apr 10, 2007 10:14 pm
by dreamscape
Actually, I'm quite disappointed with Symfony's view layer & template system looking at them... the flexibility and extensibility are convoluted at best... but to each their own...

Posted: Wed Apr 11, 2007 1:54 am
by Chris Corbyn
dreamscape wrote:Actually, I'm quite disappointed with Symfony's view layer & template system looking at them... the flexibility and extensibility are convoluted at best... but to each their own...
Maybe I like it because I can't stand template engines when PHP already has template functionality. symfony doesn't have any sort of templating code other than being able to decorate a layout. There's no weird syntax to learn. I do think they could keep the same concept they have now and still make it more flexible though :)