Welcome, Guest
You have to register before you can post on our site.



Search Forums

(Advanced Search)

Forum Statistics
» Members: 9,647
» Latest member: renzcaio
» Forum threads: 66,772
» Forum posts: 418,532

Full Statistics

Latest Threads
How do you access the $th...
Forum: CodeIgniter 4 Discussion
4 hours ago
» Replies: 7   » Views: 268
new User of CodeIgniter
Forum: Lounge
4 hours ago
» Replies: 2   » Views: 54
Login library
Forum: Best Practices
7 hours ago
» Replies: 3   » Views: 168
myBB and CI logins
Forum: Lounge
7 hours ago
» Replies: 2   » Views: 106
Improve Pagination CI 3x
Forum: CodeIgniter 3.x
10 hours ago
» Replies: 1   » Views: 95
Release date for 3.2.0?
Forum: CodeIgniter 3.x
Yesterday, 12:05 PM
» Replies: 0   » Views: 49
input post empty
Forum: General Help
Yesterday, 10:24 AM
» Replies: 8   » Views: 159
Share Vuejs Route with Co...
Forum: General Help
Yesterday, 07:24 AM
» Replies: 1   » Views: 91
Codeigniter - Indonesia C...
Forum: Regional User Groups
Yesterday, 02:50 AM
» Replies: 113   » Views: 72,083
Pagination with search
Forum: Libraries & Helpers
10-19-2017, 09:57 PM
» Replies: 8   » Views: 1,535

Star Problem With Image Resizing
Posted by: waqaskhanbhatti - 10-19-2017, 12:59 AM - Forum: Libraries & Helpers - Replies (2)

Hello to All Members,

I have a problem in image resizing. I have a function name as do_resize(). it gets 4 parameters and return the name of the the new resized file. the code of this function is given below.

