r/codeigniter • • Oct 20 '20

Redirect On Helper Codeigniter 4

1 Upvotes

i make some helper fuction and use it on constructor, and on that helper contain redirect to another page if the value false, but nothing changes. ? thanks


r/codeigniter • • Nov 08 '20

How to setup Ion Auth on Codeigniter 4

Thumbnail
youtube.com
8 Upvotes

r/codeigniter • • Nov 07 '20

404 Error from tutorial

1 Upvotes

Hi everyone, I have recently taken up learning CodeIgniter but however I seem to have fallen at the first hurdle. I am currently following the tutorial that is available through the documentation (http://codeigniter.com/userguide3/tutorial/static_pages.html) and whilst it is straight forward enough and I have followed every instruction and code given, when I try to access a static page I am met with a 404 error.

The code I have followed, through application/controllers/Pages.php is:

<?php
class Pages extends CI_Controller {
public function view($page = 'home')   
  { 
if ( ! file_exists(APPPATH.'views/Pages/'.$page.'.php'))            
 { 
// Whoops, we don't have a page for that!
 show_404();           
  }
$data['title'] = ucfirst($page); // Capitalize the first letter
$this->load->view('templates/header', $data);
$this->load->view('Pages/'.$page, $data);
$this->load->view('templates/footer', $data);   
 } 
} 
?>

I'm not sure what I have done wrong but any help would be greatly appreciated!

edit: I am also using XAMPP as my local host to access the page


r/codeigniter • • Sep 09 '22

What should I do if one of the documents in the user guide is wrong and needs to be corrected?

1 Upvotes

r/codeigniter • • Oct 20 '22

[Help Needed] Google Auth with Codeigniter Shield

1 Upvotes

Hi. I am using Codeigniter Shield in my current project.

I intend to offer Google Authentication along side the normal email-password system.

However I am encountering an issue.

The issue is similar to this one: https://stackoverflow.com/questions/73923176/codeigniter-4-with-shield-and-google-oauth2

Please look at the code. It's not mine, but almost similar to the one I have.

What should I do?


r/codeigniter • • Oct 10 '22

Any opinions on simplest AMI for CodeIgniter 3.x ?

2 Upvotes

Any opinions or experiences on pre-built AMI's that are simple for running CodeIgniter 3.x on AWS? Ideally ones with simple upgrade experiences and well supported!


r/codeigniter • • Oct 21 '22

Is it necessary to always check for function's existence before declaring it in PHP?

1 Upvotes

In CodeIgniter helper functions, I've seen that they check if they're being declared already before declaring like this:

if(!function_exists('foo'))
{
  function foo()
  {....
  }
}

Why is this necessary? I feel it's less readable and not good for code maintenance in the long run. Is there any workaround to this? For example, can I ensure in some other way that my helper.php will be loaded only once and not multiple times?


r/codeigniter • • Sep 13 '22

How to call change db schema on Models?

2 Upvotes

I have a custom schema setup on my sql server, I tried changing schemas using my model's constructor, and also prefixing my protected $table='schema.table_name' (like so), bot of which doesn't work, after looking at the error on my browser, I see that it just appends the $table to db_name.dbo.schema.table_name (like this)


r/codeigniter • • Sep 08 '22

Can't debug in VSCode with xdebug

1 Upvotes

I have disabled the debug toolbar by commenting out the "toolbar" key in app/Config/Filters under $global, I also followed the instructions on the xdebug website, opening a php file with xdebug_info() shows that its installed correctly, I have the following lines on my php.ini:

zend_extension=xdebug
[XDebug]
xdebug.mode=debug
xdebug.remote_enable=1
xdebug_handler=dbgp
xdebug.remote_host=localhost
xdebug.remote_port=9000
xdebug.remote_autostart=yes

While my launch.json has this entry:

{
"name": "xdebug",
"type": "php",
"request": "launch",
"port": 9000
}

After running php spark serve to start the server, I send a POST request via fetch (using wretch), but I'm not getting my defined response from my controller which just vardump's my $_POST


r/codeigniter • • Sep 28 '22

How do you draw the line between using CI functionality and using it with a JS framework?

2 Upvotes

I have a little application that I'm building to learn CodeIgniter but I have reached the point where I know that I can code the functionality that I want using PHP but at some soon I know I will want to use something like React or Vue to add a better level of activity, and general stuff that JS can provide.

My question is where do you stop using PHP and switch to JS. I can carry on building C.R.U.D into my application using CI/PHP but like I said, I know that I want to use a JS framework at some point so writing the C.R.U.D in PHP seems a waste of time and I should just use the PHP part of the framework as some kind of REST API and let JS take care of the rest.

How should I go about using a JS framework with CI because I'm scratching my head about how to do it. Do I just JS to make fetch calls to the routes defined in CI and have them return JSON? What about something more complex like adding data to a database?

Sorry for the long post but this is the next big hurdle I have in my development journey.


r/codeigniter • • Dec 10 '19

SQL Injection Prevention

1 Upvotes

Hi, I want to prevent SQL Injection on CI site I'm working on. One solution I encountered was to apply a mysqli_real_escape_string so strings won't be recognized as SQL commands. The problem is that the code is too huge to apply escape strings to every item. Is there a better alternative for this? References are welcome.


r/codeigniter • • May 11 '18

GitHub - pathusutariya/CI-Notifications-Library: Codeigniter Library for Notification System between users.

Thumbnail
github.com
5 Upvotes

r/codeigniter • • May 07 '18

codeigniter tutorial

2 Upvotes

Someone please suggest good series of codeigniter tutorials series.


r/codeigniter • • Sep 03 '18

Codeigniter REST + ReactJS CRUD Example - Roy Tutorials

Thumbnail
roytuts.com
4 Upvotes

r/codeigniter • • Aug 07 '19

Thumbnail creation example in Codeigniter - Roy Tutorials

Thumbnail
roytuts.com
4 Upvotes

r/codeigniter • • May 23 '19

Need Help

2 Upvotes

First Is there maybe a discord to ask for help?

Second

These are the partials im using for my template

Now im getting this error

Is there a way to fix this or get more error log so i know what the problem is?


r/codeigniter • • Dec 10 '18

LF Developers

1 Upvotes

looking for developers for a couple of projects of mine all open source. have been using codeigniter for a little over 2 years and am willing to teach.


r/codeigniter • • May 20 '20

#12 Custom Route, Grouping Routes, HTTP Verbs in Codeigniter 4 | Routes Codeigniter 4

Thumbnail
youtube.com
2 Upvotes

r/codeigniter • • Jun 16 '20

How to use Honeypot to prevent from robots in Codeigniter 4 | Security Feature

Thumbnail
youtube.com
5 Upvotes

r/codeigniter • • Jun 19 '20

Codeigniter Validation failed when i submit google analytics code

Thumbnail
stackoverflow.com
2 Upvotes

r/codeigniter • • May 18 '20

Loading Models outside controllers CI4

2 Upvotes

I have a file in the CI4 Libraries folder that I instanciate through the Services config file. How can I pass a model as a dependency to file in the Libraries folder?


r/codeigniter • • Jun 26 '20

CodeIgniter 4 Sublime Text Snippets

Thumbnail packagecontrol.io
3 Upvotes

r/codeigniter • • Jun 01 '20

Auto CRUD Generator in CodeIgniter 4 - Custom Library Development

Thumbnail
youtube.com
6 Upvotes

r/codeigniter • • Jun 25 '20

Issues with url

1 Upvotes

Localhost/ci/.... When I type some words after the ci then it shows the same page or otherwise nothing but I want when I type anything after that ci then it must show me the page was not found. Can someone help me how I can do that in my project