Integrating Flash within Phpwcms using {PAGETITLE}

Post custom hacks and enhancements for phpwcms here only. Maybe some of these things will be included in official release later.
User avatar
jsw_nz
Posts: 907
Joined: Fri 2. Apr 2004, 02:42
Location: New Zealand

Integrating Flash within Phpwcms using {PAGETITLE}

Post by jsw_nz »

I am prototyping a project that utilizes the embedding of Flash within phpwcms. The flash file/files are primarily in the header section, which would control animated text, 2 loadMovie calls (one call to load a quick jpeg, the other to load antoher *.swf, and the loading of both and xml and text file. Since each page is unique, the problem was how to create a scenario where the flash file (and its resources - embedded fonts and actionscript code) could be reused across page templates....that way reducing clutter and redundancy in the page template section and eliminating the need to reload the base movie on each unique page.

I was surprized to find out that the unofficial {PAGETITLE} replacement tag can be invoked within the FlashVars parameter, providing Flash (Version 6 or greater) a unique variable from which to call a CASE/SWITCH function to load other parametered objects such as those discussed (jpg,swf,xml,txt). The Flash code in the header follows standard proceedure and accepts the {PAGETITLE} tag within phpwcms.

Code: Select all

<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="750" height="135">
<param name="movie" value="flash/header_1.swf">

<param name=FlashVars VALUE="myVariable={PAGETITLE}"

<param name="quality" value="high">
<embed src="flash/header_1.swf" 

FlashVars="myVariable={PAGETITLE}"

quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="750" height="135"></embed></object>
Basically myVariable can be cased and control the downloading of additional page specific files. The [PAGETITLE} replacement tag was discussed earlier on the boards and tweaked by Oliver himself:

Code: Select all

// ----------added 4_16_04
//content.func.inc.php

 // PAGETITLE replacement 
 if( ! (strpos($content["all"],'{PAGETITLE}')===false)) { 
   $content["all"] = str_replace('{PAGETITLE}', $content["struct"][$content["cat_id"]]
["acat_name"], $content["all"]); 
 } 

// -------------------------------------------------------------
Just thought I would put this out there for others that are looking for a simple way to utilize Flash across multiple templates. so far I have tested this off my localbox running Apache 2.0.49 as a W2K service. Tested in NS 4.75, 6.2, IE 6, Firefox/Mozilla 0.8.

Cheers,
jsw
marco

Post by marco »

Is there a web site to see an example of how this works?
User avatar
jsw_nz
Posts: 907
Joined: Fri 2. Apr 2004, 02:42
Location: New Zealand

Hi Marco

Post by jsw_nz »

Well, not exactly. I do have a demo page for client approval, showing the concept of using Flash within Phpwcms. As such the page is static (copy and pasted) out of phpwcms and then posted. Having said that, I am resusing the Flash file, here on my local box, and have gotten the code/parameters to work. Once the site goes online and is fully integrated with phpwcms...I will post. What I am interested in is in exploring menu system that would be based on querying Oliver's DB and returning XML to Flash. Thinking of applying it to the buttons at top of page. I believe Fluvio and Dr. Swank had been working on this.....serializing xml. Xml is a little new to me, so any pointers/scripts that are 'phpwcms specific' would be appreciated.


Cheers, jsw
Last edited by jsw_nz on Fri 16. Jul 2004, 11:26, edited 1 time in total.
marco

Flash and PHP classes

Post by marco »

I came across this on http://www.sephiroth.it/file_detail.php?id=129

XML2Object:

"This class allow you to tranform every kind of XML file into a Native AS Object. Inside the .zip there is also an example on how to use it"

"This class, that is just a translation of a simple set of function written for Flash MX, translates any kind of XML document into a readable Flash Object. "

It might be what you are looking for.
If not, look around, there is a lot of useful stuff on that site and links to other resources;
User avatar
jsw_nz
Posts: 907
Joined: Fri 2. Apr 2004, 02:42
Location: New Zealand

Post by jsw_nz »

Thanks for the link. The Sephiroth.it site is really great. the XML2Object, from what I understand is 2K4, and since I am MX only at this stage (and I might add a newbie with regards to XML) I am taking some baby steps first.

I have been able to create a pretty reliable php script to generate all the parameters from the phpwcms_articlecat into a well-formed XML format, that would be necessary for the immediate project. It is based on Fulvio's original project posted at ionrock's website. I took out the include statement, thus eliminating the adobd.inc download of 100K, and translating it to more stardardized mysql syntax.

Having said this, the same should apply to an XML driven (navigation-only) Flash sidebar mod. Looking into this for the time being, along with balancing other more mundane tasks. If I make any progress will post.

Cheers,
jsw
User avatar
jsw_nz
Posts: 907
Joined: Fri 2. Apr 2004, 02:42
Location: New Zealand

OK, another post

Post by jsw_nz »

Normally a work in progress is not to be shown, but since my approach to parsing XML is 'less than perfect' I thought I would show 'a work in progress'. Basically I have been able to query Oliver's DB and return valid XML for a flash version of the NAV_COLUMN.........yet it is not perfect. Thus far, since I am working off my local box, (locahost) thus I am posting a demo that looks at a static XML (derived from querying the Oliver's DB) and showing level_0 structure only. I am woking on bringing in subcategories (level_1) and sub_subcategories (level_2) as well....yet these are not shown in this demo. Hopefully it will give the idea. Wanted to ask if others, with a flash XML background would be willing to look at methods within the file (In order to perfect them). more than willing to email/post:

