Re: force swf refresh

2006-12-27 Thread Chris Hartjes


On 12/25/06, gabordemeter [EMAIL PROTECTED] wrote:


Hi all and Merry Christmas,

I have a page on which I have a swf movie loaded via the swf object
helper



I know I'm coming a little late to the party here, but it sounds like
you're trying to use PHP/SWF charts, and I have an excellent online
tutorial on how to get it working with CakePHP:

http://www.littlehart.net/atthekeyboard/2006/09/26/tutorial-integrating-phpswf-charts-with-cakephp/

Hope that helps.

Chris Hartjes

The greatest inefficiencies come from solving problems you will never have.
-- Rasmus Lerdorf

@TheBallpark - http://www.littlehart.net/attheballpark
@TheKeyboard - http://www.littlehart.net/atthekeyboard

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: force swf refresh

2006-12-25 Thread Claudio Poli 


don't know if it will work, but maybe you can prevent caching appending
a ?hashhere to chart.swf.

hash can be generated in multiple ways, like a date or a md5 hash.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: force swf refresh

2006-12-25 Thread phirschybar


If the movie is grabbing data every time it is loaded, the issue is
probably not with caching the actual flash movie but maybe the DATA the
movie is grabbing from the controller is coming from a cached source.
If you need it to be fresh on every page load, make sure that it is not
grabbing the data from a cache. Make sense?

On Dec 25, 10:56 am, Claudio Poli   [EMAIL PROTECTED] wrote:

don't know if it will work, but maybe you can prevent caching appending
a ?hashhere to chart.swf.

hash can be generated in multiple ways, like a date or a md5 hash.



--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: force swf refresh

2006-12-25 Thread gabordemeter


Thanks for the feedback Claudio. Alreay tried doing:

?php echo $swfobject-display('/swf/chart.swf?nocache='.floor(rand(1,
100)/rand(1, 1)), 'Chart', '800' , '350', '7' , '#fff'); ?

IE doesn't seem to care. Still showing the old chart.

Any other suggestion. Is it possible to send something in the header of
the page to force the browser to download the swf as opposed to caching
it?

Changing the name of the file every time is not a good option as the
same .swf will be used by all users (the graph is drawn dinamically in
AS after receiving the data from cake via amfphp).



On Dec 25, 10:56 am, Claudio Poli   [EMAIL PROTECTED] wrote:

don't know if it will work, but maybe you can prevent caching appending
a ?hashhere to chart.swf.

hash can be generated in multiple ways, like a date or a md5 hash.



--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: force swf refresh

2006-12-25 Thread gabordemeter


phirschybar, I thought of that, but given that FIrefox (on Mac and Win)
and Safari do not have any problem updating the movie, I think the
problem is not on the server but rather on the client (as only IE seems
to not refresh it).



On Dec 25, 11:04 am, phirschybar [EMAIL PROTECTED] wrote:

If the movie is grabbing data every time it is loaded, the issue is
probably not with caching the actual flash movie but maybe the DATA the
movie is grabbing from the controller is coming from a cached source.
If you need it to be fresh on every page load, make sure that it is not
grabbing the data from a cache. Make sense?

On Dec 25, 10:56 am, Claudio Poli   [EMAIL PROTECTED] wrote:

 don't know if it will work, but maybe you can prevent caching appending
 a ?hashhere to chart.swf.

 hash can be generated in multiple ways, like a date or a md5 hash.



--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: force swf refresh

2006-12-25 Thread Claudio Poli


no problem,
I know the issue because I've worked with swf charts and IE keeps  
caching the file.
there's something you can do, instead of putting an hash to swf, try  
putting something like this in source url:

/controller/action/param?uniqueid='.uniqid(rand(),true)

kain

On 25/dic/06, at 17:11, gabordemeter wrote:



Thanks for the feedback Claudio. Alreay tried doing:

?php echo $swfobject-display('/swf/chart.swf?nocache='.floor(rand(1,
100)/rand(1, 1)), 'Chart', '800' , '350', '7' , '#fff'); ?

IE doesn't seem to care. Still showing the old chart.

Any other suggestion. Is it possible to send something in the  
header of
the page to force the browser to download the swf as opposed to  
caching

it?

Changing the name of the file every time is not a good option as the
same .swf will be used by all users (the graph is drawn dinamically in
AS after receiving the data from cake via amfphp).



On Dec 25, 10:56 am, Claudio Poli   [EMAIL PROTECTED] wrote:
don't know if it will work, but maybe you can prevent caching  
appending

a ?hashhere to chart.swf.
hash can be generated in multiple ways, like a date or a md5 hash.







--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: force swf refresh

2006-12-25 Thread phirschybar


