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 8506997
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T02:44:44+00:00 2026-06-11T02:44:44+00:00

I have two unrelated Codeigniter problems: (a) I am trying to redirect a user

  • 0

I have two unrelated Codeigniter problems:

(a) I am trying to redirect a user to the dashboard after logging in successfully. i.e. from controller “auth” to controller “dashboard”. For some odd reason, it keeps redirecting to auth/dashboard (404 error since it does not exist).

This is what I did:

//Within the auth controller    
    if ($this->auth->login($username, $password)) //Auth->login returns boolean
    {
    redirect('/dashboard', 'refresh');
    # redirect('/dashboard', 'location');  // I tried this too
    # redirect('/dashboard/index', 'refresh');   // I also tried this!
    }

What am I doing wrong, please? It just keeps redirecting to auth/dashboard

(b) I am using Phil Sturgeon’s brilliant Codeigniter Template library (without a Parser) and I am unable to receive data sent into a partials file. This data is ONLY needed by the partials file. I have been over the (unfortunately sparse) library documentation, S/O posts on the topic, and also the CI forums to no avail, there seems to be no clear-cut example showing how a partial receives data that a controller assigns to it.

This is how I have been doing it. Please tell me what I must be doing wrong.

// In the controller page
$this->data['user'] = array('info' => 'username', 'value' => 'Cogicero');
$this->data['prefs'] = array('foo' => 'bar');
$this->template
     ->set_partial('header', 'partials/header', $this->data)
     ->set_layout('blog')
     ->build('foobar_view');

And

        //In the header partials page
        <?php
        /* snip */
        print_r($data);
        print_r($prefs);
        print_r($user);
        echo $user["info"];
        echo $prefs["foo"];
        ?>

All the above produce “array does not exist” or “undefined variable” errors! How am I meant to be receiving data within the partials view file?

Thanks

EDIT:
Working on a tight deadline so with no solution in sight, I had to abandon Phil Sturgeon’s template library and pick up Jens Segers’ instead. http://www.jenssegers.be/blog/25/Codeigniter-template-library
It is a little similar to Phil’s but for some reason the partials are receiving and rendering my data properly. Also, Sergers’ template library is very well documented. All is fine now, so I’ll accept my own answer to problem (a). Thanks everyone.

  • 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-06-11T02:44:45+00:00Added an answer on June 11, 2026 at 2:44 am

    (a) So after a lot of fiddling around I have solved the first problem i.e. the redirects.

    In the config file, we have

    | If this is not set then CodeIgniter will guess the protocol, domain and
    | path to your installation.
    |
    */
    $config['base_url']=
    

    Apparently, I didn’t set a base URL because I’m still on a development local server, I was going to set it to the www address when I upload to the test server. Codeigniter had been guessing all along, but the guess didn’t work for my authentication redirects. I set the base url and all redirects were fine.

    (b) Now, to see why the partial views are not receiving data. Any help please? 🙁

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

Sidebar

Related Questions

I have two (unrelated) classes. The first one is Point: typedef std::complex<double> complex_number; class
I have two unrelated repositories 'public' and 'develop': prj/ public/ develop/ 'develop' has lots
I have two classes (MVC view model) which inherits from one abstract base class.
Say I have two tables, user and comment . They have table definitions that
I currently have two unrelated MVC3 projects hosted online. One works fine, the other
OK, so I have two (completely unrelated, different project) classes using iterators now. One
I have two unrelated (not sharing any ancestor check in) Git repositories, one is
I have two unrelated questions: Is it possible to use #define to define something
Two unrelated Mercurial repositories are created: user@SERVER ~/mercurialtest $ cd jointest/ user@SERVER ~/mercurialtest/jointest $
I have two jQuery UI dialogs (unrelated to each other but both are exhibiting

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.