Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Why is my data not transfered to the view?
  • Hi there,

    I am a complete newbie to fuelPHP, but I found it is a very cool framework.

    I just changed the "Monkey" example from Oil generate and try to build my own Admin Template which is working really quite good so far.

    My problem is now, that $monkey is not tranferred to monkey/_form correctly and I have really no idea why. I also made a new model "animal" and check with the generated code from oil. I only made some changes to that these files are running in my theme now.

    Perhaps you do see my problem.

    Here is my code:
    Controller: http://pastebin.com/Kcc8xLtG
    Edit View: http://pastebin.com/xGba54Bf
    Form View: http://pastebin.com/0cyJ239Y

    Thanks very much for you help.
    Kay

  • You're loading _form using render() from your edit view.

    Those are two different Views, each with their own local variable context. A variable set on one view isn't available in another, unless you have used set_global().
  • Thanks Harro, that was was I was thinking also
    But how can I set $monkey global for all views?
  • HarroHarro
    Accepted Answer
    use set_global('monkey', Model_Monkey::find($id)); instead of using set().
  • Thanks!
    That was it :-)

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion