Solved

how to dynamically change content with swfaddress and php?

Posted on 2010-08-31
12
773 Views
Last Modified: 2012-06-27
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.
0
Comment
Question by:mankis
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 5
12 Comments
 
LVL 3

Assisted Solution

by:ovi_mihai
ovi_mihai earned 100 total points
ID: 33574501
you can access the hash in JavaScript with

 document.location.hash

(the hash is everything after # )
0
 
LVL 40

Expert Comment

by:Richard Quadling
ID: 33575392
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

0
 

Author Comment

by:mankis
ID: 33575512
I'm not very good with JavaScript. Do you know some example or tutorial how to pass variable with document.location.hash to php?
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 40

Expert Comment

by:Richard Quadling
ID: 33575537
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?
0
 

Author Comment

by:mankis
ID: 33575547
0
 
LVL 40

Expert Comment

by:Richard Quadling
ID: 33575613
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 http://www.experts-exchange.com/Software/Photos_Graphics/Web_Graphics/Macromedia_Flash/Q_26441619.html?cid=1572#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

0
 

Author Comment

by:mankis
ID: 33575766
URLs are handled with JavaScript Swfaddress. In flash I import Swfaddress and set value="/Home".
I can't change URL. Swfaddress works like that.
0
 

Author Comment

by:mankis
ID: 33575828
I'm starting to belive that it can't be done
0
 

Author Comment

by:mankis
ID: 33575877
can it be done with htaccess?
0
 
LVL 40

Expert Comment

by:Richard Quadling
ID: 33575901
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?
0
 
LVL 40

Accepted Solution

by:
Richard Quadling earned 400 total points
ID: 33575908
Can't use htaccess.

The _BROWSER_ doesn't send the # anywhere.

It is _NOTHING_ to do with the server.
0
 

Author Comment

by:mankis
ID: 33575928
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.
0

Featured Post

Enroll in June's Course of the Month

June’s Course of the Month is now available! Experts Exchange’s Premium Members, Team Accounts, and Qualified Experts have access to a complimentary course each month as part of their membership—an extra way to sharpen your skills and increase training.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The last time I worked with Flash and Socket connections was in AS1. A recent project required flash connecting to a Socket, and sending receiving information - we figured it would be easy enough - we all know about the socket policy documents and c…
I have found that much of my time doing support ends up being a constant repetition of the same steps to different people.  Early on I stated using web pages with Frequently Asked Questions (FAQs) to alleviate most of the burden.  Sometimes this jus…
The goal of the tutorial is to teach the user how to select the video input device. Make sure you have an input device that in connected and work and recognized by Adobe Flash Media Live Encoder and select it in the “video input” menu.
This Micro Tutorial will teach to how to utilize bit rate in Adobe Flash Media Live Encoder.

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question