PHP Code:
public function do_resize($source_file$target_folder$height 128$width 128)
       $filename $source_file;
       $temp_data explode('/',$filename);
       $new_filename end($temp_data);

       $temp_data explode('.'$new_filename);
       $ext end($temp_data);
       $new_filename $temp_data[0] . $width .'-'$height .'.'$ext;
       $source_path $filename;

       $folder_path '';
       $temp_folder explode('/',$target_folder);

       foreach ($temp_folder as $folder) {
           $folder_path .=$folder '/';
           if (!file_exists($folder_path)) {
       $target_path $target_folder;


       $config_manip = array(
           'image_library'     => 'gd2',
           'source_image'      => $source_path,
           'maintain_ratio'    => FALSE,
           'new_image'         => $target_path,
           'create_thumb'      => TRUE,
           'thumb_marker'      =>  $width '-'$height,
           'width'             => $width,
           'height'            => $height
       if (!$this->image_lib->resize()) {
           echo $this->image_lib->display_errors();
           echo "<br>";
           echo $config_manip['source_image'];
       // clear //
       return $folder_path $new_filename;

This function only work for one time. I'm calling this function from a loop to resize multiple images. the code of the loop is like this.
PHP Code:
foreach ($data['distributors'] as $key => $item){
    $target_folder 'uploads/images/cache/distributor/profile-image';
    $name $this->do_resize($item['profile_image'], $target_folder128,128);
    $data['distributors'][$key]['profile_image'] =  base_url($name);
    $data['distributors'][$key]['added_date'] =  date($this->dateFormatstrtotime($item['added_date']));

I'm expecting from this code is that. When I starts the loop, at each attrition of the loop it takes the profile-image path and pass to the do_resize() function which will resize the image and store it in a target folder. But it works only for first attrition of the loop. and remaining profile-images are not resized. 

Any one can help me to solve this issue. Thanks

  Ajax 403 error
Posted by: pippuccio76 - 10-18-2017, 01:57 PM - Forum: General Help - Replies (2)

HI , sorry for english , in my form , i want populate a select by searching value inserting a substring ( with like select ),

This is Jquery code :


$( document ).ready(function() {
   var stato=$("#id_class_stato_agenda_id option:selected").val();

    $("#id_class_stato_agenda_id").change(function() {
     var stato=$("#id_class_stato_agenda_id option:selected").val();
      if(stato=='1' ||  stato=='2'){
       var ragione_sociale_getted = $("#ragione_sociale").val();
       var csrfName = '<?php echo $this->security->get_csrf_token_name(); ?>';
       var csrfHash = '<?php echo $this->security->get_csrf_hash(); ?>';
           type: "POST",
           url: "<?=base_url()?>index.php/clienti/ricerca_clienti_select",
           data: {
               ragione_sociale:ragione_sociale_getted ,
           dataType: "html",
           success: function(msg)
           error: function()
             alert("Chiamata fallita, si prega di riprovare...");


This is  the controller :
this is the  controller function :

PHP Code:
   public function ricerca_clienti_select() {
       $this->output->set_content_type('application/json')->set_output(json_encode(array( 'csrf' => $csrf)));
(!empty($this->input->post('ragione_sociale'))) {

           $lista $this->clienti_model->recupera_by_name($ragione_sociale);

           foreach ($lista->result() as $row) {
               echo "<option value='" $row->id_clienti " '>";
               echo $row->ragione_sociale;
               echo "</option> ";

This is error :

jquery-3.2.1.js:9566 POST https://www.mysite.it/gest/index.php/cli...nti_select 403 (Forbidden)
 XHR failed loading: POST "https://www.mysite.it/gest/index.php/clienti/ricerca_clienti_select".

  Searching for hashtags in text field using active record?
Posted by: GGitzOle - 10-18-2017, 08:51 AM - Forum: General Help - Replies (1)


I have a table that is used to store user_posts. It has a text field called content (TEXT). Users can post #hashtags #our #cool.

I'm trying to run a database search using active record to find the specific hashtags.

When I run:

PHP Code:

It doesn't correctly return all posts with the #cool, but instead all posts containing a #. I ran the query in PhpMyAdmin and it worked perfectly fine.

When I run $this->db->last_query(); it outputs pretty much the same SQL:

SELECT * FROM user_posts WHERE content LIKE '%#cool%' ESCAPE '!'

Does anyone have any experience with what could be causing this issue?

  CI_Email::from() ignores the display name in the email address
Posted by: daveherman - 10-18-2017, 05:39 AM - Forum: Libraries & Helpers - Replies (1)

When specifying an email address that contains a display name the from() method in the Email class ignores that display name.

The following example code illustrates my point:

PHP Code:
$email_address "Name of Sender <[email protected]>";


$this->email->to('[email protected]');
$this->email->subject('Email Test');
$this->email->message('Testing the email class.');

The recipient then receives an email that looks something like this:

From: [email protected]
Sent: 18 October 2017 10:08 AM
To: [email protected]
Subject: Email Test

Testing the email class.

My work around is to parse the email address and look for a display name in the event that one is not provided, as follows:

PHP Code:
// Line 483 - 486 in the Email class:

if (preg_match('/\<(.*)\>/'$from$match))
$from $match[1];

I have changed to:

PHP Code:
if (preg_match('/\<(.*)\>/'$from$match))
$from $match[1];

    if (empty(
$name trim(str_ireplace('<' $match[1] . '>'''$from));

The resulting message then correctly reflects the sender's email address and display name, as follows:

From: Name of Sender <[email protected]>
Sent: 18 October 2017 10:08 AM
To: [email protected]
Subject: Email Test

Testing the email class.

I hope this helps someone as the administrators don't feel that it is useful enough to be incorporated in the Email class.

Please Note

I am aware that there is an additional parameter in the CI_Email::from() method that allows you to specify a display name but then you would have to parse and interrogate the email address before invoking the method in order to separate the email address and the display name which you must then submit as two separate parameters.

This would be a lot of unnecessary coding on your part and my solution handles this for you as part of the class method.

  Asset Compress & Management
Posted by: dimsagara - 10-18-2017, 02:48 AM - Forum: CodeIgniter 4 Feature Requests - Replies (1)

Like Yii2 Asset Bundle. So i can split between vendor library (like bootstrap & jquery) and my own custom css and javascript with asset compression. here for reference Yii2 Asset Bundle. Thanks

Music Datetime Helper
Posted by: dimsagara - 10-18-2017, 02:13 AM - Forum: CodeIgniter 4 Feature Requests - Replies (4)

such as "Now", "Yesterday", "Tomorrow", "Last Week", "A few minute ago (like Facebook)" and others, and day counting of two date entries. and generating distance between these 2 dates in units of days, months, years, or even hours.

I think it can help for sorting article by date Entries. Thanks

  What to return in controller
Posted by: romankubis - 10-18-2017, 01:39 AM - Forum: Model-View-Controller - Replies (2)

I would like to ask, what to return in controller if I am expecting XMLHttpRequest but request is not XMLHttpRequest.
I have something like this:

public function show_post($id)
 if (!$this->input->is_ajax_request())
   return false;
 $data = $this->some_model->post($id);
 return json_encode($data);

Is it good to return false or return other value?
Thank you.

  CSZCMS 1.1.8
Posted by: Ponchale - 10-17-2017, 06:24 PM - Forum: Addins - No Replies

CSZ CMS upgrade news about version 1.1.8, Have many bug to fixed and add new feature. We improve the performance.

[Image: 1503069696_1-org.png]

  • Add more meta tag field on content page.
  • Add plugin frontend view for support the custom template.
  • Add content support with [? startform_post:form_name{action_url}][/? endform] and [? startform_get:form_name{action_url}][/? endform].
  • Add widget xml for album view in gallery plugin.
  • Add Form Builder with upload files option and can sort the field on form edit page.
  • Add test send email to default email in 'Site Settings'.
  • Add export and import function on backend with CSV file.
  • Add uninstall the plugin function on plugin store and plugin search.
  • Add file manager for template and cms config (elFinder).
  • Add member frontend view for support the custom template.
  • Add app manifest (add to homescreen) on mobile for backend.
  • Add static frontend view for support the custom template (Error 404, Banner, Linkstats).
  • Add template generater tools in file manager page on backend.
  • Add startup function for run after login. For plugin config $plugin_config['backend_startup'] and $plugin_config['frontend_startup'].
  • Add facebook page id in Site Settings.
  • Add static resources from a different cdn domain setting in Site Settings.
  • Update TinyMCE to 4.6.6.
  • Update Codeigniter to 3.1.6.
  • Improve performance.
  • Support with APC or Memcached or Redis.
  • Improve seo support.
  • Improve IP deny system for CSRF and Brute Force attack.
  • Fixed article rss feed to support 'Facebook Instant Articles'.
  • Fixed for error 404 override page.
  • Fixed for hosting been disabled allow_url_fopen.
  • Fixed article plugin bug.
  • Fixed plugin backend language to default when the language file not found.
  • Fixed the csz cms version checking on plugin store. The plugin can't update if not upgrade the csz cms.
  • Fixed for curl error 60 on windows when the php been disabled allow_url_fopen.
  • Fixed default page with plugin and pages content.
This upgrade has many bug to fixed and add new feature.
This version available now. Please check your backend system to upgrade.
If you find the bug for CSZ CMS. Please tell us at here

Page on SourceForge

  Migration to Codeigniter 3 from 2
Posted by: pbiffar - 10-17-2017, 11:57 AM - Forum: Jobs - Replies (2)

We are based in California and are looking for a developer to help us to migrate to Codeigniter 3 from 2 along these 21 Steps .. . https://www.codeigniter.com/user_guide/installation/upgrade_300.html

We are looking for someone experienced, based in North America to go through our CI2 application and update it to the CI3 requirements, then to upgrade us to 3. For example all our classes would need to be renamed to begin with a capital letter. We have 2 applications (admin, user) each with about 40 controllers and 40 models. 

We also would like to review our security and see how we can strengthen the code utilizing CI 3 features.

Please only contact us if you have solid EXPERIENCE with CI, and can provide evidence of that.

  Proper use of join
Posted by: glorsh66 - 10-17-2017, 11:10 AM - Forum: General Help - Replies (2)

I got a problem - when i use code like this one

$this->db->select('u.id, u.username, c.name', false);
$this->db->from('user as u');
$this->db->join('companies as c', 'u.company_id = c.id');
$this->db->where('LOWER(u.username)=', strtolower('foobar'));
$query = $this->db->get();

i loose all my id.
I tried to change names of id fields to something like user_id, but CI don't work well without column named precisely id.

How to don't loose id field?
And is possible to get an object representation after a querry that uses a join statement?

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2017 MyBB Group.