http://www.intermundi.com/aaa_sportotag ... ogress.php

(Hint, click on the + signs to see concept....allowing previewing (not page reloading) of subcategories/ sus_subcategories when completed
Please Note: bars -- main links are local - localhost)

Cheers,
jsw
marco

Re: OK, another post

Post by marco »

That looks great!
Last edited by marco on Tue 8. Jun 2004, 06:07, edited 1 time in total.
Pappnase

Post by Pappnase »

hello john

good work!!!!!!
frold
Posts: 2151
Joined: Tue 25. Nov 2003, 22:42

Re: OK, another post

Post by frold »

jsw_nz wrote:Basically I have been able to query Oliver's DB and return valid XML for a flash version of the NAV_COLUMN.........yet it is not perfect.
http://www.intermundi.com/aaa_sportotag ... ogress.php

Cheers,
jsw
Hey

First of all it looks very good!!

Regard this post: http://www.phpwcms.de/forum/viewtopic.p ... highlight= do you have plan to make a "save your site in pdf?" or is it "only" the menu you make a XML output of? Or is it also the content types....

Do you know XML-fo?
http://www.studmed.dk Portal for doctors and medical students in Denmark
User avatar
jsw_nz
Posts: 907
Joined: Fri 2. Apr 2004, 02:42
Location: New Zealand

Thanks all

Post by jsw_nz »

Thanks for the interest...
Hopefully it can become open source (in some way), once I get the 'kinks out'.

Hey Frold...
That article looks like an real interesting option for the system (particularly XML-FO). Thanks for pointing it out, sort of glossed over that thread. With regards to the XML used in the menu, it basically queries the phpwcms_articlecat table, pulling two primary params, acat_alias (for creating index.php?alias links) and the acat_name (for labeling the buttons). In this respect it is about as pretty basic as it gets.

To work.....requires that all categories get an alias in the site structure. I think my array structure within Flash (after XML parsing) may have considerable room for improvement, which is what I am working on. Still a student of these matters....

At the end of the day, what interests me is how the menu might offer subcategory exploration before actually retrieving a page as well as more flexible app development for pages that need to send multiple url parameters. I know Oliver's external URL repTag addresses this, so my point may be moot. Still in progress. got level 2 worked out...sort of....

cheers and best regards,
jsw(john)
User avatar
jsw_nz
Posts: 907
Joined: Fri 2. Apr 2004, 02:42
Location: New Zealand

