Link to home
Start Free TrialLog in
Avatar of mankis
mankisFlag for Croatia

asked on

how to dynamically change content with swfaddress and php?

I have full flash site with swfobject and swfaddress. Title of the page changes dynamically with swfaddress. But how to do that with the content?
I have tried to get url and extract last word with PHP to use for switch break function but I can't get full url. With $url= $_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']; I get everything before sign #. Everything after sign # like it doesn't exists.
I know people do SEO for Flash sites with Swfaddress but I can't find tutorial for content change.
Please help.
SOLUTION
Avatar of ovi_mihai
ovi_mihai
Flag of Romania image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
The #xxxx isn't passed to the server.

I have a phpinfo() page on my server.

The URL I entered was ...

http://accounts.domain.local/global/phpinfo.php/a#123

Using WireShark, here is the HTTP header that was sent ...


So, PHP never gets it because the browser never sends it.


http://bytes.com/topic/php/answers/2167-get-content-url-after
http://stackoverflow.com/questions/940905/can-php-read-the-hash-portion-of-the-url
etc.
GET /global/phpinfo.php/a HTTP/1.1
Host: accounts.domain.local
Connection: keep-alive
Accept: application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/534.3 (KHTML, like Gecko) Chrome/6.0.472.51 Safari/534.3
Accept-Encoding: gzip,deflate,sdch
Accept-Language: en-GB,en;q=0.8,en-US;q=0.6
Accept-Charset: UTF-8,*;q=0.5

