For example, I’m working on a store snippet for MODx right now. Currently, products show as:
/store.html?productId=34
But I would love to have it be:
/store/t-shirts/v-neck.html
Is this possible on the fly? Or would it require creation of an actual page for each product?
Awesome. Thank you so much for the informative response, I’m glad I’m working with MODx when stuff like this happens, haha. I’ll be releasing the snippet for public release soon, hopefully tomorrow. I have a couple more questions, should I keep them in this thread or should I start another?
If the former, I’ll go ahead and ask them right now:
In my snippet, for ease of use, I create another MODx document for the manager, and may want to create more later. I can see that it is inserted into MySQL, but doesn’t show up in the front end or the manager. What would I have to do
that? (and yes, I’ve read the thread about this not being entirely kosher yet...so I won’t be hurt if you say wait)
Also, now that you’ve shown me the way to go on a plugin, will I have similar issues with creating the plugin, or will it just go?
I had more but that’s it for now.
Staying off topic, but conserving threads: I’d really like to be able to create pages for the snippet, so I’m investigating further. When I added another page using the manager, the page I tried to create showed up in the site tree. Is this related to updating the cache, or something else I can look into?
-
MODX Staff
- 10,725 Posts
First of all, all requests to modx are sanitized automatically, but you should definitely add validation for your specific requirements. I was only providing an example of how to accomplish it as quickly as I could. You would have to customize this script anyway. Further, in Revo, database injection on this stuff is a non-issue if you use xPDO or PDO prepared statements.
Second, with the way the REQUEST_URI handling is done there, it would be difficult to get SQL injection in, but point taken none-the-less.
-
MODX Staff
- 10,725 Posts
Did you set those extra GET vars in the plugin after finding a match?