I want to remote control my slideshow (jQuery plugin Cycle2) that displays pictures that are selected by the user and requested from a server via AJAX. The server side script returns the whole HTML output for the pictures and additionally a navigation bar for stopping/pausing the slideshow.
Now, what I want is to have these navigating functions as a small web app on a smartphone to remote control the slideshow run on the server. I thought about a SOAP based webservice for the interaction between smartphone and server. The problem is how do I write functions that execute actions on my slideshow? Is it possible to trigger a button of a PHP script from within a function of another one?
I hope the problem became clear. I'm not asking for code, I simply don't know how to proceed here.
Ok, it just came to my mind. I can execute AJAX calls on the slideshow from a function of the webservice. Then however, I have to deal with these problems: Ways to circumvent the same-origin policy
Would that be a good way to do this?
Related
I am building a website that will call a third-party web service. This web service is sometimes slow, however, and clients visiting the webpage aren't familiar with the loader on the browser tab. This results to them clicking, again and again, the search button that calls the web service and it gets never completely sent.
I was thinking of making an overlay page with a CSS loader right in the middle of the page so that it's more than obvious that something's loading and force them to wait. I tried researching how to run a script while an HTTP request is being sent, but didn't get any answers. Any thoughts?
Thanks in advance for your time.
The WiP website is https://b2b.a-link.gr/ (unfortunately a client username and password is required to access it) and the web service website is https://www.soft1.eu/. The web service has a database through which I pull out data to make searches on my website.
I am trying to make a single page web app that runs over a websocket for all server request. After the user logs in, I want the page to change the html to display a dashboard (first page).
I have a template for the dashboard already build from a previous version. I need to find a way to input database info into template and send the page over the websocket as a string for the javascript to display.
I don't know how to fill the template using php classes without hard coding it into the class, then turning it into a string so I can send it. The dashboard is very complex and has dynamically built menus for each users per their settings and permissions.
Am I looking at this whole problem wrong? I have some experience with MVC from ruby on rails/node.js, but unfortunately this app is stuck using php. Can I use a framework with the socket? Should I have the JS load the template through https and send the data over the socket? (The JS guy would not like that).
I am running Ubuntu, apache2, php7, Ratchet WebSocket(wss), composer, and MySQL all on AWS.
I would definitely let the frontend get the required data. You could use php as a backend to test the authentication, parse the request, get the data from the database and send it to the frontend. The frontend then would need to update the application using dom manipulation (think jQuery).
Or, php could send a generated view that would be shown in a div in the frontend.
In this setup, I would not recommend websockets, but just plain AJAX.
From what I gather from your question, you might be better of using a real SPA framework like AngularJS. It it just better in using the data you will get from the backend. You could then choose to use a PHP backend using AJAX or a Websocket backend like nodejs.
I am working on a project that was written in PHP and being served on an Apache server. I have been asked to integrate Socket.io live chat functionality into a page that was written in PHP and served by Apache. To do this, I've been writing a Node.js application with Express. But I can't figure out a way to integrate my Express app into the PHP page.
I have googled this for several hours and found many tutorials about running Node.js and Apache on the same server but different ports, but as I understand it, that strategy would limit me to serving different pages or different files. What I need is to be able to use the Socket.io livechat function on the PHP page.
I thought maybe I could use an iframe integrated into the PHP page to display the livechat window itself, but I also need to display new chat request notifications on the PHP page and give the user the ability to click different tabs to switch between chat windows. I thought I could probably have the tab clicks handled by writing a REST API on the Node.js end and letting the PHP page make calls to that. But I'm not sure how I would have the PHP page display new chat request notifications if I can't have Express and Apache handling the same page.
So my question is basically how to:
1) Configure things so one PHP page can be accessed and manipulated by both the PHP side and the Node.js/Express side of things, or
2) Route Socket.io events from the Node.js/Express side into the PHP side so that they can be handled on that end.
Context: I know minimal, minimal PHP--that's being handled by my colleagues, and my role is the JavaScript and Node.js stuff--so please keep that in mind.
I built a mobile website using jquery mobile (client side) and php/mysql (server side)
I found phonegap to put it in a native app. But despite many researches, i didnt found the answer for those questions :
how do phonegap loads pages in those two cases :
When the page refreshes without ajax
When a jqm page is loaded and injected with ajax
This question is crucial because if the page is loaded from my server, i would be able to put php into it. If pages are stored and brought directly from the client where the app is installed, I have to remove all php from my pages. On the other side, storing pages on the client would improve drastically the speed of the loading.
The best would be to choose for each ajax call of jqm, by a parameter, whether the first or the second scenario. Controlers written in php and returning json would be loaded from the server each time, but the jqm pages would be stored into the client phone as he download the app.
I have a second question:i ve downloaded the phonegap desktop app but i still dont know how to build an entiere app sendable to the stores. I found several technologies like phonegap build, do you recomand it ? i dont know a word in java..
Thanks for your help and please excuse me if Im wrong with english sometime.
I am new in PhoneGap,
I have a Joomla Site, I want to create a PhoneGap App using that Joomla site. so is this possible ? if yes than how can i implement it ?.
You can use. But you have to create web services for request and responses. Because Phonegap will not run PHP script. So you can create webservices to access Joomla functionality via JSON responses from your joomla. You can get the JSON data via jQuery in your phonegap app.
and someone said PGBuild will convert webpage into phonegap app. You can try it also.
I have succeeded creating an application as follows:
Design your Joomla page so it's responsive and renders correctly on your mobile;
Download the whole thing with wget
Edit all urls and make them point to the right (local-remote) locations.
I saved all css, images, js locally so the page would load even offline; then changed all the links so they point to the remote host;
All forms should point to the remote host;
Most modules and components were changed so after the initial display (local) they will load the updated info in the frame.
Popups won't be available, so you'll need heavy workarounds for facebook integration etc.
Also, if you plan to use any phonegap features, they will only be available if you load the library inside your downloaded page; this will force you to change all calls to ajax (no document.location.href calls are possible since you'll lose the phonegap javascript).
The first time you load the page from the server it will take forever to load. Ensure you have proper caching set up otherwise you'll just lose your customers.
My advice is to start with an ajax project at the very beginning, it will save you lots of headaches.
Keep in mind, if you plan to use iframes, forget it. They work lousily on iphones, and debugging is nearly impossible. Simply take your time to plan a real phone app in javascript & using Ajax for the calls.
You don't need any webservices in Joomla for loading content, simply use:
&tmpl=component
when you need the content of a module.
Additionally, for blogs and lists, Joomla makes RSS feeds available so you shouldn't need too much coding to achieve this.
I have limited myself to ajaxifying the modules, which makes caching more efficient on the server and the interfaces appear more dynamic.