Board Logo

PHP code within Tigra Scroller
fohanlon - 3/23/2005 at 12:18 AM

Hi,

I have searched your forum and downloaded the .zip file that contains the scroll.html and scroll.tpl1.php files.

However, I wish to query a directory of images.

Ideally I would like something along the following code to appear between the <?php ?> tags:

<?php
require("../config.php");
$handle = opendir("/var/www/html/images/weddings_images/");
$pics = array();
$count = 0;

while(($file = readdir($handle)) != false)
{
if(strtolower(substr($file, -4)) == ".jpg" || strtolower(substr($file, -4)) == ".gif" || strtolower(substr($file, -4)) == ".png")
{
$pics[$count] = $file;
$count++;
}
}
closedir($handle);
sort($pics);

echo "<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr bgcolor="#000000">";

$i = 0;
while($i < $count) {

echo "<td valign="middle" align="center"><img hspace="0" src="../../images/weddings_images/$pics[$i]; "></td>";

$i++;
}

echo "</tr></table>";

However, I am having difficulty understanding your line of php etc.

<?php echo "'<b><center>Tigra Scroller Advantages</center></b>'"?>

in so far as:

Does all php have to be echo between ' '

Any variants I try and I get the undefined main line 2 error.

Any examples of implementing mysql queries in your scroller would be greatly appreciated.

Thanks for your help

Fergal.


rock - 3/23/2005 at 03:29 PM

What forum topic do you mean?


fohanlon - 3/23/2005 at 03:50 PM

Hi Rock,

Its at http://www.softcomplex.com/forum/viewthread_537/

and it was written by yourself with following reply:

scroll.html changes are:
document.write("<script language='javascript' src='scroll.tpl" + n_id + ".php'></script><link rel='stylesheet' href='scroll" + n_id + ".css'>")

instead of

document.write("<script language='javascript' src='scroll.tpl" + n_id + ".js'></script><link rel='stylesheet' href='scroll" + n_id + ".css'>")

You could find modified scroll.html (v1.5) and tpl.php sample in the attachment.

Attachment: ts_files.zip (3kb)

Fergal.


rock - 3/23/2005 at 04:36 PM

Quote:
Originally posted by fohanlon
However, I am having difficulty understanding your line of php etc.

<?php echo "'<b><center>Tigra Scroller Advantages</center></b>'"?>

in so far as:

Does all php have to be echo between ' '

Direct content should be valid JS string to be accepted, so you need to enclose the html with qouta or double quota signs and even escape the output if needed.


Softcomplex: http://www.softcomplex.com/
Back to forum: http://www.softcomplex.com/forum/