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

Username
  

Password
  





Search Forums

(Advanced Search)

Forum Statistics
» Members: 14,372
» Latest member: michlalker
» Forum threads: 69,913
» Forum posts: 433,619

Full Statistics

Latest Threads
softDelete and database i...
Forum: CodeIgniter 4 Support
4 hours ago
» Replies: 17   » Views: 555
CodeIgniter 4 Logo
Forum: News & Discussion
7 hours ago
» Replies: 34   » Views: 9,658
Forum registration on hol...
Forum: News & Discussion
7 hours ago
» Replies: 2   » Views: 1,355
CodeModules Language Prop...
Forum: CodeIgniter 4 Discussion
9 hours ago
» Replies: 0   » Views: 70
Codeigniter application: ...
Forum: General Help
Today, 07:53 AM
» Replies: 0   » Views: 103
Undefined variable: admin...
Forum: General Help
Yesterday, 05:06 PM
» Replies: 9   » Views: 1,233
Do you have a hobby?
Forum: Lounge
Yesterday, 05:23 AM
» Replies: 28   » Views: 13,884
Captcha doest work on Lin...
Forum: General Help
Yesterday, 04:09 AM
» Replies: 3   » Views: 443
Jquery UI modal show not ...
Forum: General Help
Yesterday, 01:07 AM
» Replies: 8   » Views: 1,067
How do I replace front-en...
Forum: CodeIgniter 3.x
08-23-2019, 02:42 PM
» Replies: 9   » Views: 489

 
  Installing Ckeditor
Posted by: ronniebel - 08-16-2019, 10:13 PM - Forum: Addins - Replies (7)

I'm a newbie to CodeIgniter and I'm trying to install Ckeditor in my app. I need step by step instructions for that. Any ideas where I can find that?


  Myth Auth
Posted by: InsiteFX - 08-15-2019, 04:20 PM - Forum: CodeIgniter 4 Discussion - Replies (2)

Lonnie,

The app/Config Email.php file has been taken out of the new CI4 development branch,

I had to use the old one for Myth Auth to do the forgot password stuff.

But it is running.

Might be a good idea just to leave the app/Config Email.php in for now it can still
be used for add on Email libaries etc;


  How do I replace front-end views with JSONs in Codeigniter 3?
Posted by: Ajax30 - 08-15-2019, 02:12 PM - Forum: CodeIgniter 3.x - Replies (9)

I am working on a blog application with Codeigniter 3.1.8.

Currently, its admin area is well separated from the frontend. Both the backend (admin area) and the frontend display data using "classic" Codeigniter views.

I thought It would be great if I could replace the classic views of the frontend with JSONS so that they could be formated and displayed using frontend technologies like Vue or Angular, independently of the classic Codeigniter views, that I would only use on the backend.

The JSONS should be spat out directly from the controllers involved in the functioning of the posts and single post pages, without the help of the views.

I need a reliable method for this, as the controllers are quite complex. Here is the Posts controller:

Code:
class Posts extends CI_Controller {

   public function __construct()
   {
       parent::__construct();
   }

   private function _initPagination($path, $totalRows, $query_string_segment = 'page') {
   //load and configure pagination
       $this->load->library('pagination');
       $config['base_url'] = base_url($path);
       $config['query_string_segment'] = $query_string_segment;
       $config['enable_query_strings'] =TRUE;
       $config['reuse_query_string'] =TRUE;
       $config['total_rows'] = $totalRows;
       $config['per_page'] = 12;
       if (!isset($_GET[$config['query_string_segment']]) || $_GET[$config['query_string_segment']] < 1) {
           $_GET[$config['query_string_segment']] = 1;
       }
       $this->pagination->initialize($config);

       $limit = $config['per_page'];
       $offset = ($this->input->get($config['query_string_segment']) - 1) * $limit;

       return ['limit' => $limit, 'offset' => $offset];
   }

   public function index() {

   //call initialization method
       $config = $this->_initPagination("/", $this->Posts_model->get_num_rows());

       $data = $this->Static_model->get_static_data();
       $data['pages'] = $this->Pages_model->get_pages();
       $data['categories'] = $this->Categories_model->get_categories();  

       //use limit and offset returned by _initPaginator method
       $data['posts'] = $this->Posts_model->get_posts($config['limit'], $config['offset']);
       $this->load->view('partials/header', $data);
       $this->load->view('posts');
       $this->load->view('partials/footer');
   }

