|
|
|
ช่วยดู loop for หน่อยได้ป่ะ รูปมันไม่ออก แต่ว่าชื่อรูปมาแล้วครับ |
|
|
|
|
|
|
|
Code (PHP)
<?
require("config.inc.php");
require("top.inc.php");
$sqlcommand="SELECT * FROM tb_webfreelance_webdesign ORDER BY id DESC";
$result =mysql_query($sqlcommand,$conn);
$count = mysql_num_rows($result);
while($rec=mysql_fetch_array($result)){
$company_name[]=$rec['company_name'];
$images[]=$rec['images'];
//echo "Images : ".$images;
}//while
?>
<!--jQuery library-->
<script type="text/javascript" src="css/lib/jquery-1.4.2.min.js"></script>
<!--jCarousel library-->
<script type="text/javascript" src="css/lib/jquery.jcarousel.min.js"></script>
<!--Thickbox 3 library-->
<script type="text/javascript" src="css/thickbox/thickbox.js"></script>
<!--Thickbox stylesheet-->
<link rel="stylesheet" type="text/css" href="css/thickbox/thickbox.css" />
<!-- jCarousel skin stylesheet-->
<link rel="stylesheet" type="text/css" href="css/skins/ie7/skin.css" />
<script type="text/javascript">
// Set thickbox loading image
tb_pathToImage = "images/loading-thickbox.gif";
var mycarousel_itemList = [
/* {url: "http://static.flickr.com/66/199481236_dc98b5abb3_s.jpg", title: "Flower1"},
{url: "http://static.flickr.com/75/199481072_b4a0d09597_s.jpg", title: "Flower2"},
{url: "http://static.flickr.com/57/199481087_33ae73a8de_s.jpg", title: "Flower3"},
{url: "http://static.flickr.com/77/199481108_4359e6b971_s.jpg", title: "Flower4"},
{url: "http://static.flickr.com/58/199481143_3c148d9dd3_s.jpg", title: "Flower5"},
{url: "http://static.flickr.com/72/199481203_ad4cdcf109_s.jpg", title: "Flower6"},
{url: "http://static.flickr.com/58/199481218_264ce20da0_s.jpg", title: "Flower7"},
{url: "http://static.flickr.com/69/199481255_fdfe885f87_s.jpg", title: "Flower8"},
{url: "http://static.flickr.com/60/199480111_87d4cb3e38_s.jpg", title: "Flower9"},
{url: "http://static.flickr.com/70/229228324_08223b70fa_s.jpg", title: "Flower10"}*/
<? for($i=0,$i < $count;$i++;){?>
{url: "<img src="upload/webfreelance_webdesign/<?=$images[$i]?>">", title: "<?=$company_name[$i]?>"},
<? }//for?>
];
function mycarousel_itemLoadCallback(carousel, state){
for (var i = carousel.first; i <= carousel.last; i++) {
if (carousel.has(i)) {
continue;
}
if (i > mycarousel_itemList.length) {
break;
}
// Create an object from HTML
var item = jQuery(mycarousel_getItemHTML(mycarousel_itemList[i-1])).get(0);
// Apply thickbox
tb_init(item);
carousel.add(i, item);
}
};
/*** Item html creation helper.*/
function mycarousel_getItemHTML(item)
{
var url_m = item.url.replace(/_s.jpg/g, '_m.jpg');
return '<a href="' + url_m + '" title="' + item.title + '"><img src="' + item.url + '" width="140" height="80" border="0" alt="' + item.title + '" /></a>';
};
jQuery(document).ready(function() {
jQuery('#mycarousel').jcarousel({
size: mycarousel_itemList.length,
itemLoadCallback: {onBeforeAnimation: mycarousel_itemLoadCallback}
});
});
</script>
<div id="wrap">
<ul id="mycarousel" class="jcarousel-skin-ie7">
<!-- The content will be dynamically loaded in here --> // รูปจะออกมาตรงนี้คับ
</ul>
</div>
|
|
|
|
|
Date :
2011-07-28 15:46:56 |
By :
avsqlz |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ช่วยดูตรงฟังช์ นี้หน่อยครับ
Code (PHP)
function mycarousel_getItemHTML(item){
var url_m = item.url.replace(/_s.jpg/g, '_m.jpg');
return '<a href="' + url_m + '" title="' + item.title + '"><img src="' + item.url + '" width="140" height="80" border="0" alt="' + item.title + '" /></a>';
};
คืองี้ชื่อรูปมันเป็น เล็กมันเป็น Thumbnails_1295411879_nannapas.jpg
ชื่อรูปใหญ่เป็น 1295411879_nannapas.jpg
แต่พอแก้ตรง var url_m = item.url.replace(/_s.jpg/g, '_m.jpg');
เป็น
var url_m = item.url.replace(/.jpg/g, '.jpg');
มันก็ยังไม่ได้ครับ
|
ประวัติการแก้ไข 2011-07-28 16:17:54
|
|
|
|
Date :
2011-07-28 16:07:25 |
By :
nottpoo |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ทำแบบนี้ก็มานะครับ
<img src="img_product/<?php echo $row['D_pic'];?>" alt="a" border="0" />
|
|
|
|
|
Date :
2011-07-29 14:34:21 |
By :
charoen4113 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 00
|