gabordemeter:

sorry I missed the part about it working in FF. But still doesn't the
SWF have to grab the data on every load, even if the SWF is cached?

Claudio:

to satisfy my curiosity.. what file do you think IE is caching?

On Dec 25, 11:25 am, Claudio Poli [EMAIL PROTECTED] wrote:

no problem,
I know the issue because I've worked with swf charts and IE keeps
caching the file.
there's something you can do, instead of putting an hash to swf, try
putting something like this in source url:
/controller/action/param?uniqueid='.uniqid(rand(),true)

kain

On 25/dic/06, at 17:11, gabordemeter wrote:



 Thanks for the feedback Claudio. Alreay tried doing:

 ?php echo $swfobject-display('/swf/chart.swf?nocache='.floor(rand(1,
 100)/rand(1, 1)), 'Chart', '800' , '350', '7' , '#fff'); ?

 IE doesn't seem to care. Still showing the old chart.

 Any other suggestion. Is it possible to send something in the
 header of
 the page to force the browser to download the swf as opposed to
 caching
 it?

 Changing the name of the file every time is not a good option as the
 same .swf will be used by all users (the graph is drawn dinamically in
 AS after receiving the data from cake via amfphp).

 On Dec 25, 10:56 am, Claudio Poli   [EMAIL PROTECTED] wrote:
 don't know if it will work, but maybe you can prevent caching
 appending
 a ?hashhere to chart.swf.
 hash can be generated in multiple ways, like a date or a md5 hash.



--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



RE: force swf refresh

2006-12-25 Thread Mariano Iglesias


Or can't you build a Proxy controller for such files and let the controller
add header tags for browsers not to cache (must-revalidate, etc.)? So then
from your view instead of placing the OBJECT tag to directly find the swf
you use the controller as a source, something like

/animations/animation.swf

And then the animations controller is something like:

