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

Username/Email:
  

Password
  





Search Forums

(Advanced Search)

Forum Statistics
» Members: 8,447
» Latest member: saifabid123
» Forum threads: 65,881
» Forum posts: 413,906

Full Statistics

Latest Threads
Ecommerce website in CI
Forum: Choosing CodeIgniter
4 hours ago
» Replies: 13   » Views: 624
updating on database with...
Forum: General Help
4 hours ago
» Replies: 0   » Views: 25
SVG Library for Codeignit...
Forum: Libraries & Helpers
5 hours ago
» Replies: 1   » Views: 38
GZip Compression for Webs...
Forum: Best Practices
7 hours ago
» Replies: 5   » Views: 232
How to integrate already ...
Forum: General Help
Today, 04:57 AM
» Replies: 2   » Views: 115
Bug in postgre drivers..
Forum: Issues
Today, 03:42 AM
» Replies: 0   » Views: 32
Ignition Go - update - re...
Forum: Addins
Today, 12:25 AM
» Replies: 8   » Views: 1,403
German User
Forum: Regional User Groups
Yesterday, 11:57 PM
» Replies: 4   » Views: 268
[Solved] Unsetting Sessio...
Forum: General Help
Yesterday, 11:13 PM
» Replies: 3   » Views: 136
CSV Importing Advice
Forum: General Help
Yesterday, 03:16 PM
» Replies: 8   » Views: 283

 
  [Solved] Ajax pagination links triggers off canvas to open?
Posted by: wolfgang1983 - 04-25-2017, 12:06 AM - Forum: General Help - Replies (1)

I am now using ajax for my codeigniter pagination but when I click on my pagination links It triggers the off canvas to open

How can I prevent the off canvas to open when I click on my pagination links?


PHP Code:
<script type="text/javascript">
$(
document).ready(function() {
var 
menuToggle = $('.toggle-button');
var 
menuToggleIcon menuToggle.find('.fa');
var 
offCanvas = $('.offcanvas');
var 
content = $('.content');

menuToggle.click(function() {
closeMenu(menuToggleIconoffCanvas);
});

content.click(function() {
    closeMenu(menuToggleIconoffCanvas);
});

function 
closeMenu(menuToggleIconoffCanvas) {
    menuToggleIcon.toggleClass('fa-indent fa-outdent');
   offCanvas.toggleClass('open');
}

}); 
</script> 



PHP Code:
<script type="text/javascript">
$(
document).ready(function() {
function 
load_users_data(page){
  $.ajax({
  url:"<?php echo base_url(); ?>dashboard/users_pagination/" page,
  method:"GET",
  dataType:"json",
  success:function(data) {
   $('#users_table').html(data.users_table);
   $('#user_pagination_link').html(data.pagination_link);
  }
  });
}

load_users_data(1);

$(
document).on("click"".user-pag li a", function(event){
  event.preventDefault();
  var page = $(this).data("ci-pagination-page");
  load_users_data(page);
});

});
</script> 


PHP Code:
<script type="text/javascript">
$(
document).ready(function() {
function 
load_users_data(page){
  $.ajax({
  url:"<?php echo base_url(); ?>dashboard/users_pagination/" page,
  method:"GET",
  dataType:"json",
  success:function(data) {
   $('#users_table').html(data.users_table);
   $('#user_pagination_link').html(data.pagination_link);
  }
  });
}

load_users_data(1);

$(
document).on("click"".user-pag li a", function(event){
  event.preventDefault();
  var page = $(this).data("ci-pagination-page");
  load_users_data(page);
});

});
</script> 



Attached Files
.php   Dashboard.php (Size: 3.13 KB / Downloads: 26)

  How to format template?
Posted by: PolkaDodge - 04-24-2017, 10:27 AM - Forum: Model-View-Controller - Replies (6)

Hi im new to codeigniter and im just wondering on how to format the data from a template.

I can format data coming from a row_array result since i dont need to loop it but how can i format data coming from a result_array()??


If i use foreach in controller to format the data i cant loop them in views.

Controller:

