Here are two options for passing an array via GET parameters (in a url): <A href="example.html?arr[]=val1&arr[]=val2&arr[]=val3">test</A> <A href="example.html?arr=<?PHP echo serialize($arr); ?>">test</A> In the first example, you can use $_GET["arr"] as an array. In the second you will first have to: <?PHP $arr = unserialize($_GET["arr"]); ?>
Tag Archive for url
Passing an array through GET request
Adobe AIR Open New URL with Sandbox Bridge
//This code is placed in the root document header
//This function is written to run from the sandbox. It opens a url in an external browser
function openExternalURL(href) {
var request = new air.URLRequest(href);
try {
air.navigateToURL(request);
}
catch (e) {
// handle error here
}
}
//Create an object that will be used to expose AIR functionality to the browser sandbox
var Exposed = new Object();
//Exposed can now be read from the sandbox, so can the above function. The open url
//function is added as a method of the exposed object.
Exposed.openExternalURL = openExternalURL;
function doLoad() {
//Place the Exposed object on the parentSandboxBridge property of the ui frame's window object.
var frame = document.getElementById('UI').contentWindow.parentSandboxBridge = Exposed;
}
//doLoad is placed inline on the body tag.
//Now to run the external function from inside the sandbox use. The function expects
//an argument that contains a URL.
parentSandboxBridge.openExternalURL(href);
Clean URL
<?php
$urlArray = explode("/",$_SERVER["REQUEST_URI"]);
$url_what = $urlArray[count($urlArray)-1];
if($url_what == 'home') {
// rather than index.php?act=home, url would be index/home
displayHome();
}elseif($url_what == 'contact'){
// rather than index.php?act=contact,url will be index/contact
displayContact();
}elseif($url_what == 'calendar'){
// rather than index.php?act=calendar,url will be index/calendar
displayCalendar();
}elseif($url_what == 'about'){
// rather than index.php?act=about,url will be index/about
displayAbout();
}else
//if $url_what doesn't exist, display home
writeHome();
?>
Subversion repository URL changed, update the working copy so that it points to the new URL.
svn switch --relocate <a href="svn://old_url/subversion-repository" >svn://old_url/subversion-repository</a> <a href="svn://shiny_new_url/subversion-repository
" >svn://shiny_new_url/subversion-repository
source
Category: Uncategorized |
Tags: Bash, command, commandline, subversion, svn, Switch, update, url, work
Using asfunction to trigger actionscript from a URL link.
function myFunction(param){
argumentArray = new Array;
argumentArray = param.split(",");
for (i=0; i< argumentArray.length; ++i){
trace("Function argument " + i + " = " + argumentArray[i]);
}
}
URL Manipulation
$a = $_SERVER['HTTP_HOST'] // server-name - domain $b = $_SERVER['PHP_SELF'] // you're page, as you know $c = $_SERVER['QUERY_STRING'] // everything after the "?", // but not including the "?" echo "$a$b?$c"; // would print whole URL $d = $_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF']."?".$_SERVER['QUERY_STRING']; // notice the "?" in middle of the above, and variables seprated by dots(.) // $_SERVER['QUERY_STRING'] reads url GET query, but does not contain // the "?" in it itself, since "?" is not a variable. echo $d; // would print the whole URL using above.
Get document’s URL arguments and FlashVars (a.k.a. parameters)
function getParams(documentRoot):Object
{
try {
var params:Object = LoaderInfo(documentRoot.loaderInfo).parameters;
var pairs:Object = {};
var key:String;
for(key in params) {
pairs.key = String(params.key);
}
} catch(e:Error) {
return {};
}
return params;
}
Javascript – Get Part Url
function getPartUrl(part) {
var query = self.location.href;
if( query.indexOf(part) == -1 ){
return false;
}else{
return true;
}
}
//Example
<script>document.write getPartUrl('news.php') ? 1 : 0</script>
Javascript – Get QS
<script>
function getQueryVariable(variable) {
var query = self.location.search.substring(1);
var vars = query.split("&");
for (var i=0;i<vars.length;i++) {
var pair = vars[i].split("=");
if (pair[0] == variable) {
if( variable == 'swf'){
salida = new String(pair[1]);
salida2 = salida.substr(0,salida.length-4);
}else{
salida2 = pair[1];
}
return salida2;
}
}
}
document.write(getQueryVariable('variableGET').toString())
</script>