How do I implement PHP to work with hype projects?

Yes, leave it with me for a few hours. The local server, has it the latest PHP server installed upon it ?

Any my code does not need any SMPT info, the PHP server deals with it all :smile:

Okay, here is the working app folder:

emailTest.zip (167.2 KB)

Here you can see it working upon a live server:

http://www.puppetonmuppets.com/emailTest/

Remember servers queue mail requests, so it may not be instant, but within 2 mins.

EmailTest Project Files:

emailTestProject Files.zip (100.6 KB)

2 Likes

Wow, thanks Andrew!
It worked perfect from the website that you were hosting it on! However, I’m not sure how to set up a local server. I had no clue until you told me that I needed it, should be obvious I guess since it’s php (which I’m not used to work with though… excuses :stuck_out_tongue: ).

I managed to install XAMPP on my mac computer and added the files to the correct path which is under “htdocs”. I’ve tried some phpinfo and hello codes and they are working as they should do. I’m not sure why your example isn’t. I’m not getting a result in the resultbox. Maybe that’s a clue?

I’ve followed these manuals, with a little bit of modifying obviously:
https://blog.udemy.com/xampp-tutorial/
http://codedog.net/2013/12/03/mavericks-xampp-and-sendmail-oh-my/

Note: Some codes are missing, like in the last link where the main.cf is nowhere to be found.

Do we have access to the server, via IP, to the page in question ?

Sorry but I’m not sure if I can do that since it’s not hosted on any domain.
Here is what I get in the javascript console on chrome, when I click on the send button:
[context: document, selector: “#email”, jquery: “2.1.3”, constructor: function, toArray: function…]

And this is what I get with firebug, no errors in any browser:

You can also install MAMP to simulate a server on your Mac. I use this for wordpress development all the time.

https://www.mamp.info/en/

You only need the free version then you can run your php scripts right on the desktop

1 Like

If you are running a server, it will tell you the IP of the server, if the server is connected to a router, you will get an internal IP, like, 192.168... From within the route, you can port forward :8080 to the servers local address. Then the IP on your router you just provide, and we, on the outside, just need to put that ip, with port 8080, example

45.322.213.21:8080/index.html

This is the best way, and I cannot see why this would not work. That said, what is on the post tab ?

1 Like

Hi again MrAddy and nick! Thank you so much for your help! I managed to create a server that is working on a PC using the link you provided me nick (WAMP in this case)! Also, I managed to send an email with phpMailer so the send email is working as it should.

Today I have been trying to implement the new php-code into your hype project MrAddy, as well as adding a virtual keyboard for the touch monitor that will display the site.

Since I am quite unsure on how php is coded I am in need of your help again. What I need is the “send-email.php” file to collect the information from the #emailbox just like yours did. I’ve been trying many ways but I can’t find out how to do it, but I guess it has to do with the $email that has been replaced with $mail.

A little note: I will also be in need to collect data from an image in the scene, just like how the $subject works. Any idea on this one?

Thanks again for all the help!
emailproject2.0.zip (610.8 KB)

1 Like

I forgot to tell you that I have modified the email adress and password before the upload here but I guess that is pretty obvious :slight_smile:

Based on this awesome thread does someone want to put together a quick tutorial for integrating content generated via PHP or a quick howto for email forms made within Hype?

2 Likes

Hi Daniel! As soon as I get this working correctly I will post a tutorial on how I solved it.
The problem right now is that I need to collect the data from the text input inside hype and change the addAddress in my send-email.php to the email that has been typed inside the text input. I have no idea how to do this :confused:

UPDATE::: I fixed it! Borrowed some of Andrews code and implemented it in the new php file that I created. Thanks for all the awesome help! Will get back this weekend/next week and make a tutorial for anyone else who’s having trouble getting it up and running!

1 Like

All:

I created a Hype site that uses php to generate a QR code using the public QR code library from Denso Wave technology.
I use an HTML iframe that displays my php code.
Take a look.

http://gressle.com/QRCode.html

6 Likes

Awesome Nick! Great job! A little note: Add a placeholder text in your input instead so the user don’t have to remove the text before typing :smile:

1 Like

Thanks for that. I put the “Your Data or URL” in the form field as the prompt.
Several of my testers asked for it to be put in the field :wink:

But I agree with you I want to remove it in a future update.

Hello nick, good job, looks awesome.
Care to share some notes on how to approach things, when doing front-end/back-end with Hype/php?

/BK

1 Like

The way I worked was to create the php as a separate page and then use Hype as a wrapper.
With the help of an iFrame Insert/HTML Widget this is the easiest approach

Making your php fit that iFrame is the most complex aspect of the process.

Why do it this way?

When I develop I am looking to solve a challenge without creating additional issues.
Hype is an incredible tool for doing what it does best making very solid interactive User Interface experiences.

While you can process form fields with PHP I want the heavy lifting to be done outside of Hype and then wrapped up with a Hype GUI.
This also helps me to isolate issues into modules that I can address quickly.

Does that help?

2 Likes

Also this is a great tool to make PHP form building even easier.
Open Source as well.
It also has a data visualization module.
http://www.formtools.org/

This is a good way to design forms on your site and then wrap into your Hype document.
Or you can code your own PHP script line by line whichever is more fun :wink:

1 Like

Excellent, new to Hype, looking forward to do some experimenting.

What I am looking for is basically logging in to service (php backend), then with php reading data and writing out as a json data, then catch it with Hype and do things visually ( with scenes and so on)…I think that is possible, no?

Do you know of any examples out there (new to the forums as well myself), showing similar approach, of reading data outside (initiating data read from hype) then reading json and visually doing something in Hype?

Thanks again.

/BK

You can definitely use JSON and PHP to do data updates…
Hope these links help you out :smile:

http://hype.desk.com/customer/portal/questions/1473335-looking-for-a-way-to-call-and-access-json-data-in-hype

So many of the tutorials have been focusing on javascript and jQuery but you can definitely create a Hype front end to a PHP backend set of data.

I would definitely explore some of the PHP libraries and then practice with those to get your backend up and running quickly so you can focus on the hooks necessary to display with your Hype elements.

For example:
intervention Image is an open source PHP image handling and manipulation library. It provides an easier and expressive way to create, edit, and compose images and supports currently the two most common image processing libraries GD Library and Imagick.
http://image.intervention.io/getting_started/introduction


And this is a nice compilation of 25 favorites by CodeGeekz

1 Like