HTTP/1.1 200 OK
Content-Type: text/html; charset=UTF-8
Server: Microsoft-IIS/7.0
X-Powered-By: PHP/5.3.2RC3
X-Powered-By: ASP.NET
Date: Wed, 01 Sep 2010 10:42:49 GMT
Content-Length: 66070

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "DTD/xhtml1-transitional.dtd">
<html><head>
<style type="text/css">
body {background-color: #ffffff; color: #000000;}
body, td, th, h1, h2 {font-family: sans-serif;}
pre {margin: 0px; font-family: monospace;}
a:link {color: #000099; text-decoration: none; background-color: #ffffff;}

Open in new window

Avatar of mankis

ASKER

I'm not very good with JavaScript. Do you know some example or tutorial how to pass variable with document.location.hash to php?
Depending upon how the link is activated.

If it is within HTML, then a small JS to take the URL, find the hash and replace it with & (or ? if no & is found) hash=xxxxx, then PHP would get the hash value.

But.

You say that you are using Flash. I know squat about flash, but as I understand things, that is all within the flash object, so parsing stuff isn't in the browser (with JavaScript) but in the flash object (with ActionScript ? ).

Do you have a URL I can see what is going on?
Avatar of mankis

ASKER

Right. Give me a clue here. I don't know what language this is. I only read English (sorry).

As we said earlier, entering that will be received by the server as http://www.printas.ch/

The #/Home isn't going to be received by PHP. Or even the server. Any server. The browser won't send it.

So.

Having got a page with content, where do you want to handle the #hashes? Is it in the HTML links on the page or is it in the Flash?

Seems to be Flash.

This is the source of the page ...


So you need to alter your flash file to create valid URLs if you want to pass the hash value.

In fact, I'd say, having #hash in a flash file is daft.

The purpose of # is to allow a browser to put appropriate content on a long page into view.

Experts-Exchange uses them.

Your last comment was https://www.experts-exchange.com/questions/26441619/how-to-dynamically-change-content-with-swfaddress-and-php.html?cid=1572&anchorAnswerId=33575512#a33575512

The "a33575512" tell the browser to scroll that element whose id is "a33575512" into view.

Change the URL to #33575392 and my first comment will/should scroll into view. Nothing is sent to the server for this. It is all browser.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> 
<head> 
<title>printas.ch</title> 
 
 
 
<LINK href="css/style.css" rel="stylesheet" type="text/css" /> 
<script src="_js/swfobject.js" type="text/javascript"></script> 
<script type="text/javascript" src="swfaddress/swfaddress.js"></script> 
	<script type="text/javascript"> 
	function formValidator()
	{
		var up = document.getElementById("flash_uploader");
		var fb = document.getElementById('flash_block');
		var upload_button = document.theForm.action_upload;
		var upload_url = "upload.php";
		up.SetVariable("upload_to", upload_url);
		up.SetVariable("upload_dir", "files");
		up.SetVariable("ul", "1000");
		upload_button.disabled='true';
		return false;
	}
	function upload_complete(name,size,type,ft,dir,a)
	{
		window.location="index.php?name="+name+"&size="+size+"&type="+type+"&exts="+ft+"&dir="+dir+"&a="+a+"#/Eigene_Bilder_Hochladen";
		
	}
	function fileProps(name,size,type,cdate,mdate,dir)
	{
		var props = document.getElementById('props');
		props.innerHTML = "<div class='sucErr'><div class='tableHeader' style='width: 400px; height: 20px; padding-top: 5px;'>Selected File:</div><br /><table border='0' cellspacing='0' cellpadding='0' style='margin:10px;'><tr><td width='100'><b>NAME:</b></td><td> "+dir+"/"+name+"</td></tr><tr><td><b>SIZE:</b></td><td> "+size+"</td></tr><tr><td><b>TYPE:</b></td><td> "+type+"</td></tr><tr><td><b>CREATED:</b></td><td> "+cdate+"</td></tr><tr><td><b>MODIFIED:</b></td><td> "+mdate+"</td></tr></table></div>";
		props.style.display = "none";
	}
 
</script> 
 
<script type="text/javascript"> 
 
  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-1935008-12']);
  _gaq.push(['_trackPageview']);
 
  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();
 
</script> 
</head> 
 
<body> 
 
 
		
<form method="post" enctype="multipart/form-data" name="theForm" id="theForm" onSubmit="return formValidator();"> 
 
 
<div id="flash_block" style="display: visible;"> 
						<div id="FlashDiv"> 
Array
(
    [path] => www.printas.ch/
)
www.printas.ch/<br /> 
<b>Notice</b>:  Undefined index:  swfaddress in <b>/home/mankisho/public_html/index.php</b> on line <b>97</b><br /> 
<p><!-- Status(404 Not Found) -->Page not found.</p>                        
                        </div> 
					</div> 
					<script type="text/javascript"> 
					var fo = new SWFObject("printas50.swf?ul=100", "flash_uploader", "100%", "750", 9, "#A3B1A9", true);
						fo.addParam("allowScriptAccess", "sameDomain");
						fo.addParam("quality", "high");
						fo.addParam("scale", "noscale");
						fo.addVariable("to", "upload.php");
						fo.addVariable("upload_dir", "files");
						fo.addVariable("limit", "1000");
						fo.addVariable("types", "video|text|pdf|audio|archive|office|image|all");
						fo.write("FlashDiv");
					</script> 
 
		<!--<input name="action_upload" type="submit" value="Upload Video"><br>--> 
</form> 
 
  
 
	
</body> 
</html>

Open in new window

Avatar of mankis

ASKER

URLs are handled with JavaScript Swfaddress. In flash I import Swfaddress and set value="/Home".
I can't change URL. Swfaddress works like that.
Avatar of mankis

ASKER

I'm starting to belive that it can't be done
Avatar of mankis

ASKER

can it be done with htaccess?
http://oreilly.com/flash/excerpts/seo-for-flash/deep-linking-swfaddress-6-3.html

I'm not exactly sure what is happening. But it looks like you should be able to get the address BEFORE it is passed to PHP.

OOI. You don't have a # in the page title?
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of mankis

ASKER

I give up, just found that there is no point. Google doesn't see swfaddress deep linking http://stackoverflow.com/questions/433075/how-does-google-read-swfaddress-deep-paths
I will do HTML in background.
Thank you for your help.