   public function search() {
  // Force validation since the form's method is GET
       $this->form_validation->set_data($this->input->get());
       $this->form_validation->set_rules('search', 'Search term', 'required|trim|min_length[3]',array('min_length' => 'The Search term must be at least 3 characters long.'));
       $this->form_validation->set_error_delimiters('<p class = "error search-error">', '</p>
           ');
       // If search fails
       if ($this->form_validation->run() === FALSE) {
           return $this->index();
       } else {
           $expression = $this->input->get('search');
           $posts_count = $this->Posts_model->search_count($expression);
           $query_string_segment = 'page';
           $config = $this->_initPagination("/posts/search", $posts_count, $query_string_segment);
           $data = $this->Static_model->get_static_data();
           $data['pages'] = $this->Pages_model->get_pages();
           $data['categories'] = $this->Categories_model->get_categories();
     //use limit and offset returned by _initPaginator method
           $data['posts'] = $this->Posts_model->search($expression, $config['limit'], $config['offset']);
           $data['expression'] = $expression;
           $data['posts_count'] = $posts_count;
           $this->load->view('partials/header', $data);
           $this->load->view('search');
           $this->load->view('partials/footer');
       }
   }

   public function byauthor($authorid){
       $data = $this->Static_model->get_static_data();
       $data['pages'] = $this->Pages_model->get_pages();
       $data['categories'] = $this->Categories_model->get_categories();
       $data['posts'] = $this->Posts_model->get_posts_by_author($authorid);
       $data['posts_count'] = $this->Posts_model->posts_by_author_count($authorid);
       $data['posts_author'] = $this->Posts_model->posts_author($authorid);

       $this->load->view('partials/header', $data);
       $this->load->view('posts_by_author');
       $this->load->view('partials/footer');
   }

   public function post($slug) {
       $data = $this->Static_model->get_static_data();
       $data['pages'] = $this->Pages_model->get_pages();
       $data['categories'] = $this->Categories_model->get_categories();
       $data['posts'] = $this->Posts_model->sidebar_posts($limit=5, $offset=0);
       $data['post'] = $this->Posts_model->get_post($slug);

       if ($data['categories']) {
           foreach ($data['categories'] as &$category) {
               $category->posts_count = $this->Posts_model->count_posts_in_category($category->id);
           }
       }

       if (!empty($data['post'])) {
           // Overwrite the default tagline with the post title
           $data['tagline'] = $data['post']->title;

           // Get post comments
           $post_id = $data['post']->id;
           $data['comments'] = $this->Comments_model->get_comments($post_id);

           $this->load->view('partials/header', $data);
           $this->load->view('post');
       } else {
           $data['tagline'] = "Page not found";
           $this->load->view('partials/header', $data);
           $this->load->view('404');
       }
       $this->load->view('partials/footer');
   }

}

So, I need a rock-solid method to spit all that as JSON at once.

What is the best approach for this?


  Navbar not responsive
Posted by: ronniebel - 08-15-2019, 12:59 PM - Forum: General Help - Replies (7)

My Navbar is not working on mobile.

spokaneesl.com

Any ideas what's going on?

Code:
<html>
<head>
 <title>Spokane Regional ESL Conference</title>
 <link rel="stylesheet" href="https://bootswatch.com/4/flatly/bootstrap.min.css">
</head>
<body>
 <nav class="navbar navbar-expand-lg navbar-dark bg-primary">
   <a class="navbar-brand" href="#"></a>
   <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarColor01" aria-controls="navbarColor01" aria-expanded="false" aria-label="Toggle navigation">
     <span class="navbar-toggler-icon"></span>
   </button>

   <div class="collapse navbar-collapse" id="navbarColor01">
     <ul class="navbar-nav">
       <li class="nav-item active">
         <a class="nav-link" href="#">Home <span class="sr-only">(current)</span></a>
       </li>
       <li class="nav-item">
         <a class="nav-link" href="https://spokaneesl.com/about">About</a>
       </li>
       <li class="nav-item">
         <a class="nav-link" href="https://spokaneesl.com/committee">Committee</a>
       </li>
       <li class="nav-item">
         <a class="nav-link" href="https://spokaneesl.com/schedule">Schedule</a>
       </li>
       <li class="nav-item">
         <a class="nav-link" href="https://spokaneesl.com/presentations">2019 Presentations</a>
       </li>
     </ul>
   </div>
 </nav>
 <hr style="height:30px">


