We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 23496
    • 20 Posts
    Hello,

    the last days I read many about modx, ajax and contexts. Finally I installed the components of Fuzzical Logic to realise my ideas. Cross context URLs are working fine, but theres one thing I wan't realize, that actually won't work. Maybe I am on the wrong way...
    In te context web I have a resource, that I want to use as a repository für a lot of articles. I use this with getResources without any problems across my contexts. But not evertime I do not need all of the fields and TVs of a resourcse at one time, like the content-Field for example.
    Now my Idea was to load the content-Field with ajax only when I need it. In the space of one context no problem.
    I have <a> Tag with die Link to the resource in my repository. But this link contents the domain of my context web, where the repo is located. So I cannot access this url with using the fancybox from other contexts.

    An idea was, to create an connector-resource in every context, that loads the needed content. But for the future I will have a lot of contexts. I think that this is not the way I will go...
    Another idea was to call a little PHP script that do this. But I guess that there a lot of security risks.

    So, how have I to realize it, to access to my repository with ajax/fancybox?

    Thanks for approach to solving this problem.

    Best wishes
    Florian
      • 39932
      • 483 Posts
      Florian,

      I'm not entirely sure what you are trying to accomplish here, although some others might be. I can provide some insight as to how I use my own components with my sites...

      The idea behind these components was to make everything as easy for myself, other devs and the user as much as possible. I'm an efficiency monger so duplication of effort is a big no-no for me. Duplication of resources is even more so.

      Cross-Context resources allows me to have one page that might be on multiple sites (or in my case sub-sites) accessible regardless of the site (or sub-site) that I am on. This isn't a big deal for a lot of people, but for me it means better and faster maintenance. Change it on one "site" and all of the others are fixed as well. It also helps to make the URL uniform across those sites.

      AJAX Revolution is more of a backend strategy that allows me to get rid of ?var=val&var=val to make URLs more friendly. In addition, it allows me to separate my JS code so that only what is needed is loaded rather than having to load an entire library. (There are many other benefits, but those are for much more advanced usage). That means that I can have landing pages that load a whole ton of AJAX resources based on the TVs of the landing page. The AJAX Resources don't have to have TVs and I save even more data.

      When I combine the two, I can have an AJAX resources that is accessible by multiple sites (or subsites). And this is done without a lot of code. (For advanced usage, it means that I can invoke JS or page "events" without having to specifically code those events reducing the JS load even further). The entire philosophy is hinged upon using a MODX Template to categorize resources rather than to define them...

      Now with regard to your specific issue, I get the impression you want to load some fields of a page without loading everything all at once. All of these pages are stored inside a repo page (very similar to articles). I gather that you want to be able to load these specific fields through AJAX when you need them. Also, based on what you are saying, some of these may need to be accessible across contexts? All of this can easily be done using those two plugins... Its really just a matter of knowing the structure and setting up your snippets accordingly. If you use a pre-load PHP, then you have to know what is going to happen and when before anybody does it. If you use a post-load PHP/AJAX, you can create "portals" that are easily parameter-based.

      I personally prefer an AJAX approach. This is because pages load faster (when done right) and it creates a more seamless experience. Most AJAX approaches on the web use a single app-like page, however, and that is an approach I despise (personally). I prefer to have tons of mini-pages that are told to load by the containing pages. So, often I have Resources that are AJAX Resources but have the ability to pose as any number of pages of a specific type (or template).

      Neither AJAX nor pure PHP has more or less security concerns than the other. They each have different risks. Both can be risky, so you have to be sure that you aren't giving access to information that can screw you, your clients, or your customers. With JS you have to do more sanitization than you would with pure PHP. With pure PHP, you have to make sure not to return anything that could violate your policies.

      I realize that much of the information I just gave is useful to specific types of developers, so I hope that it helps. If you need some further elaboration, send me a PM and we can connect via Skype. Another view point may benefit you more, however. Many of my approaches are not traditional and thus require a little bit of digestion and abstract thought to realize.

      Fuzzical Logic
        Website: Extended Dialog Development Blog: on Extended Dialog
        Add-ons: AJAX Revolution, RO.IDEs Editor & Framework (in works) Utilities: Plugin Compatibility List
        Tutorials: Create Cross-Context Resources, Cross-Context AJAX Login, Template-Based Actions, Remove Extensions from URLs

        Failure is just another word for saying you didn't want to try. "It can't be done" means "I don't know how".
        • 23496
        • 20 Posts
        Hello Fuzzical Logic,

        thank you for this insights. I think there are two task for me:
        1. improve my english. It was not so easy to express this
        2. improve my knowledge about possibilites and of modx and the functins of the core system, classes, etc.

        In the past I mostly worked as frontend developer. My PHP knowledge is developable.

        Thank you also for the opinion to contact you. But first I go try n error laugh

        Greetings
        Florian