Hype 3 with JSON and PHP


(Ken Judge) #1

Morning All,

Firstly I am new to Hype and had a question yesterday and would just like to say its refreshing to be part of a forum where you actually get answers so thank you for that.

I would like to ask the advice on a project I have been tasked to do which is an re-write to a previous project, I previously wrote a project in WPF which was basically a bookshelf which downloaded locally and unzipped the customers ePub Files, the ePub files themselves are nothing more than images, Sound, some JSON, HTML and Javascript which I was able to run in a AWESOMIUM Web Control. The Bookshelf also called many PHP APIs to read and write data to a MySQL database on the server to record various results and check purchases etc.

I am getting hooked on this Hype and in the process of seeing how to convert this ePub File to a HTML file using Hype and wondered if the above is possible in Hype 3 or should I just re-write in WPF. The Previous WPF app was a Windows Desktop based Application and you can imagine the issues when trying to install on customers PCS who have all sorts of stuff running and incorrect versions of .NET framework and Media Players etc, so I was thinking if I could use Hype 3 to make it Browser based especially with the option to specify different setups for different browsers maybe this would be a better option.

What do you Hype Experts think ?

Kind Regards
JudgeyK


How do I implement PHP to work with hype projects?
(Andrew) #2

I think I follow, based on the last part you would rather use HYPE than WPF, but you want to know if you can use PHP with it. That is a YES and NO answer :smile:

No, HYPE does not support PHP, as an editor. But you can write and use PHP in any HYPE project, and by using Ajax calls from Hype, you can communicate with PHP file.

Personally i would not write PHP as a resource file, I would write it externally, and keep it external.

I have no idea what a ePub looks like, but any ‘publication’ type can be created in HYPE :slight_smile:


(Ken Judge) #3

Hi Andrew,

Thanks for the response, I would rather try to use HYPE as I can control the application more in a browser than as a Desktop Application, the previous version was in WPF, and getting people to perform simple tasks to us such as .Net Framework, or media players even when they were provided as part of the installation was a bit of a nightmare.

With reference to the PHP, all the PHP are API Calls to a web server , so not actually PHP, after speaking with the developers (they’re Chinese ), I am pretty sure its just a web addy to call a PHP file which returns a result set which is just JSON, so all I need to do is say call something like

http://judgeytest.com/getbooinfo.php?bookno=L1-1

This would return a JSON set which I would need to read and present in the Hype3 app.

An ePub is nothing more than a zipped up file, which contains javascript files, a css file, fonts, audio and images. Unfortunately the project developers have customised there ePub so much it no longer functions in the standard ePub environments such as iBooks or Kindle etc so I need to write an application to wrap round it to be able to play the books.

WPF for me would be the easier option, but I want to try something different for the reason outlined above.

Regards

JudgeyK


(Andrew) #4

Okay, so using Ajax (JQuery) you could send data, if needed, to this php file, and receive the response, and then create Hype Functions to display the information. The outcome would be the same as a ePub, in a folder but it is html and javascript.

So easier to build, easier to serve also.


(Ken Judge) #5

Cheers Andrew,

Much Appreciated.