Welcome Guest, Not a member yet? Register   Sign In
Exclamation Model with many allowedFields data
Posted by: pws - 08-02-2022, 11:58 AM - Replies (3)

I have an Model where i need to set the "allowedFields" with big array data (more than 50 fields)!
Is possible to define "allowedFields" where i not need to insert all fields!?

  Puzzling Error
Posted by: donpwinston - 08-02-2022, 08:46 AM - Replies (2)

I've upgraded CodeIgniter from 3.9 to 4.2.1. I'm getting the following exception for all my routes except two. I don't understand why. I don't know what is different about the two that work. Invalid routes are not giving me same error and not Page Not Found page. I was using the legacy routing in the previous version.


preg_match(): Compilation failed: unmatched closing parenthesis at offset 23
SYSTEMPATH/Router/Router.php at line 418

My route config:

PHP Code:
// The Auto Routing (Legacy) is very dangerous. It is easy to create vulnerable apps
// where controller filters or CSRF protection are bypassed.
// If you don't want to define all routes, please use the Auto Routing (Improved).
// Set `$autoRoutesImproved` to true in `app/Config/Feature.php` and set the following to true.

 * --------------------------------------------------------------------
 * Route Definitions
 * --------------------------------------------------------------------

// We get a performance increase by specifying the default
// route since we don't have to scan directories.
$routes->get('/''ReadPdf::index'); //does not work
$routes->get('/enroll''Enroll::index'); //works!
$routes->get('/notice''Notice::index'); //works!
$routes->get('/notice/upload''Notice::upload'); //?
$routes->get('/notice/download/{:segment)/(:segment)''Notice::download/$1/$2'); //?
$routes->get('/receive-pdf''ReceivePdf::index'); //all of these below don't work

  Call to undefined function form_open() in CI 4
Posted by: TuqueroIMKJernalyn - 08-02-2022, 05:34 AM - Replies (1)

I am using CodeIgniter 4 and loading form helper in the following way, but it still says,

Call to undefined function form_open()

In BaseController.php i am autoloading form helper.

protected $helpers = ["form"];

$routes->get('admin/login', 'admin\LoginController::index');

public function index()
    echo view('admin/login');

<?php echo form_open('admin/dologin');?>
    <?= csrf_token() ?>
    <div class="input-group mb-3">
      <input type="email" class="form-control" name="email" placeholder="Email">
      <div class="input-group-append">
        <div class="input-group-text">
          <span class="fas fa-envelope"></span>
    <div class="input-group mb-3">
      <input type="password" class="form-control" name="password" placeholder="Password">
      <div class="input-group-append">
        <div class="input-group-text">
          <span class="fas fa-lock"></span>
    <div class="row">
      <div class="col-4">
        <button type="submit" class="btn btn-primary btn-block">Sign In</button>
      <!-- /.col -->
  <?php echo form_close();?>
How can i get rid of from this error?

Call to undefined function form_open()

  Database driven routing in CodeIgniter 2.x
Posted by: EdwardSMaTeresa - 08-02-2022, 05:24 AM - Replies (2)

I am creating a site that will have a lot of routes that will need to be added to the routes file (800+) - obviously I do not want to manually add these one by one into the routes config file.

Can anyone suggest the best practice to have my routes loaded automatically from the database. Is there a suitable library/helper that will perform this task that works with version 2.x

For instance..

$route['apple'] = 'brands/index';
$route['blackberry'] = 'brands/index';
$route['htc'] = 'brands/index';
$route['samsung'] = 'brands/index';
These are just a few of the brands i'd be adding to the routes - but there are hundreds of these so i'd want to have this loaded from a database rather than manually type these in. Also - would this method have any impact on site performance having them load from the database?

I am using Codeigniter v2.1.3

  Codeigniter 3.x
Posted by: FilembarEliJeevan - 08-02-2022, 05:03 AM - No Replies

I'm getting a 500 error in Heroku trying to launch a staging Codeigniter 3.x project (for the first time). I can't seem to get any better logs than that.

I am using the heroku-php-apache2 buildpack. PHP version is 5.6.x

However, through debugging I can see it is properly setting the root directory as public_html, it is loading the index.php in the root directory, it is loading the config.php and database.php, and it is loading the routes.php.

