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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T20:44:36+00:00 2026-05-11T20:44:36+00:00

I have some questions about cakePHP, I spent long time Googling for a solution

  • 0

I have some questions about cakePHP, I spent long time Googling for a solution and as I didn’t find any I’m not sure I’m taking the right approach.

So, I have a menu/sitemap which is part static (xml file – i10n) and part dynamic (database i18n)

I’ve been asked to cache the menu so that:

  1. A component creates a cache xml file of the whole menu for each language if it doesn’t exist

  2. An helper creates a cache html formatted from the xml file created from the component

  3. The layout uses the helper to add the menu in the page

Questions:

  • How do I get the list of available languages from the helper and from the component?

  • Is this

    $this->L10n = new L10n(); $this->L10n->lang
    

    the correct way to get the actual language?

  • If I import the helpers/component in the app_controller instead of typing them in each controller

    class AppController extends Controller {
        var $components = array('menu', 'otherComponent');
        var $helpers = array('menuCache');
    
        function beforeFilter(){
            $this->menu->doSomething();
        }
    }
    

I get a call to undefined object $html for the echo $html->charset(); in the layout

can’t understand why…

  • 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-11T20:44:36+00:00Added an answer on May 11, 2026 at 8:44 pm

    You can use Configure::read('Config.language'). A part of the CakePHP cookbook states:

    The current locale is the current value of Configure::read(‘Config.language’). The value of Config.language is assigned in the L10n Class – unless it is already set.

    I18n, the class responsible for translation using __(), uses Config.language so, unless you override it in bootstrap.php, that variable contains the selected language. Actually, even if you override it, it will still contain the used language (there might be inconsistencies because I10n is not really aware of the change but I never ran into any).

    To get a list of languages, you can use L10n::catalog(). I’m not sure it’s what you’re after, however, since it lists all languages CakePHP knows about, not only the languages that actually have a translation in app/locale.

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

Sidebar

Ask A Question

Stats

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

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

    • 7 Answers
  • Editorial Team

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

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Did the source files that contain CommandBehavior get copied into… May 11, 2026 at 9:56 pm
  • Editorial Team
    Editorial Team added an answer Make a Timer with an interval of five (or whatever)… May 11, 2026 at 9:56 pm
  • Editorial Team
    Editorial Team added an answer I'm coding similar thing. My approach include..... Not using dismissModalViewControllerAnimated… May 11, 2026 at 9:55 pm

Related Questions

I want to run a web application on php and mysql, using the CakePHP
In the past, I've always edited all my sites live; wasn't too concerned about
I'm building a site were users can upload images and then use them. What
As part of a larger web-app (using CakePHP), I'm putting together a simple blog
I have some questions about basic CSS that I was unable to understand or

Trending Tags

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

Top Members

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.