Yii Framework Forum: Degustabox.com - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Degustabox.com Rate Topic: -----

#1 User is offline   Renegat59 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 3
  • Joined: 24-June 13

Posted 21 January 2014 - 07:00 AM

www.degustabox.com

The application working in 2 countries so far (Spain, UK), with plans for expanding to others.
During the development few nice components has been written:
Multilanguage Url Manager - allows defining the custom urls per lanugage for the same path and defining (I haven't found any working component with a functionality I needed)
Payment integration component with ogone.com
Backup component saving the database and files backup to Google Drive (using JGoogleAPI)
Component for tinypng.com compression
Component for Zendesk.com Integration
Component for MailChimp.com integration
and some other minor things.

The app is still under development.
0

#2 User is offline   trond 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 110
  • Joined: 26-September 12
  • Location:Oslo, Norway

Posted 22 January 2014 - 11:46 AM

Very nice web!

Can you comment on how you made the multi language URL manager?
I have a similar need an could use some ideas.
0

#3 User is offline   Renegat59 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 3
  • Joined: 24-June 13

Posted 23 January 2014 - 03:55 AM

Hi!
Thanks for comment. The Multilanguage Url Component is not perfect, but meets my needs, what I did is I overriden the CUrlManager and added the array with translations to it. The translations are configured in the config file this way:
'translations'=>array(
	'unsere-boxen'=>'product/list',
	'datenschutzbestimmungen'=>'static/index/page/privacy'
...
),

Then I overriden methods createUrl and parseUrl and before calling parent method I check if some translation from the translations array matches the URL. If so, I replace it, if not I just continue.
It's the basic scenario, I added also the patterns for the parametrized urls, so it for example can override:
/product/list/year/2013

to
/producto/ano-2013

This works the same as the translations, but I have two arrays of regex patterns - one for creating the URLs second for parsing the urls.

For now I use one config per language, so it's simple, but if you want to use one config for all languages, you can extend the arrays to be 3 dimensional with the language on the first dimension.
0

#4 User is offline   trond 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 110
  • Joined: 26-September 12
  • Location:Oslo, Norway

Posted 24 January 2014 - 03:45 AM

Thanks for the explanation. I had a quick look at the CUrlManager and overriding the createUrl and parseUrl methods seems doable.

So for the parseUrl you first check and process the static translations. Then, if no match, you also check for a regex match for paramterized URLs, and finally pass the result to the inherited method. Is that how it works?
0

#5 User is offline   Renegat59 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 3
  • Joined: 24-June 13

Posted 31 January 2014 - 06:23 AM

View Posttrond, on 24 January 2014 - 03:45 AM, said:

Thanks for the explanation. I had a quick look at the CUrlManager and overriding the createUrl and parseUrl methods seems doable.

So for the parseUrl you first check and process the static translations. Then, if no match, you also check for a regex match for paramterized URLs, and finally pass the result to the inherited method. Is that how it works?


yes, exactly, the only "hack" was setting the _pathInfo i the end of parseUrl() method. I had to use reflection to set it.
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users