473,405 Members | 2,421 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,405 software developers and data experts.

Function returns nothing (instead of flash)

Hi there,

I have a site with just a few pages. (e.g. home.php)
In every page there is another page included with things
like the header etc.

The included file is in a subdirectory called "include".
There are two functions written in this included file:

================================================== =========================
function doImage($image)
{
list($width, $height, $type, $attr) = getimagesize($image);
echo "<img src=$image width=\"$width\" height=\"$height\">";
};

function doFlash($Movie,$Height,$Width)
{
echo "<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\"
codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0\"
height=\"$Height\" width=\"$Width\">
<param name=\"movie\" value=\"$Movie\">
<param name=\"quality\" value=\"high\">
<param name=\"allowscale\" value=\"true\">
<param name=\"SCALE\" value=\"exactfit\">
<param name=\"menu\" value=\"false\">
<param name=\"wmode\" value=\"transparent\">
<embed src=\"$Movie\" width=\"$Width\" height=\"$Height\"
menu=\"false\" wmode=\"transparent\" allowscale=\"true\"
scale=\"exactfit\" quality=\"high\"
pluginspage=\"http://www.macromedia.com/go/getflashplayer\"
type=\"application/x-shockwave-flash\"></embed>
</object>";
};
================================================== =========================

I call the functions from pages in the root directory, pages like
home.php...

When i call doImage("img/logo.gif"); it works well, but when i
call doFlash("swf/logo.swf","100px","100px"); It returns everything
before
the <html> tag starts, so it isn't in the right place either. When i
change
the "echo"-statement of doFlash() to "return" nothing happens and it
disappears in the source (online)

What am i doing wrong?

Hope someone can help...

Greetings knoakske
Jul 17 '05 #1
7 2181
knoak wrote:
Hi there,

I have a site with just a few pages. (e.g. home.php)
In every page there is another page included with things
like the header etc.

The included file is in a subdirectory called "include".
There are two functions written in this included file:

================================================== =========================
function doImage($image)
{
list($width, $height, $type, $attr) = getimagesize($image);
echo "<img src=$image width=\"$width\" height=\"$height\">";
};

function doFlash($Movie,$Height,$Width)
{
echo "<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\"
codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0\"
height=\"$Height\" width=\"$Width\">
<param name=\"movie\" value=\"$Movie\">
<param name=\"quality\" value=\"high\">
<param name=\"allowscale\" value=\"true\">
<param name=\"SCALE\" value=\"exactfit\">
<param name=\"menu\" value=\"false\">
<param name=\"wmode\" value=\"transparent\">
<embed src=\"$Movie\" width=\"$Width\" height=\"$Height\"
menu=\"false\" wmode=\"transparent\" allowscale=\"true\"
scale=\"exactfit\" quality=\"high\"
pluginspage=\"http://www.macromedia.com/go/getflashplayer\"
type=\"application/x-shockwave-flash\"></embed>
</object>";
};
================================================== =========================

I call the functions from pages in the root directory, pages like
home.php...

When i call doImage("img/logo.gif"); it works well, but when i
call doFlash("swf/logo.swf","100px","100px"); It returns everything
before
the <html> tag starts, so it isn't in the right place either. When i
change
the "echo"-statement of doFlash() to "return" nothing happens and it
disappears in the source (online)
It will disappear .. by removing "echo", you're telling PHP *not* to
put the code into the end webpage. "return" just makes the function
return a value, so that it's available to be used in another part of
your code.. If you wish to echo that return value, you must specify
when calling the function that you want to echo it's return value.

(Think of the return value of a function in the same way you would think
of a constant variable)
What am i doing wrong?

Hope someone can help...

Greetings knoakske

--
Ben Cottrell AKA Bench

Disclaimer:
This post may contain explicit depictions of things which are "real".
These "real" things are commonly known as 'life'! So, if it sounds
sarcastic, don't take it seriously. If it sounds hazardous, Do not try
this at home or at all. And if it offends you, just don't read it.
Jul 17 '05 #2
I'm sorry, but this doesn't solve anything for me...
As you've probably noticed, i'm a newbie..

But anyway, what i can't figure, is why the doImage(); works
perfect, and the doFlash(); refuses to work..

What should i do then to fix it?

Thanks in advance..

Greetings knoak
Jul 17 '05 #3
knoak wrote:
Hi there,

I have a site with just a few pages. (e.g. home.php)
In every page there is another page included with things
like the header etc.

The included file is in a subdirectory called "include".
There are two functions written in this included file:

================================================== ========================= function doImage($image)
{
list($width, $height, $type, $attr) = getimagesize($image);
echo "<img src=$image width=\"$width\" height=\"$height\">";
};

