-
- 3 Posts
Hello, guys ands girls.
I'm new here, recently download Revolution, worked with other CMSs before.
I choose MODx now, because I need to create fully(I think) Ajax site.
So, I need to have special <div></div> on every page. I need, that this div dont reload on every click on links.
Can I make it less easy with MODx, than with other CMSs? Maybe someone made it yet and can give me some advices?
-
- 483 Posts
There are quite a few ways to AJAX-enable your ModX site. It largely depends on what you are trying to do as to how you should proceed. A core concept that you must understand about ModX is that each Resource is web content. They may be partial web content or a full web page. Also, a resource cannot run PHP; that is what a Snippet is for. By making a Snippet call in a Resource, you can get AJAX behavior quite easily.
Here's a useful tutorial that can expand what you know of ModX and provides an implementation of AJAX framework:
http://forums.modx.com/thread/78039/tutorial-create-an-ajax-framework-evo-revo
Simply, what you must understand is that AJAX works in ModX the same way as in any other CMS. You make a request to a URL and you get a response. The above tutorial may or may not be useful for you, but it demonstrates that it
is easily possible. Simply include your JS library with AJAX handling, and make a request to the URL and you will get a result.
[ed. note: fuzzicallogic last edited this post 11 years, 9 months ago.]
-
- 3 Posts
Thanks, not read article yet, but have question already:
Can I make one full page with all my content(header, left sidebar, right sidebar, etc.) and use like start position for my user? so all links on this page will be caught by Ajax?
But there is problem: how can I put user to this page, if he load another page of my site.
Thanks for link, I'm reading it now.
-
- 483 Posts
You can do whatever you want with ModX. It's very free-form (given form). It's just a matter of what you want to do and how. A lot will depend on your understanding of JS (I use jQuery) and ModX itself. ModX has the ability to track the User in PHP via
. This means that you don't have to track/send the user at all in your HTML/JS. This makes it even handier.
-
- 483 Posts
Let me explain in a little more detail.
For each AJAX call, you will need a) a Resource and b) a Snippet. In your "Core" document, you'll include your JS library and its links to your AJAX Resources. How you write your Snippets will determine what is returned and where to go from there.
Imagine your Core document has 3 AJAX calls (ajax1, ajax2, ajax3). Your Core document will have a Template that renders your page. Your AJAX calls will each be their own Resource (preferably under your Core), each with their own Snippets. In your Core template, you will set your "clickables" to fire an AJAX Request to the particular AJAX page (ajax1, ajax2, or ajax3), and then you'll simply put the content where you want.
-
- 3 Posts
Yeeeah, I understoooood!
Its like orgazm now, many thanks!!
-
- 483 Posts
You're welcome! I went through hell trying to AJAXify the Login snippet through a single URL. The result was the article you just read.