Chrome Extension as GUI for JSON API - php

I'm working on some kind of a huge project using PHP which is a CRM and Smart Ticketing and Processing System for travel agencies and I'm planning to make it only available on chrome.
And I'm new to Chrome Extensions/Apps, But when i'm reading about creating extensions i surprised that i can create any html content with any JS codes included.
My questions are:
Can I include my application GUI with pure HTML && CSS && JavaScript in some extension and make it send/receive requests to my PHP-API Which already exist in my code since it's fully AJAX project?
And if this can be done; what do i have to create Google-Chrome-App or Google-Chrome-Extension And what is the difference between them and where to start reading about required solutions.
IF this can be done it will be perfect since the GUI elements (HTML, JS, CSS, Images, etc..) will be loaded from local store of each user/employee's machine and the only transferred data would be JSON requests.

Yes, you can create your GUI in pure HTML, CSS and JavaScript. This is actually the only way to make a GUI in Chrome extensions. Your PHP based API can certainly be accessed via an extension, if designed as a fairly typical client side accessible API.
Here's a brief description of Extensions and Packaged Apps:
Extensions are generally designed for augmenting the browser experience. For example, analyzing the pages the user is browsing and highlighting text. Chrome exposes several awesome APIs related to the browser and the browsing experience. However, it's just JavaScript, CSS and HTML, so it's definitely possible to take it a step further and create pretty much fully functional applications. However, there are no UI specific features in the Extension API that would make it easier to create a complex web app. This is not the purpose of Extensions. Look at the extension in the Chrome Web store to see some examples. Development documentation can be found here.
Chrome Packaged Apps allows you to develop a full blown desktop application using HTML, CSS and JavaScript. You can create complex applications with typical web technologies. This is a fairly new technology, but there's a lot of potential.
There is also the slightly confusing concept of a "Chrome App", which is really just a way to package a typical web application (or site) for display in the Chrome Web Store. This is not not really a development technology.
Keep in mind that Chrome Extensions and Packaged Apps are not drop-in UI frameworks for creating web apps. They are specific technologies for augmenting the browser experience and creating desktop-like apps, respectively.
For example, if you are creating Amazon.com you would not create the main website as an Extension or Packaged App. You would probably develop it using a typical web development stack and release it as a typical web site. Then, you might create a Chrome Extension that pops a window down in your Chrome browser and shows your recent orders, or that finds products on the Amazon store as you browse the internet, but you would probably not create the entire site as an extension.
With Packaged Apps you might create a desktop application that interacts with Amazon but this is really just a desktop application.

Yes of course this is possible but what you are making is a web application A chrome extension is literally a extension of chrome(which has to be installed) written in C or C++ (Just using javascript, html and css is possible). The handy thing about a web application is that it can be used (In every browser) without having to instal any extra components.
To be specific google has extensions and apps. With a specific chrome app you can do more than a regular web page. At first people would have to install the app and agree with the terms of use. this done you have more options in javascript which are normally forbidden for a casual webpage.
A extension is meant to add or change functionalities in chrome like adding your own video player extension to play avi or something like that. Not for building a web application.
If I where you just make a regular web application or create a chrome specific Packaged App.
In your case you are creating a private web application. If it is going to be used inside a lan you can just create a intranet and run your webapp there. If it has to be used global over the internet that you should just secure it with a login.
Or build a desktop application.

Related

Ruby on Rails to PHP CodeIgniter

I have no experience in Ruby on Rails. I employed a developer to create a tour booking system for my site (php codeigniter). He developed it using Ruby on Rails in heroku and then linked to it by iframe in my front end.
Problem is
MS explorer doesnt display it,
issues with dynamic booking form sizing,
Cookies for the cart doesnt work as it's cross site and in iOS sometimes the security denies the cookies so system doesnt work,
Site massively slowed down due to the http requests.
Is there a way to convert the ruby system into php so i can just have it on my local site? Can anyone think of any other solution if not??
thanks
Unfortunately, there is not easy way to convert a language to another, with some exception (like language that compiles to another one, for example CoffeeScript to JavaScript). Using iframes will create security problems, which in turn trigger (modern) browser to block them.
So, what are your options?
Use the Ruby & Rails website as a subdomain of your main. Example, if your site runs on chambers.com and that the Ruby on Rails site is about invoicing, it could be on invoncing.chambers.com, and you could use links from one to the other
Rewrite either the Ruby or the PHP part, depending on size & team capability

Developing website front-end on Mac with Asp.net MVC back-end

