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

Username/Email:
  

Password
  





Search Forums

(Advanced Search)

Forum Statistics
» Members: 9,932
» Latest member: Ana Lima
» Forum threads: 66,937
» Forum posts: 419,341

Full Statistics

Latest Threads
This page isn’t working u...
Forum: General Help
1 hour ago
» Replies: 0   » Views: 10
Google Chrome Moving to a...
Forum: Lounge
1 hour ago
» Replies: 4   » Views: 327
Problem with session file...
Forum: Issues
5 hours ago
» Replies: 2   » Views: 67
CSRF and Browser Cookie S...
Forum: General Help
5 hours ago
» Replies: 13   » Views: 450
language subdomains
Forum: Best Practices
11 hours ago
» Replies: 6   » Views: 275
Error 404 with unicode ch...
Forum: General Help
Yesterday, 01:55 PM
» Replies: 1   » Views: 65
Calling multiple header/f...
Forum: General Help
Yesterday, 01:39 PM
» Replies: 3   » Views: 65
Hello
Forum: Choosing CodeIgniter
Yesterday, 01:18 PM
» Replies: 1   » Views: 55
Routes and hashed URLs
Forum: General Help
Yesterday, 12:03 PM
» Replies: 6   » Views: 124
testing with phpunit in p...
Forum: CodeIgniter 4 Support
Yesterday, 11:11 AM
» Replies: 0   » Views: 36

 
Rainbow This page isn’t working using while loop.
Posted by: nadeem14375 - 1 hour ago - Forum: General Help - No Replies

hi all,

I have a strange problem in my application. unable to loop through an array. 

here my code:

Controller:

Code:
  public function rep_fee_invoice_4class()
   {
       
       $data = array(  
                   //'fee_type'    => $this->input->post('fee_type'),
                   'id'     => $this->input->post('class')
                   );

       $this->data['fee_detail']= $this->Fee_model->get_fee_invoice_4class($data);
       
       $this->load->view('reports/rep_fee_invoice_4class_html', $this->data , TRUE); 
   }    