Code:
public function loadClients(){
    $clientsTotal = $this->client_list_model->getClientTotal();
    $activeCount = $this->client_list_model->activeCount();
    $inactiveCount = $this->client_list_model->inactiveCount();
    $archiveCount = $this->client_list_model->archiveCount();

    $data = array(
        'project_total' => $clientsTotal['projects_total'],
        'pending_total' => $clientsTotal['pending_total'],
        'on_going_total' => $clientsTotal['on_going_total'],
        'completed_total' => $clientsTotal['completed_total'],
        'cancelled_total' => $clientsTotal['cancelled_total'],
        'total_price' => number_format($clientsTotal['total'],2),
        'paid_total' => number_format($clientsTotal['paid_total'], 2),
        'balance_total' => number_format($clientsTotal['balance_total'],2),
        'held_price_total' => number_format($clientsTotal['held_price_total'],2),

        'client_total' => $clientsTotal['client_total'],
        'active_count' => $activeCount['active'],
        'inactive_count' => $inactiveCount['inactive'],
        'archive_count' => $archiveCount['archive']
    );

    $data['clients'] = $this->client_list_model->getClients();// I would like to format these results
    $data['title'] = 'Client List';

    $this->load->view('templates/header');
    $this->load->view('pages/activities');
    $this->parser->parse('pages/client_list', $data);
    $this->load->view('templates/footer');
}

