B
B
blackbb2018-03-16 17:45:01
MODX
blackbb, 2018-03-16 17:45:01

How to change the value of parents in pdoResources depending on the url?

I'm promoting the site in two cities and trying to set up modx correctly so as not to produce a bunch of extra chunks and templates. The site structure is as follows:

  • home
  • Catalog
  • Contacts
  • St. Petersburg
    • home
    • Catalog
    • Contacts


The point is that when entering from Moscow, a person sees the main pages, and when switching from St. Petersburg, a person sees pages in the "St. Petersburg" folder, their names are the same, but the url is different. The crux of the matter is this, I display a list of products:

If this is Moscow, then parent 23, and if St. Petersburg, then parent 26. Entering from Moscow, the user gets to mysite.ru, and if from St. Petersburg, then to mysite.ru/spb and in fact all urls should be with /spb, like this implement?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
F
Froggyweb, 2018-03-16
@Froggyweb

Using pdoResources is a crutch here. Although in parents you can call a snippet that will substitute the desired id
. It would be better to implement contexts by analogy with language versions .
For example, here is the article https://bezumkin.ru/sections/tips_and_tricks/2439/ . or there are packages on https://modstore.pro/ and modx.com

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question