Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Ajax FuelPHP
  • Hi fellows, fuelphp it's great but i've looking from everywhere and all i founded it indicates to me, fuelphp does not integrates ajax, like ruby on rails does, it has to be performed "manually" with jquery, which is really disappointing, please if i'm wrong help me with a tutorial or something, i'm a fuelphp newbie, i don't wanna looks like a stupid, i just wanna be clear about this topic.
  • ?

    Fuel is a backend PHP framework, it's not a frontend framework. If you need a frontend framework, pick one, there are plenty. Fuel doesn't want to restrict frontend designers, Fuel is about choice.
  • come on... fron-end frameworks?, just say, no, fuel does not integrates ajax by itself although it should.
  • That is your personal opinion.

    We disagree, we stongly believe a backend application framework should NOT force the developer to use a predefined frontend, the developer should be free in her/his choice.

    And it is not restricted to just the Ajax call. If you force an Ajax call method upon your developers, you also have to force a way to process the result of the call upon them. Which means you have to force the use of a frontend template engine to be able to reload table data, and so on...

    You used Rails as a very good example: with Rails you don't have a choice, you use Rails. Period. And if you need to do something Rails doesn't offer out of the box, you still have to hack you jquery in.

    So choose your frontend, or choose something more low-level like JQuery, write a wrapper class that generates your frontend code, and you're done.

    We have client applications that use Twig as a template engine, and use Kendo as UI framework. Kendo requires specific method calls which fetch ajax data and fill a datatable in one go, like:

      dataSource: {
          type: "odata",
          transport: {
              read: ""
          pageSize: 15,
          group: { field: "ContactTitle" }
      height: 500,
      groupable: true,
      sortable: true,
      selectable: "multiple",
      reorderable: true,
      resizable: true,
      filterable: true,
      pageable: {
          refresh: true,
          pageSizes: true,
          buttonCount: 5
      columns: [
            field: "ContactName",
            template: "<div class='customer-photo' style='background-image: url(${data.CustomerID}.jpg);'></div><div class='customer-name'>#: ContactName #</div>",
            title: "Contact",
            width: 200
            field: "ContactTitle",
            title: "Contact Title",
            width: 220
            field: "Phone",
            title: "Phone",
            width: 140
            field: "CompanyName",
            title: "Company Name"
            field: "City",
            title: "City",
            width: 120

    So we have a Kendo class, that is callable from Twig, which generates javascript like this, based on input parameters, Fuel Language files, etc.

    We could have added this to the framework, but would you have been happy to be forced to use Twig and Kendo? And what if you have to work for a client that requires Moustache instead of Twig?

    So, no, it should not. So make your choices, spend some time writing a wrapper class for it, and off you go. In all freedom.
  • Couln't agree more. In case you didn't notice, Fuel is about server side. It let you choose your frontend syntax between the best template engines (up to pure HTML and PHP if you want to) to write you view and it's one of its better quality : flexible. You wrote this topic probably because you needed something you've been frustrated not to find in Fuel at one point. But if you keep using it for your projects, trust me you will realise how it's great to have the choice.

    There are guys who spend all their free time on css or js framework, template engine, javascript template engine,  ajax libs and so on. Fuel team focus on what they are doing great : a PHP framework. If you need something else to mix with, go ahead, you have hundred of choices who perfectly match Fuel flexibility. 

Howdy, Stranger!

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

In this Discussion