Model:
Code:
function getClients(){
        $this->db->select("c.client_id, c.company_name, count(p.project_id) AS projects,
            count(CASE WHEN p.project_status = 'Pending' THEN p.project_status END) AS pending,
            count(CASE WHEN p.project_status = 'On Going' THEN p.project_status END) AS on_going,
            count(CASE WHEN p.project_status = 'Completed' THEN p.project_status END) AS completed,
            count(CASE WHEN p.project_status = 'Cancelled'THEN p.project_status END) AS cancelled,  
            sum(p.total_price) AS total_price, sum(p.paid) AS paid, sum(p.balance) AS balance,
            sum(p.held_price) AS held_price, c.client_status");
    $this->db->from('clients c');
    $this->db->join('projects p', 'c.client_id = p.client_id', 'LEFT');
    $this->db->group_by('c.client_id');
    $clients = $this->db->get();
    return $clients->result_array();
}


View:
Code:
{clients}
    <tr>
            <td class="left">{client_id}</td>
            <td class="left">{company_name}</td>
            <td>{projects}</td>
        <td>{pending}</td>
        <td>{on_going}</td>
        <td>{completed}</td>
        <td>{cancelled}</td>
        <td>{total_price}</td>
        <td>{paid}</td>
        <td>{balance}</td>
        <td>{held_price}</td>
        <td>
                <span>{client_status}</span>
            <a href="client_profile/{client_id}" class="view button">View</a>
        </td>
    </tr>
{/clients}

I would like to be able to number format or date format the result coming from the model in controllers which is
Code:
$data['clients'] = $this->client_list_model->getClients();


  priority of validation
Posted by: yuki - 04-24-2017, 09:03 AM - Forum: Libraries & Helpers - Replies (4)

I studying "Form Validation" while surfing the net.
It's written by much Website as follows.

Code:
$this->form_validation->set_rules("email", "E-MAIL", "required|trim|callback_validate_credentials");

More than one rule and callback are included by this example.

validate_credentials() is check whether the character string to which that was handed exists in the data base.

But even if a blank is sent, an required error message isn't output, and an error of callback is output.
I'd like to check the required confirmation first.
How should the order of priority be specified?


  base_url() returning ip instead of url in 3.1.3
Posted by: crouchkl - 04-24-2017, 08:52 AM - Forum: Issues - Replies (2)

I'm having a weird issue where base_url() is returning the IP address of the server instead of the actual URL. I have the site in a folder on the server, similar to another site that I have that's running codeigniter 3.0.6.

The older site is https://www.klccomputing.com/tracker and is running 3.0.6 and works just fine.
The newer site is https://www.klccomputing.com/icingOnTheCake and is running 3.1.3, but returns the IP.

Is there some sort of configuration change that would cause this difference?


  Search filter using ajax
Posted by: rohitwagh150 - 04-24-2017, 04:13 AM - Forum: General Help - Replies (1)

Hiii,

I have developed shopping website. But while searching product i have filter that using ajax but stuck somehow ....please help me...

here is my code....

Code:
 
    <div class="row" style="margin-bottom: -30px; border: 1px lightgray inset; background-image: url('<?php echo base_url();?>assets/images/headerbanner3.jpg')">
       <nav class="navbar-form" style="margin-left: 25%; ">
           <form action="<?php echo base_url();?>resource_controller/search_users" method="POST">
               <input type="hidden" id="multiskills" name="multiskills">
                                <script type="text/javascript">
                                        function allskill() {
                                        var mk = $('#selskill').val();
                                        document.getElementById('multiskills').value = mk;
                                    }
                                        </script>
                                        <select class="selectpicker" multiple data-live-search="true" id="selskill" name="selskill" required="required"
                                                data-live-search-placeholder="Search" data-actions-box="true">
                            <?php 
                            $sk=$this->skills_model->get_skills();
                            foreach ($sk->result() as $row) {
                                echo '<option>';
                                echo $row->name;
                                echo '</option>';
                            }
                            
                            ?>
                                </select>  
          <button type="submit" class="btn btn-success input-group" onclick="javascript:allskill()">
                                    <i class="fa fa-search"></i> Search</button>
        </form>
            <div style="margin-left: 80%"><a> sort by </a>
               <select name="filter" class="form-control">
                   <option>Qualification</option>
                   <option>Experience</option>
                   <option>Ranking</option>
               </select>
            </div>                               
      </nav>
    </div>
    <div class="container-fluid" style="">
<div class="modal-dialog  pull-left" style="width: 25%; ">
    <!-- Modal content-->
    <div class="modal-body">
        <div class="row">
            <article role="login" style="min-height: 400px;">
                <form name="filters" action="<?php echo base_url('resource_controller/view_div');?>">
                <div class="pull-left">
                    <h4 class="text-center"><i class="fa fa-filter"></i> Filter By Region </h4></div><br><br>
                    <div class="form-group">
                        <div class="regions">
                         <label class="check-inline">
                             <input type="checkbox" id="sangli" name="region[]" value="Sangli" class="category"
                                    onclick="javascript:updateregion()" 
                                    > Sangli</label><br>
                         <label class="check-inline">
                             <input type="checkbox" id="satara" name="region[]" value="Satara" class="category"
                               onclick="javascript:updateregion()" 
                               >Satara</label><br>
                        <label class="check-inline">
                            <input type="checkbox" id="kolhapur" name="region[]" value="Kolhapur" class="category"
                               onclick="javascript:updateregion()" 
                               >Kolhapur</label><br>
                        <label class="check-inline">
                            <input type="checkbox" id="solapur" name="region[]" value="Solapur" class="category"
                                   onclick="javascript:updateregion()" 
                                   >Solapur</label><br>
                            <input type="hidden" name="filterbyregion" id="filterbyregion"> 
                        <script type="text/javascript">
                            function updateregion() {
                                var textbox = "";
                                var rgns = [];
                             if(document.getElementById('sangli').checked) {
                                 if (textbox == "") {
                                     textbox += "Sangli";
                                 } else {
                                     textbox += ", Sangli";
                                 }
                                 rgns.push('sangli');
                                }
                                if(document.getElementById('satara').checked) {
                                  if (textbox == "") {
                                     textbox += "Satara";
                                 } else {
                                     textbox += ", Satara";
                                 }
                                 rgns.push('satara');
                                }
                                if(document.getElementById('kolhapur').checked) {
                                  if (textbox == "") {
                                     textbox += "Kolhapur";
                                 } else {
                                     textbox += ", Kolhapur";
                                 }
                                 rgns.push('satara');
                                }
                                if(document.getElementById('solapur').checked) {
                                  if (textbox == "") {
                                     textbox += "Solapur";
                                 } else {
                                     textbox += ", Solapur";
                                 }
                                 rgns.push('satara');
                                }
                                document.getElementById('filterbyregion').value = textbox;
                              //  document.filters.submit();
                                jQuery.ajax({
                                    url: '<?php echo site_url();?>resource_controller/view_div',
                                    type: "POST",
                                    data: {"txt": textbox},
                                    success: function() {
                                $('#filter_div').load('<?php echo site_url();?>resource_controller/view_div');
                                  },
                                    error: function(error) {
                                        console.log(error);
                                    }
                                 });
                            }
                            
                        </script>
                    <div class="panel group">
                        <div class="panel panel-default">
                            <div class="panel-heading">
                            <h4 class="panel-title">
                                <a data-toggle="collapse" href="#collapse1">
                                    <i class="fa fa-plus"></i> More Regions</a>
                            </h4>
                            </div>
                            <div id="collapse1" class="panel-collapse collapse">
                        <div class="panel-body">
                        <?php $attribut = array("name" => "form", "id" => "form");
                            echo form_open("resource_controller/view_div", $attribut);?>
                            <script type="text/javascript">
                                function filterregion() {
                            document.getElementById('filterbyregion').value = document.getElementById('district').value;
                            $("#form").submit();
                            }
                            </script>
                            <div class="form-group">
                            <label class="col-md-3 control-label">State</label>
                            <div class="col-md-9">
                                <?php $attribut = 'id="state" class="form-control"';
                                    echo form_dropdown('state', $state, set_value('state'), $attribut); ?>
                            </div>
                            </div> <div class="clearfix"></div><br>
                            <div class="form-group">
                                <label class="col-md-3 control-label">District</label>
                                <div class="col-md-9">
                                <?php $attribut = 'id="district" class="form-control"';
                                $distattribut = array("name" => "form", "id" => "form");
                                    echo form_dropdown('district', $district, set_value('district'), $attribut,
                                            'onChange="javascript:filterregion()"'); ?>
                                </div>
                            </div><div class="clearfix"></div><br>
                            <div class="form-group">
                                <label class="col-md-3 control-label">Taluka</label>
                                <div class="col-md-9">
                                <?php $attribut = 'id="taluka" class="form-control"';
                                    echo form_dropdown('taluka', $taluka, set_value('taluka'), $attribut); ?>
                                </div>
                            </div>
                        <?php echo form_close(); ?>
                        </div></div>
                        </div>
                        <div class="clearfix"></div><br>
                        
                    </div>
                        </div></div>
                    <div class="pull-left">
                    <h4 class="text-center"><i class="fa fa-user"></i> Qualification </h4></div><br><br>
                    <div class="form-group">
                         <label class="check-inline">
                             <input type="checkbox" id="mcom" name="MCom"> MCom</label><br>
                         <label class="check-inline">
                        <input type="checkbox" id="ba" name="BA"> BA</label><br>
                        <label class="check-inline">
                        <input type="checkbox" id="hsc" name="HSC"> HSC</label><br>
                        <label class="check-inline">
                        <input type="checkbox" id="ssc" name="SSC"> SSC</label><br>
                    <div class="panel group">
                        <div class="panel panel-default">
                            <div class="panel-heading">
                            <h4 class="panel-title">
                                <a data-toggle="collapse" href="#collapse2">
                                    <i class="fa fa-plus"></i> More Qualification</a>
                            </h4>
                            </div>
                            <div id="collapse2" class="panel-collapse collapse">
                        <div class="panel-body">
                            <select id="qualification" name="qualification" class="form-control">
                                
                            <?php 
                            foreach ($courses as $course) {
                                 ?>
                                <option><?php echo $course;?></option>
                                <?php
                             }
                            ?></select>
                        </div></div>
                        </div>
                        <div class="clearfix"></div><br>
                    </div>
                    </div>
                    <div class="pull-left">
                    <h4 class="text-center"><i class="fa fa-user"></i> Experience </h4></div><br><br>
                    <div class="form-group">
                         <label class="check-inline">
                             <input type="checkbox" id="exp" name="exp"> More than 5 years</label><br>
                         <label class="check-inline">
                        <input type="checkbox" id="exp5" name="exp5"> 2 to 5 years</label><br>
                        <label class="check-inline">
                        <input type="checkbox" id="exp2" name="exp2"> 0 to 2 years</label><br>
                        <label class="check-inline">
                            <input type="checkbox" id="fresher" name="Fresher"> Fresher</label><br><br><br>
                    </div> 
                    
                    <div class="pull-left">
                    <h4 class="text-center"><i class="fa fa-user"></i> Ranking </h4></div><br><br>
                        <div class="radio">
                            <label><input type="radio" name="ranking" value="4,5" id="rad1"
                                          onclick="javascript:ranking()">
                                <i class="fa fa-star"></i> <i class="fa fa-star"></i> <i class="fa fa-star"></i>
                                <i class="fa fa-star"></i> <i class="fa fa-star-o"></i> & up</label><br>
                                
                                <label><input type="radio" name="ranking" value="3,4,5" id="rad2"
                                              onclick="javascript:ranking()">
                                    <i class="fa fa-star"></i> <i class="fa fa-star"></i>
                                    <i class="fa fa-star"></i> <i class="fa fa-star-o"></i> 
                            <i class="fa fa-star-o"></i> & up</label><br>
                            
                            <label><input type="radio" name="ranking" value="2,3,4,5" id="rad3"
                                          onclick="javascript:ranking()">
                                <i class="fa fa-star"></i> <i class="fa fa-star"></i>
                                <i class="fa fa-star-o"></i> <i class="fa fa-star-o"></i> 
                            <i class="fa fa-star-o"></i> & up</label> <br>
                                <label><input type="radio" name="ranking" value="1,2,3,4,5" id="rad4"
                                              onclick="javascript:ranking()">
                                    <i class="fa fa-star"></i> <i class="fa fa-star-o"></i>
                                    <i class="fa fa-star-o"></i> <i class="fa fa-star-o"></i> 
                            <i class="fa fa-star-o"></i> & up</label><br>
                            <input type="hidden" id="selrank" name="selrank">
                            <script type="text/javascript">
                            function ranking() {
                                alert('ranking');
//                                if(document.getElementById('rad1').checked) {
//                                    document.getElementById('selrank').value = document.getElementById('rad1').value;
//                                    $("#rankingform").submit();
//                                }
//                                if(document.getElementById('rad2').checked) {
//                                    document.getElementById('selrank').value = document.getElementById('rad2').value;
//                                    $("#rankingform").submit();
//                                }
//                                if(document.getElementById('rad3').checked) {
//                                    document.getElementById('selrank').value = document.getElementById('rad3').value;
//                                    $("#rankingform").submit();
//                                }
//                                if(document.getElementById('rad4').checked) {
//                                    document.getElementById('selrank').value = document.getElementById('rad4').value;
//                                    $("#rankingform").submit();
//                                }
                            }    
                            </script>
                        </div>
                    </form>
            </article>
        </div>
    </div>
</div>

<div class="modal-dialog pull-right" id="filter_div" style="width: 75%; height: auto;">
    <?php $this->load->view('/web/filtered_resources');?>
    <!--<iframe src="<?php //$this->load->view('/web/filtered_resources');?>"></iframe>-->
</div>
</div></div>

Code:
public function search_users() {
            $rgn = str_replace(",", "','", $this->input->post('filterbyregion'));
            $rank = str_replace(",", "','", $this->input->post('ranking'));
            $exp = str_replace(",", "','", $this->input->post('selexperiance'));
            $qual = str_replace(",", "','", $this->input->post('qualification'));
            //$sk = $this->session->userdata('skills');
            $mskills = str_replace(",", "','", $this->input->post('multipleskills'));
            $multiskills = str_replace(",", "','", $this->input->post('multiskills'));
            $filterskills = str_replace(",","','", $this->input->post('filterskills'));
            $sk = "";
            if ($mskills != "") {
                $sk = $mskills;
            } else 
            if ($multiskills != "") {
                $sk = $multiskills;
            } else 
            if ($filterskills != ""){
                $sk = $filterskills;
            }
            $this->q['h'] = $this->resource_model->search_users($sk,$rgn,$qual,$exp,$rank);
            $this->q['state'] = $this->place_model->get_state();
            $this->q['district'] = $this->place_model->get_district();
            $this->q['taluka'] = $this->place_model->get_taluka();
            $this->q['courses'] = $this->course_model->get_all_course_names();
            if(isset($this->q['h']) && $this->q['h']->num_rows() > 0)
            {
                $this->load->view('/web/searched_resources',$this->q);
            }else {
                echo '<script>alert("No resources are available!")</script>';
                $this->load->view('/web/searched_resources');
            }
            return array();
        }



Attached Files
.php   search_controller.php (Size: 1.18 KB / Downloads: 43)
.php   resource_controller.php (Size: 12.72 KB / Downloads: 40)

  Create custom link url for users
Posted by: valkaycelestino - 04-24-2017, 03:12 AM - Forum: General Help - Replies (5)

I have a membership site where people can sign up for an account using their name, phone number and password of choice. The information entered during registration is stored in a MySQL database table called 'users'. The primary key in the users table is the phone number. During sign up, the user has the option to type the phone number of his referrer into 'referrer' field.
I have all these set up and working fine, but I want to enhance the site some more, by:

  1. Creating a unique referral link for users which will have their phone number appended to their link. I want to track which user referred others to my site so I can reward them.
  2. When they share this link, and people click on it, it will take them to the registration page (register.php). On that page he phone number of the referrer will be set (and locked) in the 'referrer' box.
I am new to php and Code Igniter. I have toured the internet looking for a solution to this but i just can't find any. Please any help will be much appreciated.


  Which browser do you guys recommend?
Posted by: markusnippet - 04-24-2017, 01:51 AM - Forum: Lounge - Replies (12)

Hey Guys

On a slightly related point, which browser do you guys use and most recommend?


  How do you document your CI code
Posted by: muuucho - 04-23-2017, 06:11 AM - Forum: Best Practices - No Replies

Does anyone know a smart approach to describe a Codeigniter Workflow for another programmer (or yourself, when you return to your code after 6 months)

I have tried to write down the workflow for Ion_auths forget_password functionality to serve as an example. It goes like this:

Controller/Auth/login()
render(auth/login)

Views/auth/login
Holds a link ‘forgotten_password’, a click calls

Controller/Auth/forgot_password()
render(auth/forgot_password)

Views/Auth/forgot_password
Holds a form with a email field, the form posts back to

Controller/auth/forgot_password($post)
The email is validated and passed to

libraries/ion_auth/forgotten_password($email)
The method calls

models/ion_auth_model/forgotten_password($identity)
A forgotten_password_code is generated and inserted to talbe users to the user with the passed emailadress. Return.

libraries/ion_auth/forgotten_password()
...and so on.


As you can see I came up with a simple formattting system, showing all new requests/calls as a new paragraph with the requests/calls  as headings in bold text.

Now, how do you do? Do you use tables? Paper & pen? Is there any flow-chart programs out there?


  Multiple Pagination
Posted by: wolfgang1983 - 04-22-2017, 11:37 PM - Forum: General Help - Replies (6)

On my index I need to pagination one for users list and one for forum questions.

The pagination links are not working seperate they seem to be working insink with each other.

Even though the config named diffetent? Any ideas what I need to do?


Code:
<?php

class Dashboard extends MY_Controller {

public $data = array();

public function __construct() {
parent::__construct();
$this->load->library("pagination");
$this->load->model('user/user_model');
$this->load->model('forum/question_model');
}

public function index() {
$this->data['title'] = 'Dashboard';
$this->data['is_logged'] = $this->session->userdata('is_logged');

$config1 = array();

$config1['full_tag_open'] = "<ul class='pagination'>";
$config1['full_tag_close'] ="</ul>";
$config1['num_tag_open'] = '<li>';
$config1['num_tag_close'] = '</li>';
$config1['cur_tag_open'] = "<li class='disabled'><li class='active'><a href='#'>";
$config1['cur_tag_close'] = "<span class='sr-only'></span></a></li>";
$config1['next_tag_open'] = "<li>";
$config1['next_tagl_close'] = "</li>";
$config1['prev_tag_open'] = "<li>";
$config1['prev_tagl_close'] = "</li>";
$config1['first_tag_open'] = "<li>";
$config1['first_tagl_close'] = "</li>";
$config1['last_tag_open'] = "<li>";
$config1['last_tagl_close'] = "</li>";
$config1["base_url"] = base_url('dashboard/users/');
$config1["total_rows"] = $this->user_model->total_users();
$config1["per_page"] = 1;
$config1["uri_segment"] = 3;
$config1['use_page_numbers'] = FALSE;

$this->pagination->initialize($config1);

$userspage = ($this->uri->segment(3)) ? $this->uri->segment(3) : 0;

$this->data['users'] = array();

$users = $this->user_model->get_users($config1["per_page"], $userspage);

foreach ($users as $user) {
$this->data['users'][] = array(
'user_id' => $user['user_id'],
'username' => $user['username'],
'status' => ($user['status']) ? 'Enabled' : 'Disabled',
'warning' => '0' . '%',
'date' => date('d-m-Y H:i:s A', $user['date_created_on']),
'href' => site_url('user/profile/') . $user['user_id']
); 
}

$this->data["pag1_links"] = $this->pagination->create_links();

$config2 = array();

$config2['full_tag_open'] = "<ul class='pagination'>";
$config2['full_tag_close'] ="</ul>";
$config2['num_tag_open'] = '<li>';
$config2['num_tag_close'] = '</li>';
$config2['cur_tag_open'] = "<li class='disabled'><li class='active'><a href='#'>";
$config2['cur_tag_close'] = "<span class='sr-only'></span></a></li>";
$config2['next_tag_open'] = "<li>";
$config2['next_tagl_close'] = "</li>";
$config2['prev_tag_open'] = "<li>";
$config2['prev_tagl_close'] = "</li>";
$config2['first_tag_open'] = "<li>";
$config2['first_tagl_close'] = "</li>";
$config2['last_tag_open'] = "<li>";
$config2['last_tagl_close'] = "</li>";
$config2["base_url"] = base_url('dashboard/questions/');
$config2["total_rows"] = $this->question_model->total_questions();
$config2["per_page"] = 1;
$config2["uri_segment"] = 3;
$config2['use_page_numbers'] = FALSE;

$this->pagination->initialize($config2);

$question_page = ($this->uri->segment(3)) ? $this->uri->segment(3) : 0;

$questions = $this->question_model->get_questions($config2["per_page"], $question_page);

$this->data['questions'] = array();

foreach ($questions as $question) {
$this->data['questions'][] = array(
'user_id' => $question['user_id'],
'title' => $question['title']
);
}

$this->data["pag2_links"] = $this->pagination->create_links();

$this->data['navbar'] = $this->load->view('common/navbar', $this->data, TRUE);
$this->data['header'] = $this->load->view('common/header', $this->data, TRUE);
$this->data['footer'] = $this->load->view('common/footer', '', TRUE);
 
$this->load->view('common/dashboard', $this->data);

}
}



Attached Files
.php   Dashboard.php (Size: 3.56 KB / Downloads: 54)

Sad 'Class X not found' error
Posted by: donpwinston - 04-22-2017, 10:26 PM - Forum: CodeIgniter 4 Support - Replies (4)

Code:
<?php namespace App\Libraries;

class BNCdb
{
    private $db = NULL;

    public function __construct()
    {
        try {
            $db = new PDO('informix:host=dev-bnc3-db; database=development; server=devbnc, bncdev, bncdev!');
         $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
     } catch (PDOException $e) {
            log_message('error', $e->getMessage());
        }
    }
}

When I instantiate this class I get a 'Class App\Libraries\PDO not found' error. Why?

PDO is enabled. I'm using PHP 7. Why is it looking in App\Libraries?



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