Jump to content

Passing values to a php script used as a source for a flash object


Recommended Posts

Hello,

 

here is some HTML code that I have in my index.php :

 

<OBJECT classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0' WIDTH=1000 HEIGHT=650 id='charts' ALIGN=''><PARAM NAME=movie VALUE='charts.swf?library_path=charts_library&stage_width=1000&stage_height=650&php_source=myChart.php'> <PARAM NAME=quality VALUE=high> <PARAM NAME=bgcolor VALUE=#4C5E6F> <EMBED src='charts.swf?library_path=charts_library&stage_width=1000&stage_height=650&php_source=myChart.php' quality=high bgcolor=#4C5E6F WIDTH=1000 HEIGHT=650 NAME='charts' ALIGN='' swLiveConnect='true' TYPE='application/x-shockwave-flash' PLUGINSPAGE='http://www.macromedia.com/go/getflashplayer'></EMBED></OBJECT>

 

It is calling a flash chart. All the configuration of the chart (color, axis, fonts...) is done in myChart.php, which is used, as you can see obove, as a source for this flash chart.

 

I would like to pass some values to myChart.php, so that I could control different things when users click on buttons on index.php. What's the easiest way to do that ?

 

Thanks for your help,

Stephane

I'm using this chart module : http://www.maani.us/charts/index.php

 

It is a php chart module, that uses flash to diplay the chart. It allows you to graphically plot some values. I'm using it to plot some values fetched in a mySQL database.

 

The way it works is you type the HTML code I have written above in the web page you want the chart to appear. Actually, this HTML code is generated by a php function. But it doesn't matter. What I have typed above is what I see in the source of my page in which my chart is.

 

Then, to configure the chart, you use an external php page, which allows you to set the desired type of graph (bar/line, etc...), the fonts, the colors, and specify the data that will be plotted in the chart (x values/ y values).

 

The way it seems to work is, you have this flash object in your web page. When it loads, it executes the php script (in my case myChart.php) and uses the xml values that this script returns, to feed the flash object with all the configuration data.

 

The xml that myChart.php outputs begins like this :

 

<chart>
<chart_data>
	<row>
		<string></string>
		<string>U546</string>
		<string>U789</string>
		<string>U123</string>
		<string>U751</string>

 

The <string> objects are my x values. Later in the xml, are some config tags :

 

 

<axis_category size="12" color="000000" alpha="50" font="arial" bold="1" skip="0" orientation="diagonal_up" />
<axis_ticks value_ticks="1" category_ticks="1" major_thickness="2" minor_thickness="1" minor_count="1" major_color="000000" minor_color="222222" position="outside" />

 

They describe the settings I have chosen in myChart.php.

 

What I want to do is be able, in myChart.php, to read the value of some PHP variables that I would define in my index page.

 

My problem is that I don't include index.php in myChart.php, nor do I include myChart.php in index.php. myChart.php is just a parameter in my flash object.

 

Hope you understand, let me know if I'm not clear. I know this is a bit complex.

 

Thanks a lot in advance,

Stephane

Let me simplify the problem.

 

I have an index.php page. The php code I have in this index page doesn't matter for now. In this index page, is an html tag that calls a flash-based chart module. This module runs a PHP script when it is launched, that is called myChart.php. This PHP script describes how the chart should look, and what data it should plot.

 

This is how I could simplify index.php :

<flash chart><Param = ... &php_source=myChart.php></flash chart>

I'm just trying to simplify all the syntax so that you get the idea.

 

I would like to be able, from myChart.php, to access some variables, that I would define in index.php. How can I do that, knowing that I never include myChart.php in index.php ?

 

Thanks for your help,

Stephane

I would like to be able, from myChart.php, to access some variables, that I would define in index.php. How can I do that, knowing that I never include myChart.php in index.php ?

 

The only way you could possibly do that would be to store these variables within the $_SESSION array.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.