function doFlash($Movie,$Height,$Width)
{
echo "<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\"
codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.c
ab#version=6,0,29,0\" height=\"$Height\" width=\"$Width\">
<param name=\"movie\" value=\"$Movie\">
<param name=\"quality\" value=\"high\">
<param name=\"allowscale\" value=\"true\">
<param name=\"SCALE\" value=\"exactfit\">
<param name=\"menu\" value=\"false\">
<param name=\"wmode\" value=\"transparent\">
<embed src=\"$Movie\" width=\"$Width\" height=\"$Height\"
menu=\"false\" wmode=\"transparent\" allowscale=\"true\"
scale=\"exactfit\" quality=\"high\"
pluginspage=\"http://www.macromedia.com/go/getflashplayer\"
type=\"application/x-shockwave-flash\"></embed>
</object>";
};
================================================== =========================
I call the functions from pages in the root directory, pages like
home.php...

When i call doImage("img/logo.gif"); it works well, but when i
call doFlash("swf/logo.swf","100px","100px"); It returns everything
before
the <html> tag starts, so it isn't in the right place either. When i
change
the "echo"-statement of doFlash() to "return" nothing happens and it
disappears in the source (online)

What am i doing wrong?

Hope someone can help...

Greetings knoakske


I really am surprised it doesn't work, I copy-pasted the function in my php
editor, and called the function with a local swf and it runs as expected. So
this leads me to believe the code itself is correct. Even if the .swf is
missing the page loads, allbeit it keeps looking for the missing
movieclip... Anything else you can think of that might be involved ? The way
the includes are handled ? The way PHP handles escaped chars or something ?
My PHP is a default setup, as it comes preinstalled with apache on my suse
9.0 linux machine.
(Apache 2.048 and PHP 4.3.3)

Sorry i can't be of more help.
Pjotr
Jul 17 '05 #4
Hi there, i'm running
PHP 4.3.3 on Linux, that's all i can figure out.

I'll re-explain the structure, maybe that's where it goes wrong..
_root -> home.php*, contact.php*, etc.*

folder "inc"-> standards.php, which also has the functions in it.
*in all the first line = include_once('inc/standards.php');)

I call the function in standards.php from home.php by the following
command: <?php doFlash("swf/logo.swf","100","100"); ?>

What i don't get is that the doImage() works fine in home.php.
The only difference is that doImage() has
"list($width, $height, $type, $attr) = getimagesize($image);"
before echoing something, could the flaw be somewhere in this part then?

Thanks in advance,

Greetings knoak
Jul 17 '05 #5
anyone?
Jul 17 '05 #6
knoak wrote:
anyone?

I'm sorry knoak, I can't reproduce it. I simply have no clue.
Pjotr
Jul 17 '05 #7
Crap!

Thanks anyway, i'll try something else then..

Greetings
Jul 17 '05 #8

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

Similar topics

6
by: Alessandro Crugnola *sephiroth* | last post by:
hi, i have already problems using py2exe.. i'm using python 2.2, wxPython and audiere for a little mp3 player.. once I've build the exe with py2exe, when launching the application: Traceback...
35
by: wired | last post by:
Hi, I've just taught myself C++, so I haven't learnt much about style or the like from any single source, and I'm quite styleless as a result. But at the same time, I really want nice code and I...
7
by: Felix Kater | last post by:
Hi, when I need to execute a general clean-up procedure (inside of a function) just before the function returns -- how do I do that when there are several returns spread over the whole function?...
9
by: Christian Christmann | last post by:
Hi, I was just going through this exercise http://www.cas.mcmaster.ca/~franek/books/membook-answers/ch4/answers-ch4-3.html and I'am confused about the answer. It says: "... the compiler...
6
by: ais523 | last post by:
I'm trying to write a function that does some realloc-style modification of a pointer. The function itself works, but I'm having some problems with the prototype. This is a simple example of the...
18
by: ben.carbery | last post by:
Hi, I have just written a simple program to get me started in C that calculates the number of days since your birthdate. One thing that confuses me about the program (even though it works) is...
16
by: mdh | last post by:
May I ask the group the following: (Again, alas , from K&R) This is part of a function: while ( ( array1 = array2 ) != '\0' ); /* etc etc */ Is this the order that this is evaluated? ...
2
by: sonaliagr | last post by:
I am trying to update a msg array in function by passing the address but it is showing an error. and also, i want the value of msg array to be accessible to the full code that is inside the main...
8
by: Viktor | last post by:
Can somebody give me an explanation what happened here (or point me to some docs)? Code: HMMM = None def w(fn): print 'fn:', id(fn) HMMM = fn
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...

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.