We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 9995
    • 1,613 Posts
    How can I build an App with Modx (android / iphone).
    I'm not experienced with it and would like to test and play arround.

    Having a static page it wouldn't be that hard but having refreshed content like newsitems would be a lot harder I guess. I really have no idea how to start. Do I need to use API's ?

    Any tips are welcome.
      Evolution user, I like the back-end speed and simplicity smiley
      • 39404
      • 175 Posts
      stalemate resolution associate Reply #2, 12 years, 3 months ago
      Hi fourroses666,

      There are a number of options, depending on what you're looking at doing with it.

      1) Regular website with Responsive Web Design: The line between what is a web site and what is an application gets narrower every day, and if your application can be done as a web site, then this is probably the best way
      2) Phone gap: http://phonegap.com This is basically to take a web site and wrap it in an API for each platform you want
      3) Per platform O/S with MODX serving up XML for resources: One of the reasons that MODX calls resources "resources" instead of web pages or documents is that MODX can serve up anything, including any kind of communication.

      As for my personal preference, I personally do 1, but would love to look at option 2 as well.

      In terms of Option 3, I don't like the idea of maintaining multiple code bases, especially if the application is doing complex things which require custom coding in each item. If you're not doing something that is important enough to throw a bunch of resources at it for development and then ongoing for maintenance, I'd stick with options 1 or 2.

      Hope this helps.
      Regards,
      Tom
        • 9995
        • 1,613 Posts
        Thanks for your info Tom,

        I don't want a Web App. (responsive)

        I also found and use Phonegap for exporting the static pages (for testing), the downside is that when you update content your need to re-upload the static site again.
        I tried to use PHP to grab content out of the database tables, it works in my browser but not when testing.

        So I need to grab the content with Ajax, JSON, XML, trying to figure out how to do that atm.


        I didn't knew Apple asks 99$/y and Play Store $25 to add your App to their store as far I could see. Good to know
        [ed. note: fourroses666 last edited this post 12 years, 3 months ago.]
          Evolution user, I like the back-end speed and simplicity smiley
          • 39404
          • 175 Posts
          stalemate resolution associate Reply #4, 12 years, 3 months ago
          Quote from: fourroses666 at Jun 30, 2014, 08:08 AM
          So I need to grab the content with Ajax, trying to figure out how to do that atm.

          Hi fourroses666,

          I use MODX with AJAX all the time. Here are the pieces I use, not that they are the best pieces but more from using what I've gotten to work.
          1) AJAX pages themselves are just MODX resources with no template. My HTML points to a PHP Snippet which looks at the parameters sent (I use method:post so I don't have to worry about variable length limitations that exist with method:get). The PHP snippet will echo the results and that is what will be returned on the response text
          2) Javascript to send the AJAX call (see sample below)
          3) The prototype library for the AJAX functionality in Javascript

          Sample Javascript
          function someFunction(arg1, arg2) {
          	var url = 'ajax-modx-rocks.html';
          	var pars = '';
          	pars += 'arg1=' + escape(arg1);
          	pars += '&arg2=' + escape(arg2);
          	var myAjax = new Ajax.Request(
          		url,
          		{
          			method: 'post',
          			parameters: pars,
          			onSuccess: function (resp) {
          				doSomethinghere();
          			},
          			onFailure: function (resp) {
          				alert('an error has occurred. lol.');
          			}
          	});
          }
          


          Note: I'm using an old version of prototype (Version 1.6.0.2) so the code may not work with the latest version of prototype. (Updating this to either a newer version of prototype or just changing it to jQuery is one of the many things on my to do list.)

          Let me know how it goes.

          Regards,
          Tom
            • 9995
            • 1,613 Posts
            Hmm, can't get your example working.

            I found: http://papermashup.com/parse-xml-with-jquery/
            Just need to find a way to load the detailpage when clicking on a title.

            [ed. note: fourroses666 last edited this post 12 years, 3 months ago.]
              Evolution user, I like the back-end speed and simplicity smiley
              • 39404
              • 175 Posts
              stalemate resolution associate Reply #6, 12 years, 3 months ago
              Quote from: fourroses666 at Jun 30, 2014, 09:56 AM
              Hmm, can't get your example working.

              I found: http://papermashup.com/parse-xml-with-jquery/
              Just need to find a way to load the detailpage when clicking on a title.


              I saw both this and the pre-edited version. If you're using jQuery and Prototype together, they conflict with each other, so there's a command to get them to play together well.

              I use both, so here's what I added:

              <!-- var $jQ = jQuery.noConflict() is added to prevent problems with prototype -->
              <script>var $jQ = jQuery.noConflict();</script>


              Prototype didn't work because the calls were sent to jQuery. Adding the above code meant that prototype got what it needed, but my jQuery js had to be changed to replace $. with $jQ.

              The link you sent also spoke about XML, but I don't think you're trying to load XML here. You might want to try something like this:

              $.get( "ajax/test.html", function( data ) {
              $( ".result" ).html( data );
              alert( "Load was performed." );
              });


              Hope this helps.

              Tom
                • 9995
                • 1,613 Posts
                Can't use my example because of crossdomain problems sad
                https://forum.jquery.com/topic/using-ajax-on-an-external-xml

                I will try to get yours working.

                thanks!
                  Evolution user, I like the back-end speed and simplicity smiley