Just create a plugin (I usually call it "AppSharedPlugin" or so), put
a module with your template inside and enable it in whatever apps you
want to share it in.

Daniel

On May 5, 6:30 am, OnDistantShores <cameron.r...@gmail.com> wrote:
> Yep, Symfony 1 :-)
>
> On May 5, 11:27 pm, OnDistantShores <cameron.r...@gmail.com> wrote:
>
> > Thanks for your response.
>
> > I have my form component in libs (this was part of the generated
> > code). But the actual form display logic is part of the _form.php
> > partial, which is in the layouts directory, which is obviously
> > specific to a module. How can this be shared from the libs directory?
>
> > On May 5, 10:39 pm, Gareth McCumskey <gmccums...@gmail.com> wrote:
>
> > > I assume you are on symfony 1? If so, put your form classes inside the
> > > project_root/lib directory not the apps/app_name/lib directory and you can
> > > then use it across apps.
>
> > > On Thu, May 5, 2011 at 1:02 AM, OnDistantShores 
> > > <cameron.r...@gmail.com>wrote:
>
> > > > Here's my scenario, I'm not sure what the best way to implement this
> > > > is.
>
> > > > I'm creating a party bookings system. Anyone can go to my frontend app
> > > > and submit a new booking. Once they're finished, they'll just get a
> > > > confirmation screen, they can't edit it. Easy.
>
> > > > Only certain users will be able to get to the admin app (it might be
> > > > secured simply by being on an intranet, but that's not important, just
> > > > assume it will be only accessible by admin users). They'll be able to
> > > > view the list of submitted bookings. Easy.
>
> > > > My problem is around code re-use when allowing admin users to edit
> > > > existing bookings. When you do generate-module in Symfony, the
> > > > generated module (which as a newbie I'm assuming is a good example of
> > > > structuring things) creates the form as a partial. I've had to
> > > > customize this form a lot for my usage (lots of Javascript, etc), so
> > > > of course I want to re-use this code, to be able to load an existing
> > > > booking into this form. But there doesn't seem to be a way to share
> > > > this partial between the apps (I've seen people mention making a
> > > > plugin...but this seems complicated for this use).
>
> > > > I considered using an IFrame to load the form from the frontend and
> > > > just passing an "id" parameter to load it in edit mode, but this would
> > > > mean that the edit mode is not secure - anyone could go to the form on
> > > > the frontend and pass this parameter to edit a booking.
>
> > > > I also considered putting all of the form display code (HTML,
> > > > Javascript, etc) in a method on the form object, but this doesn't seem
> > > > very MVC - all of the display code is then in the form. But this is
> > > > only because I'm thinking of the form in the same way as a model - is
> > > > that right?
>
> > > > I feel like this should be a common situation. You can share models
> > > > and forms between apps, why can't you share this common form display
> > > > code too?
>
> > > > Thanks!
>
> > > > --
> > > > If you want to report a vulnerability issue on symfony, please send it 
> > > > to
> > > > security at symfony-project.com
>
> > > > You received this message because you are subscribed to the Google
> > > > Groups "symfony users" group.
> > > > To post to this group, send email to symfony-users@googlegroups.com
> > > > To unsubscribe from this group, send email to
> > > > symfony-users+unsubscr...@googlegroups.com
> > > > For more options, visit this group at
> > > >http://groups.google.com/group/symfony-users?hl=en
>
> > > --
> > > Gareth McCumskeyhttp://garethmccumskey.blogspot.com
> > > twitter: @garethmcc
> > > identi.ca: @garethmcc

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

You received this message because you are subscribed to the Google
Groups "symfony users" group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en

Reply via email to