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

Username
  

Password
  





Search Forums

(Advanced Search)

Forum Statistics
» Members: 14,045
» Latest member: mtso86
» Forum threads: 69,686
» Forum posts: 432,611

Full Statistics

Latest Threads
User link - route all req...
Forum: CodeIgniter 4 Support
1 hour ago
» Replies: 3   » Views: 100
Installation Help
Forum: CodeIgniter 4 Support
2 hours ago
» Replies: 1   » Views: 25
file type crt as mime
Forum: CodeIgniter 3.x
5 hours ago
» Replies: 1   » Views: 23
preg_match not working we...
Forum: General Help
5 hours ago
» Replies: 3   » Views: 72
Search Criteria Ignored, ...
Forum: General Help
7 hours ago
» Replies: 17   » Views: 302
LightORM
Forum: Addins
7 hours ago
» Replies: 11   » Views: 1,611
Plugin/Script reccomendat...
Forum: Addins
10 hours ago
» Replies: 4   » Views: 207
Invisible Recaptcha
Forum: Addins
Today, 03:02 AM
» Replies: 5   » Views: 503
Why Codeigniter is better...
Forum: Choosing CodeIgniter
Today, 12:47 AM
» Replies: 19   » Views: 5,698
[feature] Database Handle...
Forum: CodeIgniter 4 Roadmap
Yesterday, 11:34 PM
» Replies: 7   » Views: 892

 
  Filter config not working with routes (?)
Posted by: Smil3y - 06-03-2019, 07:48 PM - Forum: CodeIgniter 4 Support - Replies (3)

Basically, I have a filter called "sessionCheckGloba", which deals with making sure that a user is logged in prior to accessing a webpage. The config for this filter is the following:

PHP Code:
public $globals = [
    
'before' => [
        
'sessioncheckGlobal' => ['except' => ['maintenance''browseroutofdate''login''logout''website']],
    ]
]; 


Where 'website' is in the exception list, it doesn't work.
Neither does '' (a blank element) or '/' (which stops the filter running at all).


So I guess the first question is, how do you make a filter not run on the main page where the main page is configured as the default controller?

In our case, the default controller is app/Controllers/Website/Website.php and the App is configured to route in this way:

Code:
$routes->get('/', 'Website/Website::index');

Second question, why does the following config make logincheck run on /admin/login ?

Code:
public $filters = [
    'loginfilter' => ['before' => ['login']],
];

In case, some more routes:

Code:
$routes->get('/login', 'Dashboard/Login::index');
$routes->get('/admin/login', 'Admin/Login::index');

My friend has created a similar question on GitHub but I feel like a lot of people use the forums and not GitHub.

Thanks.


  CodeIgniter Foundation coming
Posted by: jlp - 06-03-2019, 12:19 PM - Forum: CodeIgniter 4 Roadmap - Replies (3)

We are looking forward to the next stage of the CodeIgniter project!

We are forming a nonprofit corporation to manage & govern CodeIgniter and related projects.
This will be a form of "graduation" from BCIT, and will result in greater community involvement for the future Smile

The vision board we have come up with is attached.



Attached Files Thumbnail(s)
   

  Bonfire: favorite frontend tech?
Posted by: kilishan - 06-03-2019, 09:34 AM - Forum: CodeIgniter 4 Addins - Replies (10)

When I created Bonfire years and years ago, it was the result of some patterns I had used in the last 2-3 large sites I had used, with a couple of additional tools that I wanted included. Ironically, right after releasing that I got a full-time contract job for a company with its own base software for a couple of years, followed by a couple of years with a company doing a custom CI sites that didn't need the backend. For the last 3 years the company I've not been doing freelance stuff anymore. All of this to say, I never actually used Bonfire on a project.

For the first couple of years I never got much feedback about anyone using it. Eventually someone else took over maintaining it, and they've since moved on, which has left it languishing for a little bit, for which I apologize. CI4 has taken over my spare time for the last few years.

I've had several personal project ideas over the years I've been developing CI4 that I'd like to eventually tackle, all of which could benefit from an updated Bonfire, so I'm starting the planning phases of that, but won't start working on it until CI hits an official release.

For the admin area, though, I was wondering what sort of preferences the community at large had for front end technology to build the admin out, if any? It would be easiest to do without, but it's also more impressive to clients when the SPA thing happens and they get more immediate responses. And everything in between.

So - if you were using a pre-built backend, what would you prefer?


  Migrations autoload namespaces
Posted by: onizuka8 - 06-03-2019, 08:07 AM - Forum: CodeIgniter 4 Feature Requests - Replies (2)

Hello,

I just opened a thread within the support section but perhaps it is more a feature request. ( I'll  Big Grin )

I have plugins that are stored within the app\Plugins folder, each within its own folder (app\Plugins\[plugin_name]). Plugins can contain any CI4 entity: controllers, models, migrations etc and have the same structure of CI4 root. Models and controllers are loaded without problems with composer. Migrations work if the plugin's namespace is included within the $psr4 array ('Plugins\[plugin_name]\App').

Due to plugins are included/removed "dynamically" I need a way to auto load the namespaces of each plugin just adding the "root namespace" ( 'Plugins\' ) as I do within composer.json.

I figure out a way to do it but I had to editing the CI4's core (vendor folder).

What I did is editing the Autoloader::addNamespace() to check if the last char of the prefix is an '*', if so instead of add the prefix call the addSubNamespaces function

PHP Code:
private function addSubNamespaces($prefix)
{
    
$new_prefix rtrim($prefix'*');
    
$plugins array_slice(scandir(APPPATH $new_prefix), 2);
    foreach(
$plugins as $plugin){
        
$sub_folders array_slice(scandir(APPPATH $new_prefix '/' $plugin), 2);
        foreach(
$sub_folders as $sub_folder){
            
$this->prefixes[$new_prefix $plugin '\\' ucfirst($sub_folder)][] = rtrim(APPPATH $new_prefix '/' $plugin '/' $sub_folder'/') . '/';    
        }
    }                


And the for the MigrateRollback::run()  replace line 131 with:

PHP Code:
$namespaces Services::autoloader()->getNamespace(); 

This solution works for my environment and plugin structure but is not. Do you think it would be possible to introduce a feature similar to this that allows to include all the found psr4 "sub namespace" starting from the "namespace's root"

Thank you in advance.


  How to use Controller and Model in Codeigniter 4
Posted by: ashok.desai64 - 06-03-2019, 05:30 AM - Forum: CodeIgniter 4 Discussion - Replies (4)

Hello everyone, This is related to codeigniter 4.

Actually I need to use same model but different functions (3 different functions) to get data in controller. I don't understand how to do it all 3 functions are for different tables. In codeigniter 3, I can easily get data from single model using different functions like this : 


PHP Code:
$this->load->model('User_model');
$this->model->data_function_one('table1');
$this->model->data_function_two('table2');
$this->model->data_function_three('table3'); 
Can anyone please help me how to do it in Codeigniter 4.


  How use Model and Controller for many functions in CI4
Posted by: ashok.desai64 - 06-03-2019, 05:13 AM - Forum: Model-View-Controller - Replies (3)

Hello everyone, 
My question is regarding Codeigniter 4.

Okay, so I have one controller Home.php and want to get data from different database tables but need to use only one model UserModel.php. In Codeigniter 3, I can easily call different functions from single model like : $this->model->get_custom_users() OR $this->model->upload_user_image().

I don't know how to do this in CI4. can anyone please help me.


  Migrations autoload namespaces
Posted by: onizuka8 - 06-03-2019, 04:14 AM - Forum: CodeIgniter 4 Support - Replies (2)

Hello everyone,

I'm building a project which can include one or more plugins that are within the app\Plugins folder. Plugins can contain any CI4 entity: controllers, models, migrations etc. All the plugins' namespaces are something like 'Plugins\[plugin_name]\....'

Models, controllers etc are properly auto-loaded by composer. For the migrations I'm able to load it from one or more plugins adding the its namespace within the $psr4 variable of the autoload.php ( 'Plugins\[plugin_name]\App' => APPPATH . "Plugins\[plugin_name]\app"). 

Due to plugins are included "dynamically" I would like to now if there is a way to load all the migrations within each plugins, without have to specify each plugin's namespace, in the same way that controllers and models are properly loaded only defining the "Plugins\\" namespace within the composer.json file.

Hope my question is clear enough.

Thank you in advance.


  Cron execution error
Posted by: leonep - 06-03-2019, 02:59 AM - Forum: General Help - Replies (3)

Hi, 
I am new with CodeIgniter (amazing framework i love it thanks) , so sorry for newbie question !
I have a correct piece of code in my controller. If i run it in cron i get error:

COMMAND:
/usr/local/bin/php  /home/XXXXXXXXXXXXX/public_html/gestionale/index.php Calendar appuntamenti

A PHP Error was encountered

Severity:    Warning
Message:     mysqli::real_connect(): (HY000/2002): No such file or directory
Filename:    /home/XXXXXXXXXXXX/public_html/gestionale/system/database/drivers/mysqli/mysqli_driver.php
Line Number: 203

Backtrace:
        File: /home/XXXXXXXXXXX/public_html/gestionale/index.php
        Line: 315
        Function: require_once


Database error: A Database Error Occurred

        Unable to connect to your database server using the provided settings.
        Filename: core/CodeIgniter.php
        Line Number: 518

any help please ? thanks


  Report settings
Posted by: AngelaGoza - 06-03-2019, 01:38 AM - Forum: General Help - Replies (1)

Place the report on a daily basis but update the report by month?


  Get controller name and method
Posted by: Smil3y - 06-02-2019, 11:59 PM - Forum: CodeIgniter 4 Support - Replies (3)

How am I able to get the controller name and method in a filter?



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