Jump to content

integrate php, mysql and SmoothGallery


ebchost

Recommended Posts

is posible to integrate this 2 example and how ?

 

$podaci2 = mysql_query("SELECT * FROM rss_vesti LIMIT $granica") or die(mysql_error());						
while($row = mysql_fetch_assoc( $podaci2 ))
{
	$id		= $row['ID'];
	$naslov		= $row['TITLE'];
	$sadrzaj	= $row['DESCRIPTION'];
	$slika		= $row['IMAGE'];
       }

 

<?php

$sTemplate = <<<XML
<div class="imageElement">
    <h3>{title}</h3>
    <p>{description}</p>
    <a href="#" title="open image" class="open"></a>
    <img src="{fileurl}" class="full" />
    <img src="{fileurl}" class="thumbnail" />
</div>
XML;

$aUnits = array(
    'image 1' => array('$row', 'pic1.jpg'),
    'image 2' => array('Image 2 description', 'pic2.jpg'),
    'image 3' => array('Image 3 description', 'pic3.jpg'),
    'image 4' => array('Image 4 description', 'pic4.jpg'),
    'image 5' => array('Image 5 description', 'pic5.jpg')
);

$sGalleryObjects = '';
$sFolder = 'data_images/';
foreach ($aUnits as $sTitle => $aUnitInfo) {
    list($sDescription, $sFileName) = $aUnitInfo;
    $sFilePath = $sFolder . $sFileName;
    $sGalleryObjects .= strtr($sTemplate, array('{fileurl}' => $sFilePath, '{title}' => $sTitle, '{description}' => $sDescription));
}

echo <<<EOF
<link rel="stylesheet" href="css/main.css" type="text/css" />
<link rel="stylesheet" href="css/jd.gallery.css" type="text/css" />
<script src="js/mootools-1.2.1-core-yc.js" type="text/javascript"></script>
<script src="js/mootools-1.2-more.js" type="text/javascript"></script>
<script src="js/jd.gallery.js" type="text/javascript"></script>

<div class="example">
    <h3><a href="#">SmoothGallery examples. First - single gallery, second - multiple galleries</a></h3>
    <div>
        <div id="single_gallery">
            {$sGalleryObjects}
        </div>

        <script type="text/javascript">
            function startGallery() {
                var myGal1 = new gallery($('single_gallery'), {
                    timed: true,
                    delay: 5000,
                    embedLinks: false
                });
            }
            window.addEvent('domready',startGallery);
        </script>
    </div>
</div>
EOF;

?>

 

Link to comment
https://forums.phpfreaks.com/topic/239857-integrate-php-mysql-and-smoothgallery/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.