Just posted an update

Post by jsw_nz »

Hi Pappnase, Frold and Marco. Just got the little menu farther along..now works with three levels.. I have tested it with my local installation of RC-4, and works OK. I posted a Flash/Swf/Xml/Php zip package, hoping you might test if you have the time. Would be interested in the feedback....

http://www.intermundi.com/aaa_sportotag ... ress_3.php

All best, john (jsw)
frold
Posts: 2151
Joined: Tue 25. Nov 2003, 22:42

Re: Just posted an update

Post by frold »

jsw_nz wrote:Hi Pappnase, Frold and Marco. Just got the little menu farther along..now works with three levels.. I have tested it with my local installation of RC-4, and works OK. I posted a Flash/Swf/Xml/Php zip package, hoping you might test if you have the time. Would be interested in the feedback....

http://www.intermundi.com/aaa_sportotag ... ress_3.php

All best, john (jsw)
Hey I have tested it.....

But it will not get my structure levels? Maybe you can tell my what is wrong?

http://www.instrukser.dk/rc4/phpwcms_flash_menu.php

I uploade the files and changed the database settings in getWCMS.php?
What else to do?
http://www.studmed.dk Portal for doctors and medical students in Denmark
frold
Posts: 2151
Joined: Tue 25. Nov 2003, 22:42

Post by frold »

You can see a demo here:

http://www.instrukser.dk/rc4/index.php

where I have inserted it into my template
http://www.studmed.dk Portal for doctors and medical students in Denmark
User avatar
jsw_nz
Posts: 907
Joined: Fri 2. Apr 2004, 02:42
Location: New Zealand

Hi Frold

Post by jsw_nz »

I think I know the reason.........the zip includes the original Flash MX file that must be opened and changed within Flash itself. Basically the demo loads a local static XML file, just to demonstrate the parsing. There is a set of lines in Flash that need to be changed (Frame 5) execute XML layer:

Code: Select all

myXML = new XML();
myXML.onLoad = parseMe;

//uncomment for online setings;
//myXML.load("getWCMS.php");

//comment out or delete for online setings;
myXML.load("myXML_10.xml");

//param must be a valid alias;
function getPage(param) {
	
//change to desired parameters for online settings;
var WCMS_Page = "http://www.myDomain.com/index.php?"+param+"";
	
//uncomment next line for online setings;
//getURL(WCMS_Page);
	
//show link in textbox within this demo uncomment for online settings:
_root.alias_link_textbox = WCMS_Page;
}
That query file getWCMS.php is....based on Fulvio's FCMS system. It basically does a query for acat_alias, acat_id and acat_name of the phpwcms_articlecat table. I removed his ado useage, and wrote a pretty standard mySql script. There may be tweaking to be done there. The main variable is the alias, since Flash sends a string back to the system using Oliver's alias feature.

One thing I thought about after uploading, were issues of rewrite being turned on. I have not tested under these conditions. For starters, might want to run the script and then view the source of the page. Should be one continuous XML string. Thanks for trying it out.

Cheers, John

jswnz@xtra.co.nz

UPDATE: June 12 - Just changed the query file to reflect acat_hidden
REQUIREMENTS:

(1) FLASH MX
(2) All categories in site structure must have aliases defined

This setup has been tested on localbox only.
Last edited by jsw_nz on Sat 12. Jun 2004, 02:01, edited 4 times in total.
frold
Posts: 2151
Joined: Tue 25. Nov 2003, 22:42

Re: Hi Frold

Post by frold »

jsw_nz wrote:I think I know the reason.........the zip includes the original Flash MX file that must be opened and changed within Flash itself. Basically the demo loads a local static XML file, just to demonstrate the parsing. There is a set of lines in Flash that need to be changed (Frame 5) execute XML layer:

Cheers, John

jswnz@xtra.co.nz
I do not have flash mx...
http://www.studmed.dk Portal for doctors and medical students in Denmark
Post Reply