I am an Asp.net back-end developer who uses Visual Studio on Windows and I work with a front-end team who all use Macs. I'm trying to workout the best way for us to work together without me having to repeatedly integrate the front-end into the Asp.net site. i.e Manually add the front-end changes into the *.csHTML views
I'm proposing to....
Ditch using Asp.net MVC Views all together and just let the front-end team build the web pages as plain old *.htm files, like a static website build
Any communication from front-end to the back-end is done via Ajax calls. So while they are developing on Mac they can point the Ajax calls to the back-end on a Windows box. This will essentially make the Asp.net site just a Web service site.
Any configuration settings that need to be pulled through to the front-end from the back-end is done via Ajax calls.
Note-
Our sites will only ever support javascript enabled browsers (I know it's not ideal but that's the situation i'm in).
Are there any glaring issues you can see by developing Asp.net sites this way? I
'm feeling like this a new trend in web development in general, as the front-ends become more and more rich and ajax heavy.
I guess this isn't a Asp.net specific question, as it could be applied to web language ike PHP.

Turning Web App to Mobile App... PhoneGap?

I want to delve in to mobile applications, specifically Android apps (I am an Android fanboy). My web application is a content based site; built with PHP/MySQL and served with a lot of HTML5, CSS3 and JQuery.
What would be the best starting point and direction to take to begin development of a mobile application? I've seen a couple of videos on PhoneGap and it seems very interesting with its standards-based cross-platform approach. Is that a good way to go?
My basic intend is to have an application that can load content from my site (served to the app probably as JSON or XML) which the application can render in native UI (or make use of local storage etc. that a simple web content frame won't do). I guess it would be a glorified mobile site, but I want it to me slightly more with the ability to save and render content for if internet is not available.
PhoneGap does a nice job of bridging native APIs so they are available to your JavaScript. What you really need to consider though is the look, feel, and performance of the HTML/CSS/JavaScript you run on top of PhoneGap.
I have recently started building an app with JQueryMobile. The look and feel is really nice, and I was able to build something very rapidly. However, page transitions are very blinky/choppy to the point where I don't think its acceptable. This is really a problem with Android's browser performance and not JQuery Moble.
Sencha Touch seems to have animations and transitions that are a bit smoother, but it has a steeper learning curve.
Another option is to create an application which is a hybrid, containing some PhoneGap based Activities and some purely native Activities.
Since you are already familiar with web development, I would suggest doing a quick sprint with PhoneGap and Sencha Touch. If it looks promising, stick with it. If it doesn't, abandon it for a native app.
If you want to use native UI & controls, then Phonegap will not help you. It essentially wraps HTML/CSS/JS in an app & provide JS API's for native device features. It does not help you create native UI & controls.
You can directly code in native Java or use Titanium if you want to code in JS and build portable apps with native UI.
If you are only going to be targeting Android, then I would suggest avaioding PhoneGap or other cross platform SDK's. If you're comfortable with Java or are willing to learn, go with the Android SDK tools and Eclipse.
I have found that working with JSON is extremely simple on Android, and dealing with xml is not that much harder.
If you want to stay away from coding in Java, you could simply use what you have already as an HTML5 app, and create a new mobile CSS to reflow the look and layout of your app. That way, you can still use all the HTML and javascript you are currently using, and get your info from the same server...
In my experience though, Android web app are very slow... unfortunately (and hopefully Chrome will fix this) android browser is very bad with javascript... very slow.

MySQL, PHP based website statistics

Trying to integrate something like tracewatch into admin panel of my PHP, MySQL based website.
But I need 1 page solution, not heavy system like twatch with user management.
I wonder, is there any simple php class or mini app for this purpose (want to get something like this on admin page)?
There are bunch of tracewatch alternatives. Here are somes:
Piwik
Piwik is an open-source Web analytics application developed using PHP and MySQL. It has a "plugins" system that allows for utmost extensibility and customization. Install only the plugins you need or go overboard and install them all – the choice is up to you. The plugins system, as you can imagine, also opens up possibilities for you to create your own custom extensions. This thing’s lightweight – the download’s only 1.9MB.
FireStats
FireStats is a simple and straight-forward Web analytics application written in PHP/MySQL. It supports numerous platforms and set-ups including C# sites, Django sites, Drupal, Joomla!, WordPress, and several others. Are you a resourceful developer who needs moar cowbell? FireStats has an excellent API that will assist you in creating your own custom apps or publishing platform components (imagine: displaying the top 10 most downloaded files in your WordPress site) based on your FireStats data.
JAWStats
JAWStats is a server-based Web analytics application that runs with the popular AWStats (in fact, if you’re on a shared hosting plan – AWStats is probably already installed). JAWStats does two things to extend AWStats – it improves performance by reducing server resource usage and improves the user interface a little bit. With that said, you can’t go wrong with just using AWStats either if you’re happy with it.
SimpleStats
Simple Stats is a PHP based, web analytics utility designed to enable you in monitoring visits on your website. It is very simple to install, and it's interface goes straight to the important facts such as the Google search queries (understand "the search expressions in Google") that your visitors might have used to browse to your website.
You could try Piwik. You can access features using an API or embed a widget via iframe.

Is it possible to embed Python in PHP?

I work for a small tech start-up, and our main site is built on the CMS Drupal, which is a PHP-based CMS. However, I know some Python and would like to develop web applications to integrate with the website and allow users to interact with them.
How would I go about doing this? Does anyone have any experience or knowledge? Any particular module/script/etc that allows using Python or calling Python from PHP or Drupal?
If you are developing a web application nothing stops you from using Python and making it accessible from a subdomain or path not used by drupal, just have the web server point to it. Ex:
http://mainsite.com/ <- drupal
http://app.mainsite.com <- python web app
http://mainsite.com/python/ <- python web app
This is fairly straight-forward with most web servers. Django might be particularly well suited for this, it has a nice feature which can inspect live databases, and generate models for you:
python manage.py inspect.db > models.py
Which lets you interact with your existing database from Python with a nice ORM.
If you need to literally call Python from a PHP page, you can use zeromq for fast IPC or TCP communication, or build a simple REST API, etc.
There are several different ways to do integrate Drupal with external applications, but your best bet is probably installing the services module in Drupal, and make calls from your Python app over HTTP, just as you would interact with a remote server.
Some other options:
Interact directly with Drupal's database, rather risky as Drupal's database structure can change significantly with module upgrades or even configuration changes.
Place the Python app within an iframe of a Drupal page, giving you Drupal's design, though no functional integration.
Use JavaScript as a client-side middle-man between Drupal and Python.
Use command line as a server-side middle-man between Drupal and Python. Drush would be useful here.

Categories