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

  • Home
  • SEARCH
  • 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 6997661
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T20:18:42+00:00 2026-05-27T20:18:42+00:00

I want to set a cookie whenever a user visits a page, so not

  • 0

I want to set a cookie whenever a user visits a page, so not only the home page but also people that find the site through google.

On every page I need to check wheter or not the user has a cookie set with his language.
If no cookie i set make one if there is one, don’t do anything.

Can I make a function that I can load on every page? If so, how?

I’m using the codeIgniter framework with i18n 2.1 for multi language.

I also have a second question:
I’m using i18n for multi language. I’ve set nl as the first language in the array:

private $languages = array(
    'nl' => 'dutch',
    'en' => 'english',
    'de' => 'german',
    'fr' => 'french'        
);

but everytime you visit my base url, en, english, is loaded. Am I missing something?

Edit: I just can’t seem to get the correct language to load. the cookie is set to dutch but when I go to the base url and check what cookies is loaded it just ignores the cookie and loads the english home page.

  • 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-27T20:18:42+00:00Added an answer on May 27, 2026 at 8:18 pm

    For your first question:

    To make a function that runs on every page you need to extend the base Controller class. Pretty good instructions are here:

    http://codeigniter.com/wiki/MY_Controller_-_how_to_extend_the_CI_Controller

    You will make a file called MY_controller.php and put in in /application/core/.

    Then inside the constructor method of the extension you can call functions that will run on every page.

    I am not sure about your second question. I have always just built language systems separately and let the users choose their language.

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

Sidebar

Related Questions

I want to check whether or not a cookie is set with every page
I want set Listbox background to transparent but not working Is there any idea?
I want to set a cookie with the country name and city location but
i want to set the cookie before the login lik:if the user fails to
I want to set my FormsAuthentication cookie to timeout BUT VIA CODE. I know
I want to programmatically download the contents of a web page, but that page
I want to fetch a web page from a ASP.NET site that is only
I want to fetch a web page from a ASP.NET site that is only
I want to set a cookie with a user's timezone when they login. AccountController.LogOn()
I want to remove a cookie I set. If I do this by giving

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.