Jump to content

New MarkupCache module


ryan

Recommended Posts

Using MarkupCache and needed to switch the page to MultiLanguage. First I thought oooh my god how can I achieve this without having code duplications within complex conditions?!  :undecided:

But it's PW (in this case it's just PHP logic^^) but PW is great! :D

You "only" have to set the name of the cache file dynamically based on the language. Nothing easier than that.

Just replace the normal initialization of the cached section from

<?php if(!$data = $cache->get("something")) {

to

<?php if (!$data = $cache->get("something_lang-{$user->language->name}")) {

Then, assuming whe have 2 languages, default and de, it's generating one cache file called "something_lang-default" and "something_lang-de"

of course you can set the name format to whatever you prefer ;)

Just wanted to share my achievement for everyone else looking for MarkupCache on a multi language site

cheers

Can

  • Like 1
Link to comment
Share on other sites

  • 1 year later...
  • 2 years later...
  • 3 months later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...