|
Post by jax on May 29, 2015 7:00:11 GMT
I am working on a display banner that will run some JSON driven queries to extract an image url and an integer from a MySQL table. I'm not likely expecting any help regarding what actual JSON code I am meant to be using to achieve this. What would be handy to know, however are the following : 1. Have I got the correct "place holders" for the image and price value that will dynamically load in?2. Where would I place the JSON code performing these queries?My guess is that I put the initial JSON for identifying 6 initial sets of img and price under the On Start and then consecutive sets would have code under something else.. not sure where. The plan is each time an arrow is clicked, it would load in 6 new car images and prices that match the MySQL query being called via JSON Down arrow loads in a new set of 6 and Up arrow loads in the previous set of 6. 3. Are there any foreseeable complications with this idea?attached is the banner. Specials Showcase Panel.hani (66.89 KB) this may be a dependency of the main project not sure : specials graphic.svg (9.82 KB)
|
|
|
Post by Hippani on May 29, 2015 8:05:32 GMT
Unfortunately Hippo only supports XML at the moment, no json yet. You might need to look at a 3rd party js file or change to XML.
|
|
|
Post by jax on May 29, 2015 10:22:20 GMT
When you say look at a 3rd party js file, do you mean I would need to code the JSON into a js file using a 3rd party editor? How would I go about working with that js file and the setup I attached or is that not possible in Hippo at all?
We are being trained in JSON as it seems to be a solid platform and we were advised that the industry is moving towards this for the many benefits it can provide over XML etc.
Will Hippo also be moving towards this in 5.0? I'm just worried as I've spent a lot of time over the years working with Hippo Animator and love the interface etc so migrating to a different software platform isn't something I really want to do but we are being trained in JSON so I know I'll have to rely on that pipeline for future work upon obtaining my Diploma in web development.
|
|
|
Post by Hippani on Jun 1, 2015 7:46:43 GMT
I'll add it as a suggestion but I can't really make promises.
What you need to do in Hippo is go to the library menu and 'Script file'.
Then you need to create some kind of function...
function GetJSON(....){.....}
You'll need to lookup some code for this. Somewhere on the internet there must be a JSON example. I it must use sockets and then a string parser.
Once you have created this, you can add it to every project you create.
|
|
|
Post by leorod on Jun 1, 2015 13:24:24 GMT
You can use an AJAX library to get the JSON string, e.g. nanoajax (https://github.com/yanatan16/nanoajax). Then you need to convert that response to an javascript object using a JSON parser. All modern browsers have a built-in JSON.parse() method to do that (http://devdocs.io/javascript/global_objects/json/parse).
|
|
|
Post by jax on Jun 1, 2015 22:57:52 GMT
I'll add it as a suggestion but I can't really make promises. What you need to do in Hippo is go to the library menu and 'Script file'. Then you need to create some kind of function... function GetJSON(....){.....} You'll need to lookup some code for this. Somewhere on the internet there must be a JSON example. I it must use sockets and then a string parser. Once you have created this, you can add it to every project you create. I did a hunt around for anything that matches what you are talking about but sadly all I can dig up are lists that explain how to use JSON. Couldn't find anything that goes through sockets and a string parser. Well I'll come back to this again later I guess if nothing has been implemented. Thanks for putting it in as a suggestion submission. I think with things like this you need to already know it to find an example of it.. when you are still learning it, finding the right example is more luck than anything else but that's ok, at least there appears to be a possible way of getting JSON to work with Hippo hopefully. Hi Leorod, That linked nanojax library looked interesting but yeah I'm pretty much clueless right now about how I would go about using that to achieve the desired results and am not entirely sure how I would go about initiating the callbacks so they go to JSON > PHP > MySQL and vice versa. Could be a simple problem of me still being half way through the studies so not knowing 100% of how to work with JSON yet may be the issue here and once that's understood all the helpful information will become valuable. The primary purpose of this topic was so I could plan ahead for the next stage of a project I'm working on. I wanted to set up the infrastructure so the JSON could be added in as we are being taught it.. seems like i'll need to know it all before i can start planning an infrastructure to support it. Might work out being more hassle than it's worth to go through Hippo for this purpose whilst it isn't supported but again until I actually complete the studies into this via my learning institution that's pretty vague speculation. In either case thank you both very much for providing the extra information and help I appreciate that you guys have taken the time to share this with me and I look forward to understanding what you have provided me with as I continue to progress through my studies. EDIT : So I just learnt that AJAX is used to generate queries and these are then distributed via either XML or JSON to reach the server so AJAX could be simplified to mean : Javascripts used for the purpose of sending and receiving queries. How you can actually make this work I'm still unclear but at least I get the relationship between the 2 now. For some reason it seemed like AJAX was an alternative to JSON. AJAX > JSON > PHP > MySQL would be the workflow apparently.
|
|
|
Post by jax on Jun 2, 2015 2:37:41 GMT
You can use an AJAX library to get the JSON string, e.g. nanoajax (https://github.com/yanatan16/nanoajax). Then you need to convert that response to an javascript object using a JSON parser. All modern browsers have a built-in JSON.parse() method to do that (http://devdocs.io/javascript/global_objects/json/parse). Hmm few specific questions : So in my researching I found that the standard jquery.js library includes a lot of AJAX related erm.. functions? The nanoajax library is likely a reduced library with just the functions related to using ajax right?How do we use external javascript libraries with hippo animator?As an example, I have added a Hotspot to that banner in the attached Hani file, over the word "Specials" When a user clicks on it, I want it to navigate to the /specials.htm page and run a (json or ajax .. not sure which it would be) query on my database tables so that the page only displays vehicles that are on special. Info about the database.. may or may not be relevant to the questionI have a table in my database called Vehicles and in that table is a boolean field called "specials"(bit1 actually but u know what I mean) I intend to create a website that dynamically loads vehicle data for all cars that have "specials" = true (or 1 in the case of how mysql lets me handle booleans) What I found so far is the following :GetTopUrl("specials.htm" onclick="function_name_for_database_query_goes_here();"); Which I would enter into the "On click" section of the Hotspot object inside Hippo Animator. I haven't tried this out of cause, because it's really a bit of a guess if this will even work or not and I haven't figured out where I am meant to reference any external js libraries or where I should be typing in the actual json/ajax function that I want to execute when someone clicks on the "specials" hotspot.
|
|
|
Post by Hippani on Jun 2, 2015 8:06:28 GMT
To add external libraries. Either copy the code into a hippo script file or add a script tag to the HEAD movie property.
Is specials.htm a hippo movie?
GetTopUrl("specials.htm");
this function call: function_name_for_database_query_goes_here(); needs to be inside specials.htm
|
|
|
Post by jax on Jun 2, 2015 11:26:55 GMT
Ahh thank you for this tip regarding the location for external libraries.
specials.htm was just a place-holder to represent a page in the website. index.htm would host the i-frame to my hippo movie and the hippo movie would probably be called specials_panel.htm or something.
I would have it so when you click on the word "specials" it navigates from index.htm over to catalogue.htm and filters the displayed vehicles list at the same time.
So if I get this right, I would create an external js file called "special_filter.js" or similar.
I would then open up my webpage : catalogue.htm using Microsoft Expression Web 4 and include the special_filter.js inside the HEAD section of the html code on that webpage.
I then open the special_filter.js file up and write the ajax? code. The ajax? or is it json code will be used to make sure settings are checked or unchecked on the "catalogue.htm" webpage in order to only display results that have the field "special" set to TRUE.
The question would then be.. how do I actually run that function since I only want it to filter the results on the "Catalogue.htm" page when you click on the "Specials" button inside the hippo movie that is embedded as an iFrame on my index.htm.
I'm going to guess that I can't do this inside the On Click script section of my HotSpot :
GetTopUrl("catalogue.htm" onclick="function_name_for_database_query_goes_here();");
or perhaps that's exactly what I do since the webpage "catalogue.htm" will now have the matching function "function_name_for_database_query_goes_here" linked via my javascript file "special\_filter.js"
To try explain it more simply : you click a hotspot-button on the embedded hippo movie and that then navigates the parent page (which holds the hippo movie) over to my catalogues page on the website.
it runs a script (linked into the catalogues page) which changes the filter settings so only cars on special are displayed in the catalogue.
and all this is done by including the following line of code in the On Click section of the previously mentioned hotspot in my hippo movie:
GetTopUrl("catalogue.htm" onclick="function_name_for_database_query_goes_here();");
|
|
|
Post by Hippani on Jun 3, 2015 12:07:53 GMT
You've totally confused me. But your json/ajax function should be run in the "on start" script I guess.
|
|
|
Post by Hippani on Jun 3, 2015 12:17:15 GMT
ajax means to request data from a web page. json is a data format.
|
|
|
Post by Danil on Oct 20, 2020 4:42:21 GMT
<a href=https://south.life/>море анапы</a>
|
|
|
Post by Rambuirm on Oct 21, 2020 18:55:01 GMT
tablets aygestin esibita <a href="http://tadalafil5walmart.com">zyloprim</a> possessif
|
|
|
Post by Irina on Oct 29, 2020 4:56:32 GMT
<a href=https://south.life/dosug-i-turizm/65-zmeykovskie-vodopady.html>Змейковские водопады</a>
|
|