What I was doing was creating "Embedded Flash" blocks, where I embed a Flash swf file into a block (so to speak). You might have need to embed 4 Flash movies in a page. Then, you'll need to communicate between them (potentially). So, I made a php block which I called "phpblock_embedFlash" ...... the code is at the bottom of this post, bear in mind I'm not finished, I just know what I need to do. I definitely need a working model though, the Flash stuff is the "big deal" for me, not the blog. If down the road there exists a better way than mine I'll cheerfully move to it, I just need something now, not later. So certainly there are going to be better ways than mine to do it, this is just what I did and I'm still working on it. So in this case I first need it working so to see that I only need to pass one variable over, the URL where the Flash swf file is located. In the Geeklog admin section, when you add a php type block there are a number of other fields already available in the interface that don't get used, because I needed to pass an URL type variable, I decided to use that textfield for the info. I started off by adjusting the calling line to include the one variable ...
Text Formatted Code
function phpblock_myFunction($helpVar) {}
... as I only needed one variable to begin with, to make a base working prototype from. Here is the phpblock .....
Text Formatted Code
function phpblock_embedFlash($theVars) {
return '<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="300" HEIGHT="225" id="mini_readerWH" ALIGN="" VIEWASTEXT>
<PARAM NAME="movie" VALUE="'.$theVars.'">
<PARAM NAME="quality" VALUE="high">
<PARAM NAME="bgcolor" VALUE="#FFFFFF">
<param name=menu value=false>
<EMBED src="$theVars" quality="high" bgcolor="#FFFFFF" WIDTH="400" HEIGHT="300"
NAME="mini_readerWH" ALIGN="" TYPE="application/x-shockwave-flash"
PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer"></EMBED>
</OBJECT>';
}
.... as you can see I've used the variable "$theVars" to represent the location of the swf file - the source. This works fine with one swf in a page, but I need to make this work for more than one, so now I need to set the id's of the flash object so now I need to pass more than one parameter. I still haven't exactly figured out how I want to do it, but my first thoughts were to use the "Help File URL" field in the "Create New Block" view and pass a string of variables like ....
"source=http://mysite.xxx/myfile.swf&id=jabber&width=300&height=300"
... and so on, and then separate it within the phpblock, but then I figured that maybe not in this instance but in other phpblocks that I create I might have a use for the name and title of the block so I added them to the arguments passed, I really haven't given any real attention to how I might alter the interface to better reflect to other users that you can pass arguments. Of course maybe I should just pass the entire $A array like so .....
Text Formatted Code
function phpblock_myFunction($A) {}
.... and perhaps I will, I was just really surprised to find php blocks didn't have a specified state for arguments so I set about doing it and if I don't post things as I do them I never go back and post at all, I'm more interested in moving on to whatever is next. I've only just now started to think about perhaps changing the admin interface pages to better reflect what the fields are for -- as in, make a arguments field for the phpblock that is labelled as such.
Your thoughts?
Greg.
PS I hate the way this page handles code blocks. I did the best I could to make it readable.