Показать сообщение отдельно
Старый 02.05.2003, 12:03     # 1
Marchello
Guest
 
Сообщения: n/a

Lightbulb While в фото галереи

http://www.annabolshova.ru/load/demo/logos.php?cat=isho
http://www.annabolshova.ru/load/demo/kit.com.rar (исходинки, 117кб)

Ну вот, написал на аглийском, кому надо, могу превести. So there are two php pages, that to be edited. The gallery script is quite simple and should remain so in future to. The two html (the one containing the two rows and the empty one) tables in index.htm have to be remade in dynamic php code. I wrote preview.php, it is working perfect when showing images in one or several lines, but now I have to show them in one of the two rows of the table and this is the trouble part, because the while function shows the same item in the left and the right side (I know there must be a simple solution, but I have not figured it out yet). What I did is logos.php?cat=iSho (for jpgs) and logos.php?cat=view (for flash), not working the way it should (6 items per page, two per that two row table). If there is an odd number of items to be shown (at the end, for example if there are 37 pictures), the pair item should be blank.

When this is done, I need a store, so, when I press the "Order" link, I get it all done. I'll give you several well written php codes, that you'll have to edit and simplify for my needs. And there is a banner managment code, you have to get him alive. You'll get one high-class, exlusive web template and a logo in .psd.

