473,382 Members | 1,689 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

PHP and Flash

Hi everyone,

I hope someone can shed some light on this for me!

I've just migrated a clients website over to our server. The site's
done completely in Flash, but uses a little PHP include to pull
various images from a folder and display them in the Flash movie.

Ok, this works fine on the old host, but I can't get it to work for
the life of me on my server. I've included the PHP script below. Any
feedback would be very much appreciated as I'm pulling my hair out a
bit now!

Thanks in advance,

Tom
snip ---------

<?php
function getFileStructure($doc, $curNode, $inDir){
//echo ("get file structure ");
if ($currentDirectory = opendir($inDir)){
while ($dirElement = readdir($currentDirectory)){
$pathToElement = $inDir . "/" . $dirElement;
if (is_file($pathToElement)){
$dotposition = strpos($dirElement, ".");
$fileName = substr($dirElement, 0, $dotposition);
$extension = substr($dirElement, 1 + $dotposition);
if ($extension == "jpg" or $extension == "JPG"){
$fileNode = addFileNode($doc, $curNode, $fileName,
$extension);
}
} else if($dirElement != "." && $dirElement != ".."){
$catNode = addCategoryNode($doc, $curNode, $dirElement,
$pathToElement);
}
}
closedir($currentDirectory);
}
return $curNode;
}

function addFileNode($doc, $parentNode, $fileName, $extension){
//echo ("add file node ");
$fileNode = $parentNode->append_child($doc->create_element('FILE'));
$fileNode->set_attribute('name', $fileName);
$fileNode->set_attribute('extension', $extension);
}

function addCategoryNode($doc, $parentNode, $catName, $pathToElement){
//echo ("add cat node ");
$catNode = $parentNode->append_child($doc->create_element('CATEGORY'));
$catNode->set_attribute('name', $catName);
getFileStructure($doc, $catNode, $pathToElement);
}
$rootDirectory = './images/';
$doc = domxml_new_doc('1.0');
$comment = $doc->create_comment('This XML document describes the files
to be
used for a web site');
$doc->append_child($comment);
$root = $doc->append_child($doc->create_element('NAVIGATION'));
getFileStructure($doc, $root, $rootDirectory);
//echo htmlentities($doc->dump_mem(true));
$xmlstring = $doc->dump_mem(true);
echo $xmlstring;

?>
Jul 17 '05 #1
3 1675
On 4 Jan 2005 06:19:57 -0800
to*@jb-solutions.co.uk (Tom Jordan) wrote:

:Hi everyone,
:
:I hope someone can shed some light on this for me!
:
:I've just migrated a clients website over to our server. The site's
:done completely in Flash, but uses a little PHP include to pull
:various images from a folder and display them in the Flash movie.

A "little PHP?" Is that like being a "little bit pregnant?"

Anyway, without seeing the errors, or even knowing what version of PHP
you're using, I would say that perhaps the dom/xml stuff isn't enabled
on your server.

--
Tony Reed
<tr***@altern.org>
Jul 17 '05 #2
Hello,

on 01/04/2005 12:19 PM Tom Jordan said the following:
Hi everyone,

I hope someone can shed some light on this for me!

I've just migrated a clients website over to our server. The site's
done completely in Flash, but uses a little PHP include to pull
various images from a folder and display them in the Flash movie.

Ok, this works fine on the old host, but I can't get it to work for
the life of me on my server. I've included the PHP script below. Any
feedback would be very much appreciated as I'm pulling my hair out a
bit now!


You may want to use PHP Ming extension that lets you generate Flash
movies only with PHP code.

Here you may find an example of how to build a Image slideshow in Flash
using PHP with Ming:

http://www.phpclasses.org/flashslideshow

--

Regards,
Manuel Lemos

PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/

PHP Reviews - Reviews of PHP books and other products
http://www.phpclasses.org/reviews/

Metastorage - Data object relational mapping layer generator
http://www.meta-language.net/metastorage.html
Jul 17 '05 #3
Tom Jordan wrote:
I've just migrated a clients website over to our server. The site's
done completely in Flash,
I don't know Flash, never used it.
but uses a little PHP include to pull
various images from a folder
Maybe I can help here :)
and display them in the Flash movie.

Ok, this works fine on the old host, but I can't get it to work for
the life of me on my server.
What are the versions of PHP in both servers?
What are the differences between their php.ini's?

See my comments below (## lines).

<snip>
<?php
function getFileStructure($doc, $curNode, $inDir){
//echo ("get file structure ");
if ($currentDirectory = opendir($inDir)){
while ($dirElement = readdir($currentDirectory)){
$pathToElement = $inDir . "/" . $dirElement;
if (is_file($pathToElement)){
$dotposition = strpos($dirElement, ".");
$fileName = substr($dirElement, 0, $dotposition);
$extension = substr($dirElement, 1 + $dotposition);
if ($extension == "jpg" or $extension == "JPG"){
$fileNode = addFileNode($doc, $curNode, $fileName, $extension);
}
} else if($dirElement != "." && $dirElement != ".."){
$catNode = addCategoryNode($doc, $curNode, $dirElement, $pathToElement);
}
}
closedir($currentDirectory);
}
return $curNode;
## $curNode never changes (as far as I can see) in the code above.
## You're calling functions where it is a parameter, but those function
## do not declare that specific parameter (or any other) as
## pass by reference, so they get a copy of $curNode and any changes
## they make to it are lost when the function return.
}

function addFileNode($doc, $parentNode, $fileName, $extension){
## maybe
## function addFileNode($doc, &$parentNode, $fileName, $extension){
## with the ---------------- '&' here to pass by reference

<snip> }

function addCategoryNode($doc, $parentNode, $catName, $pathToElement){ <snip> }
$rootDirectory = './images/';
$doc = domxml_new_doc('1.0');
$comment = $doc->create_comment('This XML document describes the files
to be used for a web site');
$doc->append_child($comment);
$root = $doc->append_child($doc->create_element('NAVIGATION'));
getFileStructure($doc, $root, $rootDirectory);
## You're disregarding the return value of getFileStructure()
## This line does absolutely nothing.
//echo htmlentities($doc->dump_mem(true));
$xmlstring = $doc->dump_mem(true);
echo $xmlstring;

?>


--
Mail to my "From:" address is readable by all at http://www.dodgeit.com/
== ** ## !! ------------------------------------------------ !! ## ** ==
TEXT-ONLY mail to the whole "Reply-To:" address ("My Name" <my@address>)
may bypass my spam filter. If it does, I may reply from another address!
Jul 17 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: Keith Rowe | last post by:
Hello, I am trying to reference a Shockwave Flash Object on a vb code behind page in an ASP.NET project and I receive the following error: Guid should contain 32 digits with 4 dashes...
8
by: Ben Bartsch | last post by:
Looking for opinions on the use of Flash with ASP.NET. Has anyone here seen or conducted any implementations of Flash that are actually useful or otherwise complement ASP.NET?
4
by: vivek | last post by:
I am new to flash and want someone to guide me, Is it possible to create a UI entirely in Flash and that will inetract with C# components (backend) and these components will in return interact...
1
by: dscriv | last post by:
Hello, I have Netscape 8.0.4 (in Firefox mode) and Flash 8.0.24.0. I also have IE and Firefox installed. If I go to this page, which contains a Flash detection movie:...
115
by: post2google | last post by:
I was thinking about where to go for lunch the other day, so I went to hardees.com to see what the menu looked like these days. What comes up is a big note that my flash version is not new enough...
10
by: Steve Cook | last post by:
Hi, I have an upload application written in PHP and Flash. The PHP page gets the file information via $_POST. Moreover, the user never actually visits the PHP page, rather Flash sends the...
8
by: Neo Geshel | last post by:
Greetings. BACKGROUND: My sites are pure XHTML 1.1 with CSS 2.1 for markup. My pages are delivered as application/xhtml+xml for all non-MS web clients, and as text/xml for all MS web...
1
by: critchey1 | last post by:
Hey everyone, i've been playing around with trying to get some scripts to work with detecting whether flash player is installed on your computer or not. I found a flash detection kit on the adobe...
2
dream party
by: dream party | last post by:
Inserting a Flash (SWF, FLV) file into HTML web page is already an old and familiar thing to all of us. It is a rather non-flexible thing that just to edit some options in the template. However, I...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.