In my routes.php I have: $route['default_controller'] = "home";

When I go to the homepage, the root, I'm getting a 500 error and it is not loading the home/index controller method like it is supposed to. When I reference a css file, such as https://staging-app/css/grid.css, it does load that so I know the directories are being accessed properly.

In case needed, my .htaccess is

<IfModule mod_rewrite.c>
  RewriteEngine On
  RewriteBase /

  #Checks to see if the user is attempting to access a valid file,
  #such as an image or css document, if this isn't true it sends the
  #request to index.php
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  #RewriteCond %{REQUEST_URI} !business-loan-tips.*
  RewriteRule ^(.*)$ index.php?/$1 [L]

  <IfModule !mod_rewrite.c>
    # If we don't have mod_rewrite installed, all 404's
    # can be sent to index.php, and everything works as normal.
    # Submitted by: ElliotHaughin

    ErrorDocument 404 /index.php
Although, it seems to load the same with or without it.

My composer.json is empty except for '{}'

And my Procfile just has:

web: vendor/bin/heroku-php-apache2 public_html/
Any ideas on where I could be going wrong to get a 500 error or how I can track it down better?

  Codeigniter form validation for file
Posted by: DennisSSebasiStephen - 08-02-2022, 04:27 AM - Replies (1)

I'm using codeigniter for my project and I need to read contents of files. So,I need validation to check whether the file is selected or not.

Here is my code in controller

  'Project Estimation File',
But while choosing a file it shows error saying - The Project Estimation File field is required

  10 things about Redis
Posted by: InsiteFX - 08-01-2022, 12:19 PM - No Replies

10 things you didn’t know about Redis

  Liveview / livewire
Posted by: ignitedcms - 08-01-2022, 03:07 AM - Replies (5)

Just testing a few Liveview / livewire implementations with morphdom. So far seems like a great way to avoid JS build complications. Only thing is the round trip to the server, serving via sockets (from what I can tell with phoenix liveview at least) and rendering back HTML as opposed to JSON, which could be an issue for non web based apps.

Anyone used it much?

  Cookie protection or crypt
Posted by: UchihaSV - 07-31-2022, 04:01 PM - Replies (3)

Hello, we use in Ci4 session and cookie for keep Logined Users and other thing which need be protected. I think session already have some protection from http server. But if need keep some info between sessions, we use Cookie which make on client side(Browser) record. And some users can modify this record. For example some sites can just write user_id in Cookie and restore session by it, because this is simple. If we use in .env file - "cookie.secure = true", this will help for above case? I'm try use this param and have many new CodeIgniter sessions in one browser session for every refresh page, and this not usable, maybe it need more configurations from http server or what? Or we need use other way to secure Cookie record, like crypt or something?

  Create link from current with concat new query
Posted by: UchihaSV - 07-31-2022, 03:40 PM - Replies (1)

Hello, is Ci4 have any function or helper for:
Get current url and make new url with appended new GET query params. I think something like this already realized in model pager->links() and need be available to use in general cases.
Function need concat depends of current url have query string or not, use "&" or "?" for new params.

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



Latest Threads
Deprecated dynamic proper...
by InsiteFX
7 minutes ago
Manage Session folder
by captain-sensible
2 hours ago
Cache unable to write to ...
by captain-sensible
4 hours ago
checkbox value for Edit n...
by Ahmed Haroon
Today, 12:47 AM
Config\Paths different on...
by jetspeed
Yesterday, 08:42 PM
StreamResponse class
by kenjis
Yesterday, 08:04 PM
Wildcard Subdomains and H...
by rockinmusicgv
Yesterday, 06:26 PM
Session destroy randomly ...
by kenjis
Yesterday, 04:30 PM
supported locales (array)...
by rodrigoguariento
Yesterday, 02:30 PM
dropdown filter datatable...
by SubrataJ
Yesterday, 08:56 AM

Forum Statistics
» Members: 40,100
» Latest member: takerpromLemz
» Forum threads: 75,269
» Forum posts: 366,962

Full Statistics

Search Forums

(Advanced Search)

Theme © iAndrew 2016 - Forum software by © MyBB