Welcome Guest, Not a member yet? Register   Sign In
  How to Write API Documentation That Developers Will Love
Posted by: InsiteFX - 04-02-2025, 06:26 AM - No Replies

How to Write API Documentation That Developers Will Love


  [Website Showcase] A Travel Blog Built from Scratch with CodeIg
Posted by: rmcdahal - 04-02-2025, 02:19 AM - Replies (2)

Hey everyone! ?
I’d like to showcase my travel-related blog/website, TravelStyleMate, which I built entirely from scratch using the CodeIgniter 4 framework and the Auth System From Shield My goal was to create a fast, optimized, and feature-rich travel platform while maintaining full control over performance and design.

? Features & Highlights:
Custom-Built Travel Blog – Not based on WordPress, but designed to function like a modern blog with full flexibility.
Sections for Blog Posts, Captions & Destinations – Structured content to make navigation easy and engaging.
Optimized for Speed & Performance – Implemented every possible speed optimization, ensuring fast load times. (It shows 80+ in Google Page Speed Now)
Unused CSS Removal System – Automatically scans views and removes unused CSS using

Code:
sabberworm/php-css-parser
.
Bootstrap-Based with Customizations – Built on Bootstrap but customized to match my requirements.
Table of Contents System – Similar to Rank Math’s TOC, integrated into the content dynamically.
SEO-Friendly & Scalable – Focused on growth with SEO-friendly structures.

Future Plans:
I’m continuously improving the site, adding more features, and fine-tuning the user experience. Would love to hear feedback from the community!
Still not getting 90+ page speed? If you have any suggestions, give feedback.


  Request for Help: CodeIgniter 3 to 4 Migration
Posted by: ckiyan - 03-31-2025, 10:12 PM - Replies (3)

I'm currently working on migrating a website from CodeIgniter 3 to CodeIgniter 4 and facing several challenges. I have very limited experience with this framework and have been using AI tools to assist me.
Current Situation:

  • The website is organized into Frontend and Backend sections
  • I've already migrated CSS, JS, and images to the public directory
  • The homepage has animations that aren't loading properly (likely JavaScript-related)
  • Some pages don't follow the standard MVC (Model-View-Controller) structure
Specific Issues:
  1. I'm unsure if I've correctly placed all CSS and JavaScript files
  2. Pages without the standard MVC structure aren't working
  3. Homepage animations are broken
I would greatly appreciate any guidance on:
  • Properly organizing assets in CodeIgniter 4
  • Handling pages that don't follow the standard MVC pattern
  • Troubleshooting the JavaScript animation issues
Thank you in advance for any assistance you can provide!
the structure


  anchor() with multiple subdomains/hostnames
Posted by: rockinmusicgv - 03-31-2025, 05:02 PM - Replies (4)

I'm using multiple subdomains and hostnames within an application. It looks like the anchor function uses the current URL to build the link element, however, it doesn't respect the current subdomain.  So, while using a.example.com, the link will point to example.com domain.

The current URL's host is the "example.com" domain, so from the anchor output, that's not unexpected, I suppose, but incorrect...


  Codeigniter 4 and DB hosted in Kubernetes
Posted by: ryan_w_frank - 03-31-2025, 09:49 AM - Replies (4)

Hello, I am beating my head against the wall trying to figure out what I am doing wrong... 
I setup a PostgreSQL database in my Kubernetes cluster, have it exposed through LoadBalancer.  I can connect from Python and PGAdmin just fine.
Configured CI to connect with the same config used in Python and PGAdmin:

Code:
    public array $default = [
        'DSN'        => '',
        'hostname'  => '192.168.1.240',
        'username'  => 'xxxx',
        'password'  => 'xxxx',
        'database'  => 'xxxx',
        'schema'    => 'public',
        'DBDriver'  => 'Postgre',
        'DBPrefix'  => '',
        'pConnect'  => false,
        'DBDebug'    => true,
        'charset'    => 'utf8',
        'swapPre'    => '',
        'failover'  => [],
        'port'      => '5432',
        'dateFormat' => [
            'date'    => 'Y-m-d',
            'datetime' => 'Y-m-d H:i:s',
            'time'    => 'H:i:s',
        ],
    ];

All I get is "No route to host" Unable to connect to Database... 

What am I missing?  


  DatabaseException: You must set the database table to be used with your query
Posted by: Vespa - 03-30-2025, 03:47 AM - Replies (4)

I get the following error
CodeIgniter\Database\Exceptions\DatabaseException
You must set the database table to be used with your query
Using the code below ( it seems to me that tables name are set )

Any hint to fix the issue? Thanks a lot

Code:
public function index(): string
{
   $model = new RegisterModel();
   $total->registrations = $model->countRegistrations();
   $this->viewData['total'] = $total;
   return view('pages/public/registers/civil/main', $this->viewData);
}
In the Model is:
Code:
namespace App\Models\Public\Registers\Civil;
use CodeIgniter\Model;
class RegisterModel extends Model
{
    protected $DBGroup = 'registers';
    protected $table_register      = 'rci_combinations';
    protected $table_registrations = 'rci_registrations';
    protected $table_aircrafts    = 'rci_aircrafts';
    protected $table_models        = 'aircraft_models';
    protected $table_manufacturers = 'aircraft_manufacturers';
    protected $table_pictures      = 'rci_images';
...
...
public function countRegistrations($p = NULL, $id = NULL)
{
    $builder = $this->db->table("$this->table_pictures");
    $builder->select("
        $this->table_register.id
        ");
       
    $builder->from("$this->table_register");
    $builder->join("$this->table_registrations", "$this->table_registrations.rid = $this->table_register.rid");
    $builder->join("$this->table_pictures", "$this->table_register.id = $this->table_pictures.id");
    $builder->join("$this->table_relations", "$this->table_relations.register_id = $this->table_register.id",'left');
    $builder->where("$this->table_registrations.icao_id", '115');

    if($p == 'operators')
    {
        $builder->groupBy("$this->table_register.rid");
        $builder->where("$this->table_relations.operator_id", $id);
    }
    $query = $builder->countAllResults();
    return $query;
}


  Class App\Controllers\stdClass not found error
Posted by: Vespa - 03-30-2025, 02:25 AM - Replies (2)

I have a controller with the following code, working fine till CI 4.5 version.

Code:
34     public function index(): string
35     {
36        $model = new RegisterModel();
37        $total = new stdClass;
38        $total->registrations = $model->countRegistrations();
39        $total->pictures = $model->countPictures();
40        $this->viewData['total'] = $total;
41        return view('pages/public/registers/civil/main', $this->viewData);
42    }
After the latest update I get the error: Class "App\Controllers\stdClass" not found
What's wrong with the code above? Thanks a lot for any hint


  Best Practices for Implementing Role-Based Access Control in CodeIgniter 4
Posted by: Emiliasen - 03-29-2025, 08:53 AM - Replies (3)

Hi Everyone,
I'm working on a web application using CodeIgniter 4 and need some advice on implementing a secure and scalable Role-Based Access Control (RBAC) system. I’ve come across different approaches, but I’m looking for guidance on the most efficient and maintainable way to handle user roles and permissions.
Here’s a bit of context:

  • My application requires user roles like Admin, Manager, and User, each with different access levels.
  • Users need varying permissions to access controllers, methods, and specific resources.
  • I want a solution that’s easy to manage, scalable for future roles, and minimizes database queries.
I’ve seen solutions that involve:
  1. Storing roles and permissions in the database and checking access in controllers using middleware.
  2. Using filters to handle permissions, but I’m unsure how to best configure them for dynamic role checks.
  3. Extending BaseController to handle access control.
Questions I have:
  • What’s the best approach for integrating RBAC in CodeIgniter 4 while maintaining performance?
  • Is it better to handle role checks in controllers, middleware, or elsewhere?
  • Should I use a third-party library, or is it better to create a custom solution?
  • Are there any pitfalls I should be aware of when implementing RBAC in CI4?
If anyone has a sample implementation or can point me to a detailed guide, it would be greatly appreciated! Any best practices for azure interview questions or personal experiences would also be helpful.
Thanks in advance for your help!


  SMTP server problem
Posted by: pippuccio76 - 03-29-2025, 04:26 AM - Replies (1)

HI , i have a bad server..
 When i try to send multiple mail (this is only for testing, i must send 3 different email simoultanously ) : 

Code:
    public function test_invio_3_mail()
    {
        $email_to = '[email protected]';
        $oggetto_mail = 'Test Email';
        $message = '<p>This is a test email sent to multiple recipients.</p>';

        $result = $this->invia_mail_tratta($email_to, $oggetto_mail, $message);

        if ($result === 'inviata') {
            echo 'Emails sent successfully to ' . $email_to;
        } else {
            echo 'Failed to send emails: ' . $result;
        }


        $email_to = '[email protected]';
        $oggetto_mail = 'Test Email';
        $message = '<p>This is a test email sent to multiple recipients.</p>';

        $result = $this->invia_mail_tratta($email_to, $oggetto_mail, $message);

        if ($result === 'inviata') {
            echo 'Emails sent successfully to ' . $email_to;
        } else {
            echo 'Failed to send emails: ' . $result;
        }



        $email_to = '[email protected]';
        $oggetto_mail = 'Test Email';
        $message = '<p>This is a test email sent to multiple recipients.</p>';

        $result = $this->invia_mail_tratta($email_to, $oggetto_mail, $message);

        if ($result === 'inviata') {
            echo 'Emails sent successfully to ' . $email_to;
        } else {
            echo 'Failed to send emails: ' . $result;
        }
    }

this is invia_mail_tratta
Code:
    private function invia_mail_tratta($email_to,$oggetto_mail,$message){


        $email = \Config\Services::email();


        //$dati_azienda_model = new Dati_aziendaModel();

        //$dati_azienda = $dati_azienda_model->find(1);

        $email->setMailType('html');
        $email->setFrom('[email protected]');
        $email->setTo($email_to);
        //$email->cc('[email protected]');
        //$email->bcc('[email protected]');

        $email->setSubject($oggetto_mail);



        $email->setMessage($message);

        if ($email->send(true)) {
           
            $email->clear(true);

            return 'inviata';
         
        }else{


            return $email->printDebugger();
        }

    }
this is the error :
Code:
Failed to send emails: 220 hpt01.web.l1.armada.it ESMTP Postfix
hello: 250-hpt01.web.l1.armada.it
250-PIPELINING
250-SIZE 52428800
250-ETRN
250-AUTH DIGEST-MD5 CRAM-MD5 PLAIN LOGIN
250-ENHANCEDSTATUSCODES
250-8BITMIME
250-DSN
250 CHUNKING
from: 250 2.1.0 Ok
to: 250 2.1.5 Ok
data: 354 End data with .

quit: 250 2.0.0 Ok: queued as 3F5BDCC695
The following SMTP error was encountered: 250 2.0.0 Ok: queued as 3F5BDCC695
The following SMTP error was encountered:
Unable to send email using SMTP. Your server might not be configured to send mail using this method.
Date: Sat, 29 Mar 2025 12:14:13 +0100
From: <[email protected]>
Return-Path: <[email protected]>
To: [email protected]
Subject: =?UTF-8?Q?Test=20Email?=
Reply-To: <[email protected]>
User-Agent: CodeIgniter
X-Sender: [email protected]
X-Mailer: CodeIgniter
X-Priority: 3 (Normal)
Message-ID: <[email protected]>
Mime-Version: 1.0


Content-Type: multipart/alternative; boundary="B_ALT_67e7d6052e97f9.15655388"

This is a multi-part message in MIME format.
Your email application may not support this format.

--B_ALT_67e7d6052e97f9.15655388
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

This is a test email sent to multiple recipients.


--B_ALT_67e7d6052e97f9.15655388
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<p>This is a test email sent to multiple recipients.</p>

--B_ALT_67e7d6052e97f9.15655388--
Failed to send emails: 220 hpt01.web.l1.armada.it ESMTP Postfix
hello: 250-hpt01.web.l1.armada.it
250-PIPELINING
250-SIZE 52428800
250-ETRN
250-AUTH DIGEST-MD5 CRAM-MD5 PLAIN LOGIN
250-ENHANCEDSTATUSCODES
250-8BITMIME
250-DSN
250 CHUNKING
from: 250 2.1.0 Ok
to: 250 2.1.5 Ok
data: 354 End data with .

quit: 250 2.0.0 Ok: queued as 3F5BDCC695
The following SMTP error was encountered: 250 2.0.0 Ok: queued as 3F5BDCC695
The following SMTP error was encountered:
Unable to send email using SMTP. Your server might not be configured to send mail using this method.
Failed to send AUTH LOGIN command. Error: 221 2.0.0 Bye
Unable to send email using SMTP. Your server might not be configured to send mail using this method.
Date: Sat, 29 Mar 2025 12:14:13 +0100
From: <[email protected]>
Return-Path: <[email protected]>
To: [email protected]
Subject: =?UTF-8?Q?Test=20Email?=
Reply-To: <[email protected]>
User-Agent: CodeIgniter
X-Sender: [email protected]
X-Mailer: CodeIgniter
X-Priority: 3 (Normal)
Message-ID: <[email protected]>
Mime-Version: 1.0


Content-Type: multipart/alternative; boundary="B_ALT_67e7d60ed09ef8.63370120"

This is a multi-part message in MIME format.
Your email application may not support this format.

--B_ALT_67e7d60ed09ef8.63370120
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

This is a test email sent to multiple recipients.


--B_ALT_67e7d60ed09ef8.63370120
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<p>This is a test email sent to multiple recipients.</p>

--B_ALT_67e7d60ed09ef8.63370120--
Failed to send emails: 220 hpt01.web.l1.armada.it ESMTP Postfix
hello: 250-hpt01.web.l1.armada.it
250-PIPELINING
250-SIZE 52428800
250-ETRN
250-AUTH DIGEST-MD5 CRAM-MD5 PLAIN LOGIN
250-ENHANCEDSTATUSCODES
250-8BITMIME
250-DSN
250 CHUNKING
from: 250 2.1.0 Ok
to: 250 2.1.5 Ok
data: 354 End data with .

quit: 250 2.0.0 Ok: queued as 3F5BDCC695
The following SMTP error was encountered: 250 2.0.0 Ok: queued as 3F5BDCC695
The following SMTP error was encountered:
Unable to send email using SMTP. Your server might not be configured to send mail using this method.
Failed to send AUTH LOGIN command. Error: 221 2.0.0 Bye
Unable to send email using SMTP. Your server might not be configured to send mail using this method.
Unable to send email using SMTP. Your server might not be configured to send mail using this method.
Date: Sat, 29 Mar 2025 12:14:13 +0100
From: <[email protected]>
Return-Path: <[email protected]>
To: [email protected]
Subject: =?UTF-8?Q?Test=20Email?=
Reply-To: <[email protected]>
User-Agent: CodeIgniter
X-Sender: [email protected]
X-Mailer: CodeIgniter
X-Priority: 3 (Normal)
Message-ID: <[email protected]>
Mime-Version: 1.0


Content-Type: multipart/alternative; boundary="B_ALT_67e7d60ed0ba07.08117340"

This is a multi-part message in MIME format.
Your email application may not support this format.

--B_ALT_67e7d60ed0ba07.08117340
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

This is a test email sent to multiple recipients.


--B_ALT_67e7d60ed0ba07.08117340
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<p>This is a test email sent to multiple recipients.</p>

--B_ALT_67e7d60ed0ba07.08117340--


It send only first email


  Open source devs are fighting AI crawlers with cleverness and vengeance
Posted by: InsiteFX - 03-28-2025, 12:58 PM - No Replies

Open source devs are fighting AI crawlers with cleverness and vengeance


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

Username
  

Password
  





Latest Threads
Any user guid or video o...
by msnisha
2 hours ago
MVC vs MVCS vs CodeIgnite...
by massimiliano1.mancini
7 hours ago
Why PHP is still worth le...
by php_rocs
Today, 05:13 AM
Is hiring a digital marke...
by Markhenry123
Today, 02:45 AM
my controller fails to fi...
by PaulC
Today, 01:40 AM
My Library cannot see ses...
by InsiteFX
Yesterday, 08:48 PM
update the framework to t...
by captain-sensible
Yesterday, 12:14 PM
CodeIgniter Shield 1.0.0 ...
by Ayatorvi
Yesterday, 06:06 AM
Update to 4.6.1
by serialkiller
05-07-2025, 11:58 AM
Can't create new database...
by paulbalandan
05-07-2025, 08:49 AM

Forum Statistics
» Members: 144,977
» Latest member: gnexterior
» Forum threads: 78,382
» Forum posts: 379,420

Full Statistics

Search Forums

(Advanced Search)


Theme © iAndrew 2016 - Forum software by © MyBB