Model:
Code:
  public function get_fee_invoice_4class($data){

   $class_condition = "WHERE studentclass=". $data['id'];

   $student_query=$this->anotherDb->query("SELECT * from
       users $class_condition
       AND activated =1
       AND role = 'Student'");


$totalrows = $student_query->num_rows();

               for($i=0;$i<$totalrows;$i++) {
                             
           $result = $student_query->result_array();
           $student_id = $result[$i]['id'];

                       $student_condition = "WHERE paymentStudent=". $student_id;
                       $query=$this->anotherDb->query("
                           SELECT paymentStudent, feeMonth, paymentDescription, paymentamount
                           FROM payments
                           $student_condition
                           AND date_format(feeMonth, '%d-%m-%Y') >= date_format(curdate(), '00-%m-%Y')
                           AND PAYMENTSTATUS =0");
                   }
       return $query->result_array();
   }

View:

Code:
<?php

do {

       ?> <table>
       <?php
               if(isset($fee_detail) && is_array($fee_detail) && count($fee_detail)): $i=1;
               foreach ($fee_detail as $key => $data) {
               ?>
               <tr>
                   <td style=" border: 1px solid #555555;"><?php echo $i; ?></td>
                   <td style=" border: 1px solid #555555;"><?php echo $data['paymentStudent']; ?></td>
                   <td style=" border: 1px solid #555555;"><?php echo $data['paymentDescription']; ?></td>
                   <td style=" border: 1px solid #555555;"><?php echo $data['paymentamount']; ?></td>
               </tr>
               <?php
                $i++;
                   
                     }
                   else:
               ?>
               <tr>
                   <td style=" border: solid 1px #000000 colspan="8" >No Records Found..</td>
               </tr>
               <?php
                   endif;

               ?>
       </tbody>
</table>
<?php

}

while ($fee_detail);

?>


  testing with phpunit in phpstorm
Posted by: puschie - Yesterday, 11:11 AM - Forum: CodeIgniter 4 Support - No Replies

hey,
currently im trying to get phpunit run all tests ( include own application tests ) in phpstorm.

1. install all dependency via composer
  ( got an error on extractTo phpunit/php-code-coverage : no such file or stream | and git was not found : github.com/sebastianbergmann/php-code-coverage.git ) -> guess i dont need this for testing, so just as notice

2. download phpunit.phar and select it in Settings/Languages&Frameworks/PHP/TestFramework

when i try to run a test without the configuration file i get :
   Fatal error: Class 'CodeIgniter\Test\CIDatabaseTestCase' not found

when i try to run a test with the configuration file ( phpunit.xml.dist ) i get :
  require(application/Config/Paths.php): failed to open stream [...] \tests\_support\_bootstrap.php on line 10


im very new to phpunit - so maybe i miss some phpstorm configuration, but when i use the build-in test creation it work ( but i dont get codeignigter to run in a TestCase class )

thx for reading - hope someone had the same problems and solved it^^


  Error 404 with unicode character in the URL like Japanese
Posted by: phongtnit - Yesterday, 08:20 AM - Forum: General Help - Replies (1)

Hi,

I want to allow Unicode character in the URL like Japanese.

I added in my route.php

Quote:$route['category/(:any)'] = 'Category/view/$1';


When I tried access "category/大人っぽすぎる小学生が中学3年生にもなると.html", it's ok. However with the string "category/筧美和子さんのニットの衣装が素晴らしすぎる.html", it failed and return 404 error (please refer this image https://imgur.com/8lCA7s4 )

I don't know why and how to fix it. Please help me, many thanks,


  Calling multiple header/footer template and setting in route
Posted by: chized - Yesterday, 05:24 AM - Forum: General Help - Replies (3)

Hello everyone
I am new to codeigniter and want to use it for a fairly large project. I intend to use two different bootstrap template.
The first one is working but I don't understand why the second is'nt.
below is the controller code

PHP Code:
?php
    class Pages 
extends CI_Controller{
 
     public function view($page 'home'){
 
       if(!file_exists(APPPATH.'views/pages/'.$page.'.php')){
 
         show_404();
 
       }
 
       $data['title'] = ucfirst($page);
 
       $this->load->view('templates/header');
 
       $this->load->view('pages/'.$page$data);
 
       $this->load->view('templates/footer');
 
     }

 
     public function iview($page 'volunteers'){
 
       if(!file_exists(APPPATH.'views/ipages/'.$page.'.php')){
 
         show_404();
 
       }
 
       $data['title'] = ucfirst($page);
 
       $this->load->view('templates/iheader');
 
       $this->load->view('ipages/'.$page$data);
 
       $this->load->view('templates/ifooter');
 
     }
 
   }
 
?>
Below is the change I made in the application/config/routes.php

Quote:$route['default_controller'] = 'pages/view';
$route['(:any)'] = 'pages/view/$1';
$route['ipages/(:any)'] = 'ipages/iview/$1';
$route['404_override'] = '';
$route['translate_uri_dashes'] = FALSE;


  A new row with a link at the left side of the table
Posted by: FARUKB13 - Yesterday, 04:05 AM - Forum: General Help - Replies (1)

PHP Code:
MODEL:
 
$database $this->verversBelbestand();
 
       if($database == null){
 
           $database $database;
 
       } else {

 
      //Defineer hier de database
 
       $config['hostname'] = 'secret';
 
       $config['username'] = 'secret';
 
       $config['password'] = 'secret';
 
       $config['database'] = $database;
 
       $config['dbdriver'] = 'sqlsrv';
 
       $config['dbprefix'] = '';
 
       $config['pconnect'] = FALSE;
 
       $config['db_debug'] = TRUE;
 
       $config['cache_on'] = FALSE;
 
       $config['cachedir'] = '';
 
       $config['char_set'] = 'utf8';
 
       $config['dbcollat'] = 'utf8_general_ci';

 
       $this->customDb $this->load->database($configtrue);

 
       $this->load->library('table');

 
       $campagne '';
 
       $datum date("Y/m/d");
 
       $bmnrlic $this->getBmnrLicentie();

 
       $this->table->set_heading('Campagne ''Aantal agenten''Nog benaderbaar''Terugbellers''Nog na te kijken''BMNR uitgesloten''Geparkeerd''Maxbeldatum');

 
       $objquery $this->customDb->query("Aantallen_datum_intranet '".$campagne."','".$datum."','".$bmnrlic."'");

 
       $template = array(
 
       'table_open'            => '<table border="1" cellpadding="4" cellspacing="0">',

 
       'thead_open'            => '<thead>',
 
       'thead_close'           => '</thead>',

 
       'heading_row_start'     => '<tr>',
 
       'heading_row_end'       => '</tr>',
 
       'heading_cell_start'    => '<th>',
 
       'heading_cell_end'      => '</th>',

 
       'tbody_open'            => '<tbody>',
 
       'tbody_close'           => '</tbody>',
 
      
        
'row_start'             => '<tr">',
 
       'row_end'               => '</tr>',

 
       'cell_start'            => '<td>',
 
       'cell_end'              => '</td>',

 
       'row_alt_start'         => '<tr>',
 
       'row_alt_end'           => '</tr>',
 
       'cell_alt_start'        => '<td>',
 
       'cell_alt_end'          => '</td>',

 
       'table_close'           => '</table>'
 
           );

 
       $this->table->set_template($template);  
        return $this
->table->generate($objquery); 


VIEW:

Code:
<button onclick="myFunction()" class="btn"><span style="color: green;">Ververs</span></button><br><hr>
<form method="post" accept-charset="utf-8">
<button class="btn dropdown scrollable-menu" type="button" id="" data-toggle="dropdown"  aria-expanded="true">
Terugbel Afpsraken
<span class="caret"></span>
</button>

<br>
<select name="klanten" class="dropdown-menu" onchange="this.form.submit()"> 
<?php foreach($klanten as $row){ ?>
<option value="<?php echo $row->klantnaam;?>"> 
<?php echo $row->klantnaam; ?></option> 
<?php } ?>
</select>
</form>

</div>

<p> <?php echo $terugbel; ?></p>
</div></div>
  
</div>



Well..the title already says it. I have a generated table right now.
But I want an emptry row at the left side of the table with a link in it.
But I have seriously no idea how I should do it..
Anyone who can help me please? Thanks in advance.


  Hello
Posted by: nvquang9999 - Yesterday, 03:36 AM - Forum: Choosing CodeIgniter - Replies (1)

Hi everyone,

I just wanted to say THANK YOU to all contributors on the Choosing CodeIgniter Forum.
I am a newbie, I want to learn more about CodeIgniter. Mong any supporters. thank you


  Problem with session files
Posted by: raffaele.bennoli - Yesterday, 03:18 AM - Forum: Issues - Replies (2)

Hello everybody,

we develop with CI from many years but we have a weird thing that happen with our last project.

We use CI 3.1.3 on virtualized server with VMware. The "sess_driver" parameter is set to "files".

Sometimes we get this error: 

Severity: Warning --> filesize(): stat failed for /webroot/temp/webcrm/evolutionweb_ikbbigqenm63k241vhle4nhh96oshui9 /webroot/engine/system/libraries/Session/drivers/Session_files_driver.php 208

This file is not updated in the latest CI versions.

Looking at the code we think it's something going wrong between row 170 (where file presence is checked) and row 208 (where file is read).

Now we are tring to switch to "tmpfs" to have more fast access to filesystem. No idea if this can fix it.

Any other suggestion or fixes?


  Use namespaces in Codeigniter 3.1.6
Posted by: blackiven - Yesterday, 03:14 AM - Forum: Libraries & Helpers - Replies (3)

Hi, I want to use my own classes but it throws me an type error.

Type: TypeError

Message: Argument 1 passed to Posts::__construct() must be an instance of PostsRepository, none given, called in C:\wamp64\www\ciblog\system\core\CodeIgniter.php on line 518



Here is my code:

Posts.php

PHP Code:
class Posts extends CI_controller
{
    
    public 
function __construct (\application\repositories\posts\PostsRepository $postsRepository) {
      $this->postsRepository $postsRepository;

    }

...... 



PostsRepository.php


PHP Code:
<?php

class PostsRepository() {
    
    public 
function all(){

        return \application\models\Post_model->get_posts();

    }



How can I solve this problem? Thank you!!!


  Routes and hashed URLs
Posted by: wirikidor - 11-21-2017, 06:11 PM - Forum: General Help - Replies (6)

I started a projected and noticed that it was getting rather large, so I decided I needed to go to a framework like CI.  So I just set up a new site and I'm setting up the basic functionality but one of the important things about my site is the URLS.  Here's an example:

http://ffbeben.ch/6mqv4mi6wtilgjdgxrgjdg...dgxrgjdgxr

So if you use this URL, and you click on the Head slot and pick an item, the URL will reload to something like this:

http://ffbeben.ch/6mqv4mi6wtilgjdgxr6nyl...dgxrgjdgxr

The reason for this is I want people to be able to build a unit, and then copy and paste the URL to share with other people.

I accomplished this by doing this in the .htaccess

Code:
RewriteEngine On

RewriteCond %{REQUEST_URI} !^/assets
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteCond %{SCRIPT_FILENAME} !-f



RewriteRule ^(\w+)$ ./index.php?$1

Now moving to CI, I'm a bit at a loss as how to accomplish the same thing.  I've tinkered around with trying to use the same regex in the routes file but I'm not having a whole lot of luck.  Everything I try just results in a 404.

Any advice or guidance would be appreciated.


  google map issue
Posted by: niki - 11-21-2017, 08:26 AM - Forum: General Help - No Replies

Hi ,I have attached library google map v3 API and now i need to fetch Latitude and longitude from database which I have calculated and which should display by serial  Every time dynamically.I used marker but it's not displaying .Does anyone can help me to solve this problem?
controller:
function Googlemaps($serial)
    {
        // Load the library
            $this->load->library('googlemaps');
            $config['minifyJS'] = TRUE;
            //$config['center_lat_long']= '030.259565,-81.61062';//30.25953,-81.611
            //$config['zoom']=16;
            
        // Initialize our map. Here you can also pass in additional parameters for customising the map
            $this->googlemaps->initialize($config);

            $coords=$this->dashboard_model->googlemaps($serial);var_dump($coords);            
            foreach($coords as $coordinate)
            {
                $marker=array();
                $lat1=$coordinate->cycle_19_INT.(substr($coordinate->cycle_20_INT, 0, 2)+(substr($coordinate->cycle_20_INT, 2).".".$coordinate->cycle_21_INT)/60);
                $lat2=str_replace($coordinate->cycle_22_INT,'-',$coordinate->cycle_22_INT).(substr($coordinate->cycle_23_INT, 0, 2)+substr((substr($coordinate->cycle_23_INT, 2).".".$coordinate->cycle_24_INT)/60,0,7));                
                $lat=$lat1.','.$lat2;

                $marker['position']=$lat;var_dump($lat);
                $this->googlemaps->add_marker($marker);
            }
            
        // Create the map
            $this->data=array();
            $this->data['map'] = $this->googlemaps->create_map();            
        // Load our view, passing the map data that has just been created
            $this->load->view('dashboard/dashboard_googlemap_view', $this->data);

    }
model:
function googlemaps($serial)
    {
        
        $return=array();
        $query=$this->db->select('cycle_19_INT,cycle_20_INT,cycle_21_INT,cycle_22_INT,cycle_23_INT,cycle_24_INT')->from('cycles')->where(array('cycle_serial'=>$serial))->limit(1)->order_by('cycle_timestamp','DESC')->get();
        
        if($query->num_rows()>0)
        {
            foreach($query->result() as $row)
            {
                array_push($return,$row);
            }
        }
        return $return;    
    }

view:
<?php echo $map['javascript'];?>      <?php echo $map['mapdiv']; ?>



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