Welcome Guest, Not a member yet? Register   Sign In
  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.

  Prevent access a file in public folder
Posted by: septovan.dev - 07-31-2022, 01:23 PM - Replies (2)

I have a json file inside a public folder. I want to restrict the access to the json file from browser but it can be accessed from controller. I do not know how to do it.
For example, json file is placed inside key/foo folder which inside public folder → public/key/foo/bar.json.
I created .htaccess (Deny from all) file in key folder but I still can access bar.json from the browser with this url path http://localhost/key/foo/bar.json
Any help?

Thank you.

  Writing Good SQL Code
Posted by: InsiteFX - 07-31-2022, 12:47 PM - No Replies

Best Practices for Writing Good SQL Code

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



Latest Threads
Session Lost after Paymen...
by Austin638
6 hours ago
extention of autorouter i...
by kenjis
7 hours ago
redirecting from another ...
by vgrigorov
7 hours ago
Shield validation questio...
by chronic
8 hours ago
How to set dynamic base_u...
by kenjis
9 hours ago
Upgrading from 4.1.9 to 4...
by fre2mansur
Yesterday, 06:45 PM
trouble starting
by dum1
Yesterday, 01:05 PM
add CI4 view features lik...
by kilishan
Yesterday, 12:25 PM
Adding or changing views ...
by Mostafa Khudair
Yesterday, 11:46 AM
Title Suggestions
by Ramipa Pimma
Yesterday, 11:29 AM

Forum Statistics
» Members: 40,591
» Latest member: ELISEO AMAR
» Forum threads: 75,307
» Forum posts: 367,071

Full Statistics

Search Forums

(Advanced Search)

Theme © iAndrew 2016 - Forum software by © MyBB