I would like to make a plugin that load the content of a other page by giving the alias manualy.
How can I override the alias?
So when when I open index.php?q=page1/page2 --> he opens: index.php?q=page3/test
Thanks!
-
☆ A M B ☆
- 24,524 Posts
For Evo, OnWebPageInit is the first event that a plugin can use. The documentIdentifier has already been established; however the GET value for $_GET[’q’] is still available. You should be able to use that value (which will be the alias plus the system setting for prefix and suffix, usually .html) to determine which resource you want, then modify the $modx->documentIdentifier at that point. The parser will continue processing the resource you specify.
Take a look at document.parser.class.inc.php around line 1137 to see how it determines which resource to process. It makes use of the documentListing array taken from the assets/cache/siteCache.idx.php file.
Sottwell, your story is clear.
But I can’t say $_GET[’q’] = ’page0/page1’;
Could you give me an example of the code?
-
☆ A M B ☆
- 24,524 Posts
No, you would have to have your own code in the plugin to reset the documentIdentifier. Possibly a PHP switch structure? I don’t know how many pages you would want to change. Or perhaps a sendRedirect would be more appropriate than changing the documentIdentifier?
-
MODX Staff
- 10,725 Posts
This is the purpose of SymLinks in Revo. I do not recommend overriding the alias via plugin or changing the site_start dynamically.