ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

v 1.3.3 grocery CRUD - an automatic Codeigniter CRUD

April 11, 2011 3:24am

Subscribe [77]
  • #181 / Sep 09, 2011 10:40am

    chule143

    5 posts

    I need help plz,

    When i try to upload a file from Opera, IE, Firefox or any other borwser i get this message in the web console in Opera:

    A PHP Error was encountered
    Severity: Warning Message: fclose() expects parameter 1 to be resource, boolean given
    Filename: libraries/grocery_crud.php
    Line Number: 764
    {"success":true,"file_name":null,"full_url":"http://localhost/joya/public/uploads/products/"}

    This is the code from grocerycrud.php:

    line 762:  fseek($temp, 0, SEEK_SET);
    line 763:  stream_copy_to_stream($temp, $target);
    line 764:  fclose($target);

    And this is my controller:

    $crud->set_field_upload(‘image’, ‘public/uploads/products/’);

    What i’m doing wrong?

    PD: Excuse me for my poor english

    Thanks

    Check your config file if there is

    $config['enable_query_strings'] = true;

    or

    $config['allow_get_array'] = TRUE;

    .
    The problem is that uploader works with $_GET and to your project is disabled. So perhaps this is the problem. What codeigniter version do you use? and what grocery CRUD?

    Thanks for your fast replay,

    I test in: CI 2.0.1 and 2.0.3 and i get the same issue in both versions
    The grocery crud version is: Grocery CRUD v.1.1.0 for CI 2.0.0-2.0.3 and CI 1.7.x

    this is my config file:

    $config['allow_get_array'] = TRUE;
    $config['enable_query_strings'] = TRUE;
    $config['controller_trigger'] = 'c';
    $config['function_trigger'] = 'm';
    $config['directory_trigger'] = 'd'; // experimental not currently in use

    Thanks a lot for your support.

    Greetings

  • #182 / Sep 09, 2011 12:43pm

    web-johnny

    235 posts

    I need help plz,

    When i try to upload a file from Opera, IE, Firefox or any other borwser i get this message in the web console in Opera:

    A PHP Error was encountered
    Severity: Warning Message: fclose() expects parameter 1 to be resource, boolean given
    Filename: libraries/grocery_crud.php
    Line Number: 764
    {"success":true,"file_name":null,"full_url":"http://localhost/joya/public/uploads/products/"}

    This is the code from grocerycrud.php:

    line 762:  fseek($temp, 0, SEEK_SET);
    line 763:  stream_copy_to_stream($temp, $target);
    line 764:  fclose($target);

    And this is my controller:

    $crud->set_field_upload(‘image’, ‘public/uploads/products/’);

    What i’m doing wrong?

    PD: Excuse me for my poor english

    Thanks

    Check your config file if there is

    $config['enable_query_strings'] = true;

    or

    $config['allow_get_array'] = TRUE;

    .
    The problem is that uploader works with $_GET and to your project is disabled. So perhaps this is the problem. What codeigniter version do you use? and what grocery CRUD?

    Thanks for your fast replay,

    I test in: CI 2.0.1 and 2.0.3 and i get the same issue in both versions
    The grocery crud version is: Grocery CRUD v.1.1.0 for CI 2.0.0-2.0.3 and CI 1.7.x

    this is my config file:

    $config['allow_get_array'] = TRUE;
    $config['enable_query_strings'] = TRUE;
    $config['controller_trigger'] = 'c';
    $config['function_trigger'] = 'm';
    $config['directory_trigger'] = 'd'; // experimental not currently in use

    Thanks a lot for your support.

    Greetings

    OK I will check it, and for any solution I will inform you

  • #183 / Sep 09, 2011 4:38pm

    web-johnny

    235 posts

    I need help plz,

    When i try to upload a file from Opera, IE, Firefox or any other borwser i get this message in the web console in Opera:

    A PHP Error was encountered
    Severity: Warning Message: fclose() expects parameter 1 to be resource, boolean given
    Filename: libraries/grocery_crud.php
    Line Number: 764
    {"success":true,"file_name":null,"full_url":"http://localhost/joya/public/uploads/products/"}

    This is the code from grocerycrud.php:

    line 762:  fseek($temp, 0, SEEK_SET);
    line 763:  stream_copy_to_stream($temp, $target);
    line 764:  fclose($target);

    And this is my controller:

    $crud->set_field_upload(‘image’, ‘public/uploads/products/’);

    What i’m doing wrong?

    PD: Excuse me for my poor english

    Thanks

    Check your config file if there is

    $config['enable_query_strings'] = true;

    or

    $config['allow_get_array'] = TRUE;

    .
    The problem is that uploader works with $_GET and to your project is disabled. So perhaps this is the problem. What codeigniter version do you use? and what grocery CRUD?

    Thanks for your fast replay,

    I test in: CI 2.0.1 and 2.0.3 and i get the same issue in both versions
    The grocery crud version is: Grocery CRUD v.1.1.0 for CI 2.0.0-2.0.3 and CI 1.7.x

    this is my config file:

    $config['allow_get_array'] = TRUE;
    $config['enable_query_strings'] = TRUE;
    $config['controller_trigger'] = 'c';
    $config['function_trigger'] = 'm';
    $config['directory_trigger'] = 'd'; // experimental not currently in use

    Thanks a lot for your support.

    Greetings

    I think I find the solution. Try to change the

    /*
    .....
    | 'AUTO'            Default - auto detects
    | 'PATH_INFO'        Uses the PATH_INFO
    | 'QUERY_STRING'    Uses the QUERY_STRING
    | 'REQUEST_URI'        Uses the REQUEST_URI
    | 'ORIG_PATH_INFO'    Uses the ORIG_PATH_INFO
    |
    */
    $config['uri_protocol']    = 'AUTO';


    Change it to PATH_INFO or QUERY_STRING or REQUEST_URI or ORIG_PATH_INFO.
    Test what fits to your server. Make sure that your project works fine and then test the upload file if it works. I hope this will solve the problem.

  • #184 / Sep 12, 2011 5:52pm

    Snap Shot

    7 posts

    Hey web-johnny,
    any plans for a Spark (http://getsparks.org)?
    It looks like a really elegant way to deploy and then maintain.
    Keep up the great work Sir!

  • #185 / Sep 13, 2011 2:46am

    web-johnny

    235 posts

    Hey web-johnny,
    any plans for a Spark (http://getsparks.org)?
    It looks like a really elegant way to deploy and then maintain.
    Keep up the great work Sir!

    Yeap I have it in mind. I just stacked to the git versioning. I always use svn versioning control and now it is a different way to commit add update etc. But soon I will announce a spark version.
    Thanks for your suggestion

  • #186 / Sep 13, 2011 1:16pm

    chule143

    5 posts

    I need help plz,

    When i try to upload a file from Opera, IE, Firefox or any other borwser i get this message in the web console in Opera:

    A PHP Error was encountered
    Severity: Warning Message: fclose() expects parameter 1 to be resource, boolean given
    Filename: libraries/grocery_crud.php
    Line Number: 764
    {"success":true,"file_name":null,"full_url":"http://localhost/joya/public/uploads/products/"}

    This is the code from grocerycrud.php:

    line 762:  fseek($temp, 0, SEEK_SET);
    line 763:  stream_copy_to_stream($temp, $target);
    line 764:  fclose($target);

    And this is my controller:

    $crud->set_field_upload(‘image’, ‘public/uploads/products/’);

    What i’m doing wrong?

    PD: Excuse me for my poor english

    Thanks

    Check your config file if there is

    $config['enable_query_strings'] = true;

    or

    $config['allow_get_array'] = TRUE;

    .
    The problem is that uploader works with $_GET and to your project is disabled. So perhaps this is the problem. What codeigniter version do you use? and what grocery CRUD?

    Thanks for your fast replay,

    I test in: CI 2.0.1 and 2.0.3 and i get the same issue in both versions
    The grocery crud version is: Grocery CRUD v.1.1.0 for CI 2.0.0-2.0.3 and CI 1.7.x

    this is my config file:

    $config['allow_get_array'] = TRUE;
    $config['enable_query_strings'] = TRUE;
    $config['controller_trigger'] = 'c';
    $config['function_trigger'] = 'm';
    $config['directory_trigger'] = 'd'; // experimental not currently in use

    Thanks a lot for your support.

    Greetings

    I think I find the solution. Try to change the

    /*
    .....
    | 'AUTO'            Default - auto detects
    | 'PATH_INFO'        Uses the PATH_INFO
    | 'QUERY_STRING'    Uses the QUERY_STRING
    | 'REQUEST_URI'        Uses the REQUEST_URI
    | 'ORIG_PATH_INFO'    Uses the ORIG_PATH_INFO
    |
    */
    $config['uri_protocol']    = 'AUTO';


    Change it to PATH_INFO or QUERY_STRING or REQUEST_URI or ORIG_PATH_INFO.
    Test what fits to your server. Make sure that your project works fine and then test the upload file if it works. I hope this will solve the problem.

    I try these three options and even follow me nowhere, attached three photos of the process of uploading images.

    I tried it in Windows and Linux servers

    http://i915.photobucket.com/albums/ac352/chule143/screen1.png
    http://i915.photobucket.com/albums/ac352/chule143/screen2.jpg
    http://i915.photobucket.com/albums/ac352/chule143/screen3.png

    Thanks for your support

  • #187 / Sep 13, 2011 2:47pm

    web-johnny

    235 posts

    @chule143
    I tested in Opera and the uploader doesn’t work. Try to do the same thing in Mozilla Firefox. Perhaps the plugin of uploader ( It is an HTML 5 uploader ) doesn’t support Opera or IE , I don’t know what to say. In Chrome and Firefox works fine. Make sure if you run your project to a linux server that your folder has 777 access.

  • #188 / Sep 16, 2011 6:39am

    ilSignorCarlo

    20 posts

    Hi,
    I’m having some problems using Grocery CRUD in my website. I’ve found out that the problem is actually the URI language identifier library (http://codeigniter.com/wiki/URI_Language_Identifier).

    Grocery crud is working, so if I load the examples in the library, at this address: http://localhost/website/examples/offices_management, I can see the table with all the rows, I can sort them and so on. The problem is when I try to add/edit. Indeed, the add button, for example, points here: http://localhost/website/offices_management/add. It gives me an error since the url is missing the “examples” part, that is the controller name.

    If I delete the URI language identifier controller it works, but I need it. The problem, I think, is that is doing stuff with the url.

    Does anyone know how to solve this?

  • #189 / Sep 19, 2011 10:54am

    spingh

    13 posts

    First of all, great job 😊

    1) with csrf_protection set to TRUE, pagination doesn’t work (ajax_list_info error).
    2) with all default the $db[‘default’][‘dbprefix’] isn’t added.

    Not big problems, just thought to mention them.

  • #190 / Sep 19, 2011 2:47pm

    mundus

    2 posts

    I’m just discovering groceryCRUD, seems to be really great addiction to CI. But so far, I have problem with my locale characters. Entering for instance: płużnica, after saving returns p?u?nica. Something is probably wrong with the encoding. I don’t know if this was mentioned on previous pages or not.

  • #191 / Sep 19, 2011 2:55pm

    web-johnny

    235 posts

    I’m just discovering groceryCRUD, seems to be really great addiction to CI. But so far, I have problem with my locale characters. Entering for instance: płużnica, after saving returns p?u?nica. Something is probably wrong with the encoding. I don’t know if this was mentioned on previous pages or not.

    Make your database utf-8 and make sure that your fields are also utf8. This will work. The better is utf8-general_ci.  The most examples on the web are not utf8 . But if you try for example the film_management example (that is utf8-general_ci) you will see that the saving has been successfully been.

  • #192 / Sep 19, 2011 3:48pm

    mundus

    2 posts

    You’re right! I created once again database, this time paying attention to my encoding and Voila it works as expected! Thanks for your commitment!

  • #193 / Sep 20, 2011 1:24pm

    bkno

    7 posts

    I’ve just tried grocery, very impressive John!

    Is it possible to add a ‘virtual’ field. An example would be taking the value of one field and subtracting another. If it’s not built-in functionality, is there a fairly easy way for me to write a function to append additional information?

  • #194 / Sep 21, 2011 12:45am

    web-johnny

    235 posts

    I’ve just tried grocery, very impressive John!

    Is it possible to add a ‘virtual’ field. An example would be taking the value of one field and subtracting another. If it’s not built-in functionality, is there a fairly easy way for me to write a function to append additional information?


    If I understood what you said. You can add as many ‘virtual’ fields you like.
    Grocery CRUD recognize that there is not this field in the database (in columns or in fields is the same ) and just add the default field type input-type=text.
    In your case for example you can do :

    function full_example()
    {
            $this->grocery_crud->set_table('customers')
            ->set_subject('Customer')
            ->columns('customerName','virtual_field','contactLastName','phone','city','country','creditLimit');
     
            $this->grocery_crud->fields('customerName','virtual_field','contactLastName','phone','addressLine1','city','country','creditLimit');
            $this->grocery_crud->required_fields('customerName','contactLastName');
     
        $output = $this->grocery_crud->render();
     
        $this->_example_output($output);
    }

    So the code will work fine but of course with ‘virtual_field’ empty. You can insert a value etc etc with callbacks. See the examples of http://www.grocerycrud.com/crud/example/callback_add_field and http://www.grocerycrud.com/crud/example/callback_edit_field also other useful callbacks_will be callback_after_insert and callback_after_update.

  • #195 / Sep 21, 2011 8:11pm

    bkno

    7 posts

    Thanks for your help, I gave it a go and it works perfectly. Also using callback_column - very useful.

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases