Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 957241
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T00:40:16+00:00 2026-05-16T00:40:16+00:00

function Home() { parent::Public_Controller(); $this->load->library(‘survey_form_processing’); //Load Helpers $this->load->helper(‘form’); $this->load->library(‘Paypal_Lib’); $this->lang->load(‘userlib’); $this->load->model(‘home_model’); if($foo == true){

  • 0
function Home()
{
    parent::Public_Controller();
    $this->load->library('survey_form_processing');
    //Load Helpers
    $this->load->helper('form');
    $this->load->library('Paypal_Lib');
    $this->lang->load('userlib');
    $this->load->model('home_model');
    if($foo == true){
        redirect('home');
    }
}

This is my construct of the “Home” controller. If a value == true, how can I redirect to the index function? When I try this I get an error…

Is it possible to redirect to the index function?

P.S. I’m a php/CI noob!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T00:40:17+00:00Added an answer on May 16, 2026 at 12:40 am

    Based on the information you provided, I’d say that you’re stuck in an infinite redirection loop :

    • The user goes to the Home page
    • In the constructor, it checks the subscription and if it fails, it redirects to Home
    • ==> loop !

    You may have some solutions :

    • Detect that the method called is index and in that case don’t redirect (you can use the function router->fetch_method()
    • Perform the redirection to another Controller
    • Don’t perform the redirection in the constructor but in each Function. You just have to put the subscription control in a function and call it at the beginning of each function.

    The easiest would probably to change your condition.
    From

    if($foo == true)
    

    To

    if($foo == true && router->fetch_method() != 'index')
    

    So that if CodeIgniter is trying to reach the Index it won’t be redirected again.

    (I don’t have a php server here so I can’t check the exact value). But the idea is here.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 508k
  • Answers 508k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Writing Internet Explorer toolbars and extensions is no easy task.… May 16, 2026 at 4:13 pm
  • Editorial Team
    Editorial Team added an answer Change routes.MapRoute routes.MapRoute(null, "Products/Page{page}", new {controller = "Products", action =… May 16, 2026 at 4:13 pm
  • Editorial Team
    Editorial Team added an answer This is the message that the Office 2007 Compatibility pack… May 16, 2026 at 4:13 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

This is my AdminBase.php <?php class AdminBase extends Controller{ public function __construct(){ parent::Controller(); $admin
I get this error: Fatal error: Call to undefined function () in /home/gmfeedsc/domains/cekdahl.com/public_html/virek/system/application/views/rekommendationer/visa.php on
I am developing a links voting site, and I have this function, to check
I use the $.post function to submit an ajax request as such: $('.typeAform').submit(function(){ $.post('/home',
currently I have following code: home.php <form name='myformname' id='myformid'> <input type='text' name='mytext1' value='abc'> <input
Are there any library or function that performs a bash-like glob expansion for emacs
Based on this documentation , I've implemented a catch all route which routes to
Hey, in a tutorial C++ code, I found this particular piece of confusion: PlasmaTutorial1::PlasmaTutorial1(QObject
I have an array with tree data (by parent id). I want to convert
I m new to PRADO, I have a file Home.page with code: <%@ Title=Contact

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.