Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
The Fuelphp sample is not working. (Passing functions to views)
  • Passing functions to views

    // In the Presenter
    class Presenter_Index extends Presenter
    {

        public function view()
        {
            $this->echo_upper = function($string) { echo strtoupper($string); };
        }
    }

    // Which you can then use in your view:
    $echo_upper('this string'); // Outputs: "THIS STRING"


    And I get this error:
    =================================
    Fuel\Core\PhpErrorException [ Warning ]:
    Missing argument 1 for Admin\Controller_Content::Admin\{closure}(), called in /var/www/html/www_ibxbase/fuel/core/classes/view.php on line 285 and defined
  • What version of Fuel are you on?

    It is addressed here (https://github.com/fuel/core/commit/627441c5341e698b5dd6e8553dab3879f81794c3) on July 3rd, which means you need to run 1.8/develop (or backport the View class).
  • I use oil to create project. 
    Do you has most update one, So, I will not getting into the same problem again ?

    Thanks.

    sudo su
    sudo curl get.fuelphp.com/oil | sh
    cd /
    sudo oil create /var/www/html/www_project
  • That will install the latest release version, 1.7.3, which doesn't have the fix.

    oil create will do a "git clone", so you can just go into your fuel/core and fuel/packages/... folders, and to a "git checkout 1.8/develop" to switch to the current develop version.

    It is stable enough to use it in production, all our applications run on 1.8/develop.
  • how can i migrate to 1.8/develop from 1.7.3. is documentations are same?
  • No.

    But the fuel/docs repo also has a 1.8/develop branch, and you can find them online at http://fuelphp.com/dev-docs.

    When you have local git repo's, you migrate by changing the branch:

    cd ./fuel/core
    git checkout 1.8/develop

    and the same with all installed packages (orm, auth, etc). In case you use Auth, don't forget to run your migrations.

    If you have installed fuel from zip, it's a bit more complicated.
  • Do you have any oil command that I can install the stable production version?
    There are two error it really give me a lot of trouble.

    The first one is "Passing function to view."

    The second one is "Fuel\Core\Fuel::init - The configured locale en_US is not installed on your system." from the log files.


    # quick install oil from the web

    $ curl get.fuelphp.com/oil | sh
    # now that oil is installed, create a blog project in a directory called Sites
    $ cd Sites/
    $ oil create blog
  • oil does install the stable production version, which at this moment is 1.7.3.

    How you switch depends on how you have installed Fuel. If you have local repositories (does ./fuel/core have a .git folder?), I have already told you how to switch. If you don't, you need to install the zip manually.

    The error message is that it says: your config defaults to the locale "en_US", and that is not installed on your system. So either install it, or configure the correct locale. On debian type linux installations, the locale should be "en_US.utf8" for example.
  • I was try the oil and direct download the zip file which say fuelphp v1.7.3

    After install it.

    When I try to "Passing functions to views"

    I still got the same error. 
    =================================
    Fuel\Core\PhpErrorException [ Warning ]:
    Missing argument 1 for Admin\Controller_Content::Admin\{closure}(), called in /var/www/html/www_ibxbase/fuel/core/classes/view.php on line 285 and defined
  • I already told you that 1.7.3 does not contain the fix.

    If you install from zip, you need to use https://github.com/fuel/fuel/archive/1.8/develop.zip.
  • i think, changing the core file is sufficient? is nt it?
  • You can try, I don't know from the top of my head if it has depencencies with other Fuel components. In general I advise against mixing versions.


Howdy, Stranger!

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

In this Discussion