coppermine-gallery.com/forum

Support => cpg1.4.x Support => Older/other versions => cpg1.4 miscellaneous => Topic started by: dke on January 10, 2008, 11:10:42 PM

Title: Can anyone help me wrap this code into a php table?
Post by: dke on January 10, 2008, 11:10:42 PM
Hi,

I'm no coder and i'm trying to figure out how to wrap this code:


<html>
<script language="javascript">AC_FL_RunContent = 0;</script>
<script src="AC_RunActiveContent.js" language="javascript"></script>
<div align="center">
<script language="javascript">
if (AC_FL_RunContent == 0) {
alert("This page requires AC_RunActiveContent.js. In Flash, run \"Apply Active Content Update\" in the Commands menu to copy AC_RunActiveContent.js to the HTML output folder.");
} else {
AC_FL_RunContent(
'codebase', 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0',
'width', '750',
'height', '250',
'src', 'flow',
'FlashVars', 'xmlPath=http://dkeserver.mine.nu/flow.php', <!--Absolute path to 'flow.php'-->
'quality', 'high',
'pluginspage', 'http://www.macromedia.com/go/getflashplayer',
'align', 'middle',
'play', 'true',
'loop', 'true',
'scale', 'showall',
'wmode', 'window',
'devicefont', 'false',
'id', 'flow_link',
'bgcolor', '#FFFFFF',
'name', 'flow',
'menu', 'true',
'allowFullScreen', 'false',
'allowScriptAccess','sameDomain',
'movie', 'flow',
'salign', ''
); //end AC code
}
</script>
</body>
</html>


Into this PHP table code:

starttable("100%");

echo '<tr><td class="tableh2"><b><b>Recently added files</b></td></tr>';
endtable();
?>


I cannot figure out how to mix php and html without breaking the PHP using ?>

I would like to do something like this:

starttable("100%");

echo '<tr><td class="tableh2"><b><b>Recently added files</b></td></tr>';
echo '<td class="tableb">';
<html>
<script language="javascript">AC_FL_RunContent = 0;</script>
<script src="AC_RunActiveContent.js" language="javascript"></script>
<div align="center">
<script language="javascript">
if (AC_FL_RunContent == 0) {
alert("This page requires AC_RunActiveContent.js. In Flash, run \"Apply Active Content Update\" in the Commands menu to copy AC_RunActiveContent.js to the HTML output folder.");
} else {
AC_FL_RunContent(
'codebase', 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0',
'width', '750',
'height', '250',
'src', 'flow',
'FlashVars', 'xmlPath=http://dkeserver.mine.nu/flow.php', <!--Absolute path to 'flow.php'-->
'quality', 'high',
'pluginspage', 'http://www.macromedia.com/go/getflashplayer',
'align', 'middle',
'play', 'true',
'loop', 'true',
'scale', 'showall',
'wmode', 'window',
'devicefont', 'false',
'id', 'flow_link',
'bgcolor', '#FFFFFF',
'name', 'flow',
'menu', 'true',
'allowFullScreen', 'false',
'allowScriptAccess','sameDomain',
'movie', 'flow',
'salign', ''
); //end AC code
}
</script>
</body>
</html>
endtable();
?>


Can any PHP/HTML wiz help me?

Thanks!
Title: Re: Can anyone help me wrap this code into a php table?
Post by: Joachim Müller on January 11, 2008, 07:59:47 AM
Use the heredoc (http://www.php.net/manual/en/language.types.string.php#language.types.string.syntax.heredoc) syntax:starttable("100%");

echo '<tr><td class="tableh2"><b>Recently added files</b></td></tr>';
echo <<< EOT
<td class="tableb">';
<div align="center">
<script language="javascript">
if (AC_FL_RunContent == 0) {
alert("This page requires AC_RunActiveContent.js. In Flash, run \"Apply Active Content Update\" in the Commands menu to copy AC_RunActiveContent.js to the HTML output folder.");
} else {
AC_FL_RunContent(
'codebase', 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0',
'width', '750',
'height', '250',
'src', 'flow',
'FlashVars', 'xmlPath=http://dkeserver.mine.nu/flow.php', <!--Absolute path to 'flow.php'-->
'quality', 'high',
'pluginspage', 'http://www.macromedia.com/go/getflashplayer',
'align', 'middle',
'play', 'true',
'loop', 'true',
'scale', 'showall',
'wmode', 'window',
'devicefont', 'false',
'id', 'flow_link',
'bgcolor', '#FFFFFF',
'name', 'flow',
'menu', 'true',
'allowFullScreen', 'false',
'allowScriptAccess','sameDomain',
'movie', 'flow',
'salign', ''
); //end AC code
}
</script>
EOT;
endtable();
?>
Then edit themes/yourtheme/theme.php and add<script language="javascript">AC_FL_RunContent = 0;</script>
<script src="AC_RunActiveContent.js" language="javascript"></script>
into a new line before</head>, as you mustn't add mutliple instances of the tags <html> or <body>.
You should really read up some HTML tutorials first to understand the basics.
Title: Re: Can anyone help me wrap this code into a php table?
Post by: dke on January 11, 2008, 09:12:22 AM
Thank you Joachim, you have been great help!