Phonegap build, iOs Android app: opening a link inside the app - php

I have a php website that is live on webserver,
From my understanding I see that I cannot make a index.php page as the home page of my app. As an alternative I have made an index.html page and put a link in it that points to my php page.
I am using phonegap build to compile the app
The error that I am getting is that the link is opening in the default web browser of my phone instead of within the app itself.
In the html page title I have added
<script src="phonegap.js"></script>
<script type="text/javascript" charset="utf-8" src="cordova.js"></script>
In the config.xml file I have added
<feature name="InAppBrowser">
<param name="android-package" value="org.apache.cordova.inappbrowser.InAppBrowser" />
</feature>
<access origin="http://mydomain" subdomains="true"/>
I have tried www.appsgeyser.com and my website opens up within the app itself in the android apk that I made over there ( in fact while making the app i only provided my website landing php page and it worked perfectly , so there has to be a way to use php in phonegap) , but they don't have an option to build in ios and I would like to use phonegap build instead.
What am i doing wrong?
Thanks,

Depending on how responsive your index.php file is, an easy fix would be to place an iframe in your html.index file.
So something like this:
<body>
<iframe style="width:100%; height:100%;border:none"
src="http://***path-to-your-php-file***.php" />
<script type="text/javascript" src="cordova.js"></script>
<script type="text/javascript" src="js/index.js"></script>
<script type="text/javascript">
app.initialize();
</script>
</body>

Related

Proper use of Bootstrap 3 Tooltip on a PHP based system

I have been trying to get this tooltip code to initialize on a page and I cannot get the jQuery to connect properly.
We have PHP running on Ubuntu and we are using Silverstripe. I cannot get the following script to work, no matter where or what file I add it to. I have even tried calling it in from a separate file and it also did not initialize.
How would I add this code to a PHP or SS file? (Silverstripe CMS file)
$(function () {
$('[data-toggle="tooltip"]').tooltip()
})
<button type=\"button\" class=\"btn btn-default help-tool\" data-toggle=\"tooltip\" data-placement=\"top\" title=\"Below you will find state-by-state breakdowns in Federal, State, and where available Local categories.
Explore the data by clicking the map or by clicking the magnifying lens in the table view.\"><i class=\"fa fa-info-circle fa-fw\"></i></button>
This is generally an issue involving the order in which your scripts are called.
As I'm sure you know, you need to call JQuery before Bootstrap, which it seems like you are doing. Your tooltip code, which is in a different file, is most likely being called before your JQuery and Bootstrap have a chance to load. You can test this by copying your JQuery and Bootstrap script calls into your separate file right before the tooltip script call.
If your script calls are at the bottom of your body tag, and part of the page is being dynamically loaded, you can try calling JQuery and Bootstrap in your head tag instead after your CSS:
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" type="text/css" src="bootstrap.css" />
<link rel="stylesheet" type="text/css" src="main.css" />
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="bootstrap.js"></script>
</head>
<body>
<!--
Your separate file code that
includes tooltip
-->
<!-- Before
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="bootstrap.js"></script>
-->
</body>
</html>
There are two causes that come to mind here. First, it's possible that the $ is getting interpreted by SS's template parser as a variable expression. I would expect you would be getting an error if that is the case. Second, as Sumit Kukreja indicated it's likely that jQuery and Bootstrap are being injected at the bottom of your template and this code is getting executed before those are loaded.
Option 1: To verify if this is happening you could add the following code to Page_Controller::init() or mysite/_config.php:
Requirements::set_write_js_to_body(false);
Which will cause all required javascript to be added in the <head> tag. Not a good idea for production but could help diagnose your problem.
Option 2: You can include that javascript from your controller using Requirements::customScript.
Option 3: Wrap your js snippet in a non-jquery domready listener like so:
document.addEventListener("DOMContentLoaded", function(event) {
$('[data-toggle="tooltip"]').tooltip()
});

imaps builder map not viewed in php localhost properly

