I’m developing a website with symfony 1.4. The users upload photos and the photos are saved in a database.
Now on the homepage, I have some content and I want to have a section that shows the recently uploaded photos. I’m not sure what is the best way of doing this. Could you please point me in right direction?
The only way I can think of is to have $sf_content hold the main content (which will come from the app/modules) and for recent uploads, have layout.php do database access+business logic+rendering but that will violate the MVC and will involve huge database access every time the user navigates in the website.
Can it be made better?
You can use components.
apps/yourapp/modules/yourmodule/actions/components.class.php
In model:
in your apps/yourapp/modules/yourmodule/themplates/_rfoto.php
And In layout.php , or other place where you want to put your photo: