After monkeying around with it some more this is what I had to do to get access to my variables.

  1. Put the require statement in the constructore of the AppController class
  2. Create a class variable and assign the variable from the file I was including to the class variable.
  3. Then from my other controllers I can access using $thi->variable
I was including the file at the top of my controller file before with no luck.  I could not say...

global $variable;
print $variable;

I would get no output.

Anyway this will work until I get everything working with  vendors.

Thanks

On 5/16/06, John Zimmerman <[EMAIL PROTECTED]> wrote:
I used vendors, but no change.  I can put a print statement in the file I am including and it prints out after it is included, but I still can't get to the  variables within my contollers.

There are no class definitions in this file, just arrays with values.

I must have something else hung up, I will have to go through and see what else might be going wrong.

I will report back later, but if anyone has any other suggestions that would be great.

Thanks


On 5/16/06, BoBB <[EMAIL PROTECTED]> wrote:
I think the intended place for global defines is in app/config/bootstrap.php ... that's where I put mine.


On 5/16/06, John David Anderson (_psychic_) < [EMAIL PROTECTED]> wrote:

Vendors is a great way to include stuff:

1. Stick your php file in /app/vendors
2. Get it in Cake with vendor('nameoffile');

Globals work best in AppController for me, but I suppose you can
throw things in /app/config/bootstrap.php as well.

-- John

On May 16, 2006, at 5:20 PM, John Zimmerman [gmail] wrote:

> I have a file I often include that has a bunch of arrays that I
> made with data for things like United States, names/abreviations/
> etc...
>
>
> I am trying to use require_once to include this file in the
> app_controller.php and then access the data by declaring a "global"
> in local scope.
>
> So far I have been unable to get this to work.  My variables aren't
> accessible.
>
> Has anyone else run into problems using globals?
>
> I have used globals outside of the cakephp framework on this same
> webserver before.
>
> If you have a suggestion as to a way to do this better I am all
> ears as well.
>
> Thanks
>
> >








--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to