How to replace the template on the fly?

How to replace the template on the fly?
For example, there is the pattern number somewhere in the session or in cookies. How can I substitute this value so that this value changed the number of template I need for a specific page during the download stage? You need to make it so that the value varied only one user, and not in the entire database.
July 9th 19 at 13:30
3 answers
July 9th 19 at 13:32
1. But as You have templates associated with the DB(data base)?
2. Load phase comes after the stage of forming the html on the server using php and modx. Accordingly, there is need to insert the logic for choosing the template. If it is associated with the user, can be stored in the session.
3. Usually when they say "to replace the template on the fly" mean the replacement in the browser. For example, the user clicked the "red theme", changed the theme, but it is a replacement css file with javascript
4. Formulated very vague, add specifics.
1. The point is that I need to replace the one some user-specific page template, but that it was never replaced. When using xPDO, for example - the pattern changes immediately everywhere throughout the site (which is logical).
2. I deeply did not dig, I would have to poke his nose where the logic stick.
3. It is clear, this would be no problem.
4. The user has the pattern number in the session. When entering the page, it should be substituted by the ID of the template and output the content in the template. BUT! the template needs to be substituted with only this user anywhere else. - eveline_Ortiz commented on July 9th 19 at 13:35
If You take the pattern number of the session, he will change only for the user, as in the other query (from another user) will have a different id in the session. The main caching to disable. - Henderson_Beat commented on July 9th 19 at 13:38
: And now the question is more interesting. When using Modx'and is recorded in the session id of the current template (which is used on the loaded page)? - eveline_Ortiz commented on July 9th 19 at 13:41
: Well I don't know that You there write. That record in the session then it'll get. - Henderson_Beat commented on July 9th 19 at 13:44
: You mean, if not record clearly. Well I recorded the session ID of the template, and then what? I Modx'tools and provide the user with the contents of this template? The question is what was originally. - eveline_Ortiz commented on July 9th 19 at 13:47
Such tasks are solved in MODX tight, so try not to use it. I am sure that it is possible with php to do it, but like in modx ??? it is necessary to read docks. If I see a similar problem, trying to move away from modx to do in yii for example. Overall, You need to find a file in modx which connects the pattern and to set the dependency id in the session. Dig code and docks. - Henderson_Beat commented on July 9th 19 at 13:50
: Have you ever done that? - Jaqueline.Parisian commented on July 9th 19 at 13:53
In MODX there - Henderson_Beat commented on July 9th 19 at 13:56
: Try at your leisure. Then tell us. - Jaqueline.Parisian commented on July 9th 19 at 13:59
I wrote that modx only use at gunpoint, the customer, prefer fremework and there and made it a million times. - Henderson_Beat commented on July 9th 19 at 14:02
We like talking about Modx. It is a pity that we do not hear happy stories. - Jaqueline.Parisian commented on July 9th 19 at 14:05
: Do you know how to read? I wrote that I do not know how to do this in modx and led logic on the basis of php as a whole. You want me to prove that You are the king in modX? I do not mind and sorry. - Henderson_Beat commented on July 9th 19 at 14:08
How can you know if you did not do? You're a programmer, theorist? - Jaqueline.Parisian commented on July 9th 19 at 14:11
: 1. I've dealt with modx, but the edges because the system is miserable. 2. I'm not a theorist, I practice, but practice experience outside of modX. 3. You need something besides modx and "with on the forums," you know? You can not answer a rhetorical question. - Henderson_Beat commented on July 9th 19 at 14:14
July 9th 19 at 13:34
In Modx there are filters. Surely that will be enough.
I want to replace the content based on the data in the session, filters can not do here. - eveline_Ortiz commented on July 9th 19 at 13:37
July 9th 19 at 13:36
Modx filter + this is
modx.im/blog/triks/391.html

Find more questions by tags PHPMODX