class AnimationsController extends AppController
{
var $name = 'Animations';
var $uses = null;
var $animationPath = WWW_ROOT . DS . 'animations';

function index($file)
{
$filePath = $this-downloadPath . DS . $file;

// Check against path injection

		if (preg_match('/^[A-Za-z0-9_\-\.]*$/', $file)  
is_readable($filePath))

{
if (!headers_sent())
{
$size = @filesize($filePath);

if ($size  0) 
{ 
	header('Content-length: ' . $size); 
}


// Disable caching

header('Cache-Control: no-cache, no-store,
max-age=0, must-revalidate');
header('Expires: Mon, 26 Jul 1997 05:00:00
GMT');
header('Pragma: no-cache');

// Set content type

header('Content-Type:
application/x-shockwave-flash');
}

readfile($filePath);
exit;
}

return $this-redirect('/');
}
}

-MI

---

Remember, smart coders answer ten questions for every question they ask. 
So be smart, be cool, and share your knowledge. 


BAKE ON!


-Mensaje original-
De: cake-php@googlegroups.com [mailto:[EMAIL PROTECTED] En nombre
de Claudio Poli
Enviado el: Lunes, 25 de Diciembre de 2006 01:26 p.m.
Para: cake-php@googlegroups.com
Asunto: Re: force swf refresh


no problem,
I know the issue because I've worked with swf charts and IE keeps  
caching the file.
there's something you can do, instead of putting an hash to swf, try  
putting something like this in source url:

/controller/action/param?uniqueid='.uniqid(rand(),true)


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



RE: force swf refresh

2006-12-25 Thread Mariano Iglesias


Fix this:

$filePath = $this-downloadPath . DS . $file;

Should be:

$filePath = $this-animationPath . DS . $file;

-MI

---

Remember, smart coders answer ten questions for every question they ask. 
So be smart, be cool, and share your knowledge. 


BAKE ON!


-Mensaje original-
De: Mariano Iglesias [mailto:[EMAIL PROTECTED] 
Enviado el: Lunes, 25 de Diciembre de 2006 01:37 p.m.

Para: 'cake-php@googlegroups.com'
Asunto: RE: force swf refresh

Or can't you build a Proxy controller for such files and let the controller
add header tags for browsers not to cache (must-revalidate, etc.)? So then
from your view instead of placing the OBJECT tag to directly find the swf
you use the controller as a source, something like


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: force swf refresh

2006-12-25 Thread Claudio Poli


On 25/dic/06, at 17:37, phirschybar wrote:


gabordemeter:

sorry I missed the part about it working in FF. But still doesn't the
SWF have to grab the data on every load, even if the SWF is cached?

Claudio:

to satisfy my curiosity.. what file do you think IE is caching?


the content sent to the swf ie. the source.
happens that some browsers (IE) might download only one istance of  
the source, if it's dynamic, and cache it; AFAIK the solution is to  
append an unique value to its url.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: force swf refresh

2006-12-25 Thread gabordemeter


Claudio:

Not sure I understood what you suggest. You say:

  instead of putting an hash to swf, try
  putting something like this in source url:
  /controller/action/param?uniqueid='.uniqid(rand(),true)


where should I put this? the source of the file is 'swf/chart.swf'.
There's no controller, no action and no param. Just the swf folder with
the chart.swf file in it.

If I do 'sfw/chart.swf?uniqueid='.uniqid(rand(),true) this is exactly
what i've done already and it did not work.

Remember, I was using:

$swfobject-display('/swf/chart.swf?nocache='.floor(rand(1,100)/rand(1,
1)); Isn't this same as what you suggest?






On Dec 25, 11:58 am, Claudio Poli [EMAIL PROTECTED] wrote:

On 25/dic/06, at 17:37, phirschybar wrote:

 gabordemeter:

 sorry I missed the part about it working in FF. But still doesn't the
 SWF have to grab the data on every load, even if the SWF is cached?

 Claudio:

 to satisfy my curiosity.. what file do you think IE is caching?the content 
sent to the swf ie. the source.
happens that some browsers (IE) might download only one istance of
the source, if it's dynamic, and cache it; AFAIK the solution is to
append an unique value to its url.



--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: force swf refresh

2006-12-25 Thread gabordemeter


Mariano,

Just tried it. The flash movie doesn't load.

I used the class exactly like provided (I made the correction from
downloadPath to animationPath), with the only difference being:

var $animationPath = WWW_ROOT . DS . 'swf';as my sfw file is in the
swf folder in the root.

Then, from my view, I called ?php echo
$swfobject-display('/animations/lifechart.swf', 'Lifechart', '861' ,
'351' , '7' , '#fff'); ?.

When rendered, the view creates an empty Flash movie of 861px width and
351 height. When right clicked, it says 'Movie not loaded'.

Did I do anything wrong? I also tried adding $this-autoRender = false;
to the index() method of the animations controller.




On Dec 25, 11:39 am, Mariano Iglesias [EMAIL PROTECTED]
wrote:

Fix this:

$filePath = $this-downloadPath . DS . $file;

Should be:

$filePath = $this-animationPath . DS . $file;

-MI

---

Remember, smart coders answer ten questions for every question they ask.
So be smart, be cool, and share your knowledge.

BAKE ON!

-Mensaje original-
De: Mariano Iglesias [mailto:[EMAIL PROTECTED]
Enviado el: Lunes, 25 de Diciembre de 2006 01:37 p.m.
Para: 'cake-php@googlegroups.com'
Asunto: RE: force swf refresh

Or can't you build a Proxy controller for such files and let the controller
add header tags for browsers not to cache (must-revalidate, etc.)? So then
from your view instead of placing the OBJECT tag to directly find the swf
you use the controller as a source, something like



--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



RE: force swf refresh

2006-12-25 Thread Mariano Iglesias


What do you get when you access that URL directly from your browser, eg:

http://server/animations/lifechart.swf

-MI

---

Remember, smart coders answer ten questions for every question they ask. 
So be smart, be cool, and share your knowledge. 


BAKE ON!


-Mensaje original-
De: cake-php@googlegroups.com [mailto:[EMAIL PROTECTED] En nombre
de gabordemeter
Enviado el: Lunes, 25 de Diciembre de 2006 02:29 p.m.
Para: Cake PHP
Asunto: Re: force swf refresh

Just tried it. The flash movie doesn't load.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: force swf refresh

2006-12-25 Thread Claudio Poli 



gabordemeter ha scritto:


Claudio:

Not sure I understood what you suggest. You say:

   instead of putting an hash to swf, try
   putting something like this in source url:
   /controller/action/param?uniqueid='.uniqid(rand(),true)


where should I put this? the source of the file is 'swf/chart.swf'.
There's no controller, no action and no param. Just the swf folder with
the chart.swf file in it.


I never heard or used swfobject helper, anyway you say:
The movie gets data from a cake controller and plots it on a chart.
I assumed that you can call a controller action dinamically, just like
php/swf charts do.
Did you hardcode the controller action into chart.swf?



If I do 'sfw/chart.swf?uniqueid='.uniqid(rand(),true) this is exactly
what i've done already and it did not work.

Remember, I was using:

$swfobject-display('/swf/chart.swf?nocache='.floor(rand(1,100)/rand(1,
1)); Isn't this same as what you suggest?


well, see above, sorry if I misunderstood.
http://www.maani.us/charts/index.php?menu=Tutorialsubmenu=Chart_Source
see caching.

kain


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---