imglib.sql
PHP код:
DROP TABLE IF EXISTS `imglib`;
CREATE TABLE `imglib` (
  `
idint(10unsigned NOT NULL auto_increment,
  `
catvarchar(21) default 'iSho',
  `
pidint(20) default '2',
  `
urlvarchar(20) default NULL,
  `
pricetinytext NOT NULL,
  `
authorvarchar(255) default '',
  `
timestamptimestamp(14NOT NULL,
  
PRIMARY KEY  (`id`)
TYPE=MyISAM;

INSERT INTO `imglibVALUES (1'iSho'NULL's001-wq.gif''149''s001'20030406221728);
INSERT INTO `imglibVALUES (2'iSho'NULL's002-wq.gif''39''s002'20030406221742);
INSERT INTO `imglibVALUES (6'iSho'NULL's033-wq.gif'''''20030406222120);
INSERT INTO `imglibVALUES (7'iSho'NULL's032-wq.gif'''''20030406221956);
INSERT INTO `imglibVALUES (3'iSho'NULL's003-wq.gif''200''s003'20030406221752);
INSERT INTO `imglibVALUES (4'iSho'NULL's029-wq.gif'''''20030406221842);
INSERT INTO `imglibVALUES (5'iSho'NULL's030-wq.gif''FREE'''20030406221921);
INSERT INTO `imglibVALUES (8'view'2'02.swf''10'''20030502014432);
INSERT INTO `imglibVALUES (9'view'2'15.swf''10'''20030502001830);
INSERT INTO `imglibVALUES (10'view'2'16.swf''10'''20030502001830);
INSERT INTO `imglibVALUES (11'view'2'17.swf''10'''20030502001830);
INSERT INTO `imglibVALUES (12'view'2'22.swf''10'''20030502001830);
INSERT INTO `imglibVALUES (13'view'2'31.swf''10'''20030502001830);
INSERT INTO `imglibVALUES (14'view'2'35.swf''10'''20030502001830);  
INSERT INTO `imglibVALUES (15'view'2'40.swf''10'''20030502001830);
INSERT INTO `imglibVALUES (16'view'2'43.swf''10'''20030502001830);
INSERT INTO `imglibVALUES (17'view'2'64.swf''10'''20030502001830);
INSERT INTO `imglibVALUES (18'view'2'68.swf''10'''20030502001830);
INSERT INTO `imglibVALUES (19'view'2'78.swf''10'''20030502001830);
INSERT INTO `imglibVALUES (20'view'2'96.swf''10'''20030502001830); 
portfolio.php:
PHP код:
$items = isset($_SESSION['items']) ? $_SESSION['items'] : 6;
$cat = isset($_GET['cat']) ? $_GET['cat'] : 1;

$image_path = $small_image_path;

mysql_connect($db_host, $db_user, $db_password);
mysql_select_db($db_name);

$sql = "SELECT * FROM imglib WHERE cat='$cat'";
$result = mysql_query($sql);
$totalPhoto= mysql_num_rows( $result );

    if( !isset( $_GET['page'] ) ) { $page = 1; } else {$page = $_GET['page'];}
    if( $totalPhoto <= $items ) $totalPages = 1;
    elseif( $totalPhoto % $items == 0 ) $totalPages = $totalPhoto / $items;
    else $totalPages = ceil( $totalPhoto / $items );
    if( $page > $totalPages ) $page = 1;
    if( $totalPhoto == 0 ) $PhotoStart = 0;
    else $PhotoStart = $items * $page - $items + 1;
    if( $page == $totalPages ) $PhotoEnd = $totalPhoto;
    else $PhotoEnd = $items * $page;
    $initialPhoto = $items * $page - $items;
 

$sql = "SELECT * FROM imglib WHERE cat='$cat' LIMIT $initialPhoto, $items";
$result = mysql_query($sql);
<table border="0" cellpadding="0" cellspacing="0" width="20" height="5">
    <tr>
        <td width="20" height="5">
        </td>
    </tr>
</table>

<?php
$i
=0;
if (
$items == 6) { $cols 2;} else { $cols 2; }
while (
$row mysql_fetch_array($result))
{
    
$i++ 
?>
        <table align="center" cellpadding="0" cellspacing="4" width="540">
            <tr>
                <td width="270" class="Boxright">

            <table cellpadding="0" cellspacing="1" width="200" bgcolor="white" align="center">
                <tr valign="top">
                 <td width="90" height="90"><table align="center" cellpadding="0" cellspacing="0" width="90" height="90">
    <tr>
        <td class="preview">

<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="32" height="32">
    <param name="movie" value="<?php echo $row['url']; ?>">
    <param name="quality" value="high">
    <embed src="<?php $image_path "flash/web/"; echo $image_path $row['url']; ?>" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="150" height="90"></embed></object>

<!-- <a href="zoom.php?cat=<? echo $cat ?>&id=<? echo $row['id'?>"><img alt="<? echo $row['date' ?>&nbsp; -&nbsp;<? echo $row['author' ?> " border="0" src="<? echo $image_path $row['url'?>" /> </a></td>
        <td width="3" height="3" valign="top" class="topcatheader">
            <p><img src="images/wh_square.gif" width="3" height="3" border="0"></p>

-->
    
        </td>
    </tr>
    <tr>
        <td width="3" height="3" valign="top" colspan="2" class="topcatheader">
            <p><img src="images/wh_square.gif" width="3" height="3" border="0"></p>
        </td>
    </tr>
</table>
                    </td>
                    <td>
<table align="center" cellpadding="0" cellspacing="0" width="72" height="10">
    <tr>
        <td width="72">                        
       <p align="center"><span class="ItemDesc2"><b>PRICE &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</b></span><br><span class="ItemPrice"><? echo $row['price'?></span></td>
    </tr>
</table>
<A 
                        href="http://exclusive/e005.htm"><br></A></p>
                        <div align="right">
<table cellpadding="0" cellspacing="0" width="95%" height="10">
    <tr>
        <td width="9" valign="bottom">                        
         <p><img src="images/zoom.gif" width="13" height="13" border="0">&nbsp;</td>
        <td width="55" valign="top">                        
        <p><span class="ItemDesc"><b>Zoom</b></span></td>
    </tr>
</table><br>
<table cellpadding="0" cellspacing="0" width="95%" height="10">
    <tr>
        <td width="9" valign="bottom">                        
         <p><img src="images/order.gif" width="13" height="13" border="0">&nbsp;</td>
        <td width="55" valign="top">                        
        <p><span class="ItemDesc"><b>Order</b></span></td>
    </tr>
</table>
</div>
</td>
                </tr>
                <tr>
                    <td width="254" height="35" colspan="2" class="ItemDesc">
            <b>Exclusive</b>&nbsp;template e001<br><b>Pack</b>: PSD (Photoshop 6), Fonts</td>
                </tr>
            </table>
                </td>
                <td width="270">

            <table cellpadding="0" cellspacing="1" width="200" bgcolor="white" align="center">
                <tr valign="top">
                 <td width="90" height="90"><table align="center" cellpadding="0" cellspacing="0" width="90" height="90">
    <tr>

<!-- for images logos.php?cat=iSho -->
        <td class="preview"><a href="zoom.php?cat=<? $image_path "logos/"; echo $cat ?>&id=<? echo $row['id'?>"><img alt="<? echo $row['date' ?>&nbsp; -&nbsp;<? echo $row['author' ?> " border="0" src="<? echo $image_path $row['url'?>" /> </a></td>
        <td width="3" height="3" valign="top" class="topcatheader">
            <p><img src="images/wh_square.gif" width="3" height="3" border="0"></p>
        </td>


    </tr>
    <tr>
        <td width="3" height="3" valign="top" colspan="2" class="topcatheader">
            <p><img src="images/wh_square.gif" width="3" height="3" border="0"></p>
        </td>
    </tr>
</table>
                    </td>
                    <td>
<table align="center" cellpadding="0" cellspacing="0" width="72" height="10">
    <tr>
        <td width="72">                        
       <p align="center"><span class="ItemDesc2"><b>PRICE &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</b></span><br><span class="ItemPrice">$230</span></td>
    </tr>
</table>
<A 
                        href="http://exclusive/e005.htm"><br></A></p>
                        <div align="right">
<table cellpadding="0" cellspacing="0" width="95%" height="10">
    <tr>
        <td width="9" valign="bottom">                        
         <p><img src="images/zoom.gif" width="13" height="13" border="0">&nbsp;</td>
        <td width="55" valign="top">                        
        <p><span class="ItemDesc"><b>Zoom</b></span></td>
    </tr>
</table><br>
<table cellpadding="0" cellspacing="0" width="95%" height="10">
    <tr>
        <td width="9" valign="bottom">                        
         <p><img src="images/order.gif" width="13" height="13" border="0">&nbsp;</td>
        <td width="55" valign="top">                        
        <p><span class="ItemDesc"><b>Order</b></span></td>
    </tr>
</table>
</div>
</td>
                </tr>
                <tr>
                    <td width="254" height="35" colspan="2" class="ItemDesc">
            <b>Exclusive</b>&nbsp;template e004<br><b>Pack</b>: PSD (Photoshop 6), Fonts</td>
                </tr>
            </table>
                </td>
            </tr>
        </table>
        <table align="center" cellpadding="0" cellspacing="4" width="540">
            <tr>
                <td width="540" class="BoxBellow">
                    <p>
                        &nbsp;
                    </p>
                </td>
            </tr>
        </table>
<?
if (($i $cols) == ) echo "<br>";
}
echo 
"<br>";
?>
                 <?php include_once("elem/main_prv_foot.php"); ?></td> </tr></table>
?>