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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T09:58:21+00:00 2026-05-23T09:58:21+00:00

I want to employ CakePHP’s basic caching functionality on my site’s home page. However,

  • 0

I want to employ CakePHP’s basic caching functionality on my site’s home page. However, there is one element on the page that should display different data depending on the visitor’s location, as determined by their IP address.

You can’t wrap <cake:nocache> around variables that are set in the controller, which is where I was previously determining the location and getting the data. My question therefore is: where can I optimally set a (session?) variable to contain visitor location information before the controller? How can I use this information to populate an array of data for the nocached portion of the view, while completely sidestepping the controller action, which is no longer being called?

Any advice greatly appreciated!

  • 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-23T09:58:22+00:00Added an answer on May 23, 2026 at 9:58 am

    Hmm, well, apparently CakePHP questions aren’t of much interest to the world at large: only 8 views in 2 days 🙁

    In any case I investigated a bit further and discovered that, while the <nocache> tags don’t let you surround variables to make them dynamic, they DO allow you to make non-caching calls to elements or helpers. I therefore extracted the relevant part of my page into an element, and populated the data array by calling a helper function.

    This did mean that I had to access the model from inside the helper with

    $this->Modelname =& ClassRegistry::init("Modelname");
    

    and I’m not sure this is necessarily the respectful CakePHP and/or MVC way of doing things, but at least it’s some way towards a solution!

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

Sidebar

Related Questions

I want to create a Java Desktop Application and want to employ some mechanism
want to rewrite urls like site.com/software to wp-content/themes/dir/software.php and something is not working.. Here's
want to ask user to input something but not want to wait forever. There
I have a WPF storyboard that I want to step through frame-by-frame (for a
I noticed that a site I'm maintaining had a little layout bug in FF/IE8/Chrome
I have a JSF 2 composite component that employs some Ajax behavior. I want
My code is using a third party library that employ a singleton pattern deep
let's say that in my application, there is an user interface for representing a
I have a rather weird problem with a control that doesn't want to resize.
I have a webservice that I want to Consume in my application. Too be

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.