⚠ In case you've missed it, we have migrated to our new website, with a brand new forum. For more details about the migration you can read our blog post for website migration. This is an archived forum. ⚠

  •     

profile picture

ucfirst ???



Urchins Thereds
  • profile picture
  • Member

Posted 20 April 2014 - 06:41 AM

can u help me for ucfirst in grocerycrud??? thx .

 


web-johnny
  • profile picture
  • Administrator
  • 1,166 posts

Posted 20 April 2014 - 08:18 AM

Hello there and welcome to the forums.

 

Actually, I didn't understand your question. Do you want to remove the ucfirst? ucfirst is just a function from PHP that is capitalizing the first letter of the word. For more you see here: http://www.php.net/manual/en/function.ucfirst.php


Urchins Thereds
  • profile picture
  • Member

Posted 20 April 2014 - 09:39 AM

Thanks for reply... i need first letter automatic capitalizied when insert in database using GC.. sorry for bad english

web-johnny
  • profile picture
  • Administrator
  • 1,166 posts

Posted 20 April 2014 - 13:36 PM

All what you need is callback_before_insert (http://www.grocerycrud.com/documentation/options_functions/callback_before_insert)

In your case you will have something like that:
 


public function users(){
    $crud = new grocery_CRUD();
    $crud->set_table('users');
    ...
 
    $crud->callback_before_insert(array($this,'ucfirst_transformation'));
 
    $output = $crud->render();
    $this->_example_output($output);
}
 
function ucfirst_transformation($post_array) {
    $post_array['first_name'] = ucfirst($post_array['first_name']);
     $post_array['last_name'] = ucfirst($post_array['last_name']);

  return $post_array;
}

Urchins Thereds
  • profile picture
  • Member

Posted 20 April 2014 - 14:27 PM

thanks web-jhonny :) its work .. one more question why primary id not show in view or edit when primary id is auto_increment ??? 


web-johnny
  • profile picture
  • Administrator
  • 1,166 posts

Posted 21 April 2014 - 07:26 AM

This is the way that grocery CRUD works to make your life easier ;) .

If however you need to have the id in your forms (e.g. in edit mode), you can have something like this:
 

$crud->edit_fields('id','first_name','last_name',.... );

or if you want always to add the id, you can do it like this:

$crud->fields('id','first_name','last_name',.... );

Urchins Thereds
  • profile picture
  • Member

Posted 21 April 2014 - 09:04 AM

Urgent please in my joob i using gc for upload file pdf but in server pdf not moved to folder path... n how to rename filename pdf ???

web-johnny
  • profile picture
  • Administrator
  • 1,166 posts

Posted 22 April 2014 - 13:57 PM

Hello there, you just need to add permissions 777 to the folder of the upload path.


Urchins Thereds
  • profile picture
  • Member

Posted 22 April 2014 - 15:20 PM

is not need add permissions 777 because folder upload path in the local server like 192.168.1.27, i try upload using library CI its okay but with GC file not moved to folder path :(


Urchins Thereds
  • profile picture
  • Member

Posted 24 April 2014 - 02:57 AM

can help me for upload file in server ??? file its hidden when upload in server but in localhost is not.... format file in pdf .. 


web-johnny
  • profile picture
  • Administrator
  • 1,166 posts

Posted 24 April 2014 - 05:28 AM

Are you having any errors?