 <center><a href="home"><img src="https://cl.ly/ae16eb233fa4/bright_esl_d.png"></a></center>

 <div class="container">
   <p><hr style="height:30px">


  What are the CI4 ways to use Database and Library in a Helper?
Posted by: webdevron - 08-15-2019, 11:21 AM - Forum: CodeIgniter 4 Discussion - Replies (6)

I need to use a database model and library in my helper. Also need to use a library. In CI 3 I used to do it like following:

PHP Code:
$CI =& get_instance();
$CI->load->model('a_modal');
$CI->load->library('a_library'); 

Now I am little bit confused about the CI 4. What are the ways to do this? What is the CodeIgniter way to do it?

Thanks in advance.


  Best way to project, plan and structure an app with CI
Posted by: Corsari - 08-15-2019, 04:32 AM - Forum: Best Practices - Replies (4)

Hello

from which side do you start building and app?

I mean
given that you already know which the users areas and interactions are and also you already have structured the DB,

do you start with empty controllers and views setting up the navigation and routes?
Or what?

Thank you for sharing your approach

Robert


  Issue loading function
Posted by: Mekaboo - 08-14-2019, 08:41 PM - Forum: General Help - Replies (4)

Hey!

I recently asked about loading a controller within another and after a while realized I was jumping the gun a little (Grateful for the help Smile )! I trying to do the basic route but getting a '404' page not found error code through creating an anchor. Here is the code:

class notifications extends CI_Controller {

    public function index(){
        global $data;
        $data['meta_title'] = "Notification";
        if(empty($_SESSION['w3_user_id'])) {
            redirect('', 'refresh');
        }
        else{
            $data['sidebar'] = 'sidebar_left';
            $data['rightbar'] = 'rightbar';
            $data['page_content'] = 'notification';
            $data['navigation'] = 'home';
            $this->load->model('friend_model');
            $this->load->library('database','session','form_validation','email');
            $this->load->helper('url');
            $data['notification'] = $this->friend_model->get_all_notification();
            $this->load->view('template', $data);
        }
        
    }
    
                public function notify()
    {    
        $this->load->view('notification');        
    }

}

What do I add or subtract within this code to make things work? Thank you for the help!!!


Heart Heart ,
Mekaboo


  Testing, specifically when having database dependant code
Posted by: tgix - 08-14-2019, 02:45 AM - Forum: CodeIgniter 4 Discussion - Replies (6)

Swimming towards the deep end of the pool and now learning more about testing. 
In CI3 I used kenji's ci-phpunit-test with much success. Database testing has been made with a mysql server with a downloaded copy of the latest live database and making sure I only run non-destructive tests.


With CI4 I try to do the same, but find the following line from the $tests structure in Config\Database.php:67 a bit strange:

PHP Code:
'DBPrefix' => 'db_' // Needed to ensure we're working correctly with prefixes live. DO NOT REMOVE. 
 
I have already nuked my DB twice by setting this to blank so I'm really missing something here ;-)


  CI4: email and captcha need recommendation
Posted by: Avega Soft - 08-13-2019, 05:16 AM - Forum: CodeIgniter 4 Support - Replies (7)

Hi, everybody. 

Version CI3 includes an email library and Captcha helper. But in the version of the CI4 they are not. What would you recommend using alternative libraries/helpers of third-party solutions in this case? Will email library (from CI3) be ported for version 4? Thanks!


  CI 3.1.9 session not deleted after Chrome closed
Posted by: huangnam - 08-13-2019, 01:37 AM - Forum: General Help - Replies (2)

My config:

Code:
$config['sess_driver'] = 'database';
$config['sess_cookie_name'] = 'mysite_ci_session';
$config['sess_expiration'] = 0;
$config['sess_save_path'] = 'ci_sessions';
$config['sess_match_ip'] = FALSE;
$config['sess_time_to_update'] = 300;
$config['sess_regenerate_destroy'] = FALSE;

Expected: session deleted after browser close.

It works on:
- Microsoft Edge 44.18362.267.0
- Firefox 68.0.1 (64-bit)
- Yandex 19.7.2.455
- Opera 62.0.3331.116

But not works on Chrome 76.0.3809.100 (Official Build) (64-bit).

Please help!



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