I designed a map using imapsbuilder. it gave me a javascript which can be used inside my code to view the map but the problem is its not being viewed properly in php. Someone please help me.
<script type="text/javascript" src="http://g3.imapbuilder.net/_api/?s=66e09d9be7bef2be0a12285bac364c88&m=22671" charset="utf-8"></script>
<script type="text/javascript" src="http://g3.imapbuilder.net/_api/?s=d0b187c9f3cae7f52b14798f2ac89be0&m=22674" charset="utf-8"></script>
I put your code into a php file outside the tag and seems it works fine.
So you can try to close your php tag, put the script code and then open the php tag again.

Dynamic comment system issue

I am adding a dynamic commenting system from ( here ) ( here the files ) to my site
Well the thing is that I can't make it work.
The script detects the full url of the webpage and saves the comments to a file associated to that url.
But since I have only one file (index.html) I think the system can't make the difference inside the file. I mean the code is like this:
<link rel='stylesheet' type='text/css' href='./jscomms/style_light.css'/>
<script type="text/javascript" src="./jscomms/jquery.js"></script>
<script type="text/javascript" src="./jscomms/jquery.comments.js"></script>
<script type='text/javascript'>
$(document).ready(function(){
$("#comments").comments();
});
</script>
<div id='cont' style='width:450px; margin:45px;'>
<div id='comments'>
<noscript>Need Java to comment</noscript>
</div>
</div>
So, if I am able to make some variable identifier in this code maybe it will work, I don't know really.
I was trying to change this line
......
$("#comments_identifier").comments();
.......
<div id='comments_identifier'>
.....
And the script shows, but I am unable to "click" the publish button.

using lightbox with code igniter

I'm trying to use Lightbox with my CodeIgniter application. Lightbox says to put the following in the head tag:
<script type="text/javascript" src="js/prototype.js"></script>
<script type="text/javascript" src="js/scriptaculous.js?load=effects,builder"></script>
<script type="text/javascript" src="js/lightbox.js"></script>
<link rel="stylesheet" href="css/lightbox.css" type="text/css" media="screen" />
I already had a js folder and a css folder, so I put the js and css folders that came with lightbox within my js and css folder. I changed the 3 script tags and link tags to:
<script type="text/javascript" src="js/js/prototype.js"></script>
<script type="text/javascript" src="js/js/scriptaculous.js?load=effects,builder"></script>
<script type="text/javascript" src="js/js/lightbox.js"></script>
<link rel="stylesheet" href="css/css/lightbox.css" type="text/css" media="screen" />
(added the /js and /css)
in the view file I have
<img name="<?php echo $row->Thumb;?>" src="http://www.doublediamondllc.com/uploaded/portfolio/thumbs/<?php echo $row->Thumb;?>" alt="">
This displays the thumbnail version, and then when clicked I want it to go to the lightbox, but now it goes to a new tab with the large image.
I've used lightbox before and have always gotten it to work, I'm not really sure what the problem is now, and I tried moving the files all around to different spots but nothing worked.
Thanks in advance!
It seems like the .js isn't getting loaded properly. Try using Firebug, and see if any errors pop up. Alternatively, check the links in the source for the page, and make sure they are pointing to the lightbox js files correctly. If you are using Firefox, view source; the links to the js files should appear as clickable links; click on them and make sure the js file appears, and not a 404 or some other error. Otherwise copy and paste the link attributes to your browser and check the .js paths are correct.

Why is error coming up for TinyMce blog editor?

I have installed the TinyMce blog editor to my site. When the compose blog page loads a I get a pop up that has the yield sign and says "Developer Key Validation Failed" Anyone know what this is?
<script type="text/javascript" src="javascripts/jquery/jquery-1.3.2.min.js"></script>
<script type="text/javascript" src="http://www.cysticlife.org/javascripts/jquery/jquery.corners.min.js"></script>
<script type="text/javascript" src="plugins/tinymce/tiny_mce.js"></script>
<script type="text/javascript" src="javascripts/system/config.js"></script>
<script src="http://www.google.com/jsapi?key=YOUR_API_KEY"></script>
<script src="http://gdata-javascript-client.googlecode.com/svn/trunk/samples/blogger/blog_this/blog_this.js"></script>
<div id="blog_this"></div>
I think that's a Google Data API error message; if so it's unrelated to TinyMCE. Are you using any Google data in the same page? If so, check your API key.

Categories