Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using Simple Search with Babel #29

Closed
DESIGNfromWITHIN opened this issue Apr 20, 2011 · 5 comments
Closed

Using Simple Search with Babel #29

DESIGNfromWITHIN opened this issue Apr 20, 2011 · 5 comments

Comments

@DESIGNfromWITHIN
Copy link

Hi, Babel works great, but I need to use Simple Search as well.
I use the following call:

[[!SimpleSearchForm? &landing=12]]

12 is the ID of my English search results page....
But now all searches from all languages go to the English page. How can I get a variable results page link depending on the current language?

@rtripault
Copy link
Contributor

That's definitely not a Babel issue ;)
You've got different solutions to achieve that (as usual with MODX)
1 - define a context setting with your landing page ID, &landing[[++yourCustomContextSetting]]
2 - if you only got 2 ctx, you could do &landing=[[++cultureKey:is=en:then=12:else=your other id]]
3 - you've got more than 2 ctx, then you might want to have a look at ifEval extra
4 - nothing comes to my mind but there certainely is more than 3 possibilities ;)

@DESIGNfromWITHIN
Copy link
Author

Ok, thanks for your comment.
I have 3 contexts and am looking at ifEval extra, but my PHP is not that great...
Also I have no clue on how exactly to use the [[++yourCustomContextSetting]]

For each of my languages the url gest a language selector added:
/en/
/nl/
/du/

Could you point me in the right direction?

@rtripault
Copy link
Contributor

This is probably not the place to reply (you'd better open a forum thread so it could help someone else/you get better responses). But to do quickly:

  • with system setting (per context) :
    1/ edit your context
    2/ go to "context settings" tab & create a new setting (button "create new")
    3/ name it whatever you want (ex. key = SimpleSearchLanding) and give it the value of your landing page ID for that context (ex. value = 12)
    4/ do the same for your 2 other context (change the proper landing page id)
    5/ call you simple search with &landing=[[++SimpleSearchLanding]] (or whatever you set as key)
  • with ifEval:
    call your simple search snippet with

    &landing=[[!ifEval? &ccEn="[[++cultureKey]]" == "en" &rrEnTrue=12 &ccDe="[[++cultureKey]]" == "de" &rrDeTrue=ID of DE context landing page &ccFr="[[++cultureKey]]" == "fr" &rrFrTrue=*ID of FR context landing page ]]`

If you use ifEval, please check its forum thread, as there is a slight bug in 0.9.
Hope this helps & good luck ;)

Edit: do not copy/paste from here, backticks seems to be eaten by MarkDown (i have to practice, sorry)

@DESIGNfromWITHIN
Copy link
Author

Thank you so mutch! Works great!
I'll create a post and might make a quick tutorial about i....

@oori
Copy link

oori commented Dec 11, 2011

a generic solution to this was proposed in pull #44. Using cultureKey instead of contextKey.
#44

goldsky added a commit to goldsky/babel that referenced this issue Nov 26, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants