Thanks for the reply Joel. As usual just after I posted this tried
something else and got this working. I was placing the 'vendor();'
call at the bottom of the index.thtml file. As I replaced the original
function with it. I've found if I place the vendor() call before the
function is needed it works fine. Strange PHP.

As for the comment on the no business logic in the View I agree. But
then again I never actually stated what this function I'm including
does. It's not business logic. It's just code to help build the radio
buttons sets since each form (a Questionnaire) has 80+ questions. It's
similar to the built-in Cake function for building say an input field.
But for my case I need to wrap some HTML code around each question and
Yes/No radio button set. It's easier to place this into a function to
build the view output then manually for each of the questions.

P-



On Mar 26, 4:56 pm, Joel <[EMAIL PROTECTED]> wrote:
> You can paste some code into bootstrap.php, which then makes your
> function available everywhere.  You should never include business/
> controller logic into a view; that's just bad practice.
>
> Well, putting code in the bootstrap.php file is also not very MVC-
> pattern compliant, but sometimes you gotta do whatcha gotta do.
>
> -J.
>
> On Mar 26, 5:20 pm, CodeHooligans <[EMAIL PROTECTED]> wrote:
>
> > Hello all,
>
> > I'm having a but of an issue. I have two forms. But are simple and
> > submit to discrete backend controllers. Both have their own set of
> > views (add, edit, index). Each submit into respective tables in the
> > database. I'm running cake 1.1.xxx (The current stable release).
>
> > So here is my issue. I'm try to just include a common function that is
> > used in each of the index.thtml files. I've tried a traditional PHP
> > include. Placed the php file under the site root and tried including
> > the path and filename. Something I would do under a normal PHP
> > environment.
>
> > The included file will load without issues. Meaning if I use require()
> > no error is reported. The problem is the function that is inside the
> > included file is not loaded.
>
> > I've read through the other message and have tried the app/vendors and
> > calling the include file via vendor('filename'); without much luck.
>
> > What am I missing here? The function runs fine when I place it
> > directly into the index.thtml files(s). My problem is I really don't
> > want to have this in 2 different places. It's the same code. Also I
> > would put this in the controller but again it would need to be in both
> > controllers. Does not seem efficient to me.
>
> > P-
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to