세션을 이용한 오늘본상품 입니다 근데...
본문
오늘본상품을 세션을 이용해서 나오도록끔 해보았는데
세션을 읽어와서 작은이미지를 뿌려주고 이미지에 링크 거는것까지는
어찌어찌 되었는데 막히는 부분이 있어서 고수님들께 질문을 좀 드려 보려합니다
아직롤링버튼은 안만들었지만
오늘본상품 이미지가 5개까지만 나오도록 하고
6개부터는 롤링형식으로 넘어가도록 하려합니다
어떻게 해야 하나요
// 세션 가져오는 부분
<?
function is_product_history($recent_product_history, $uid)
{
if( !isset($recent_product_history) ) return false;
$exist = 0;
foreach($recent_product_history as $v)
{
if( $v[0] == $uid )
{
$exist++;
}
}
return $exist > 0 ? true : false;
}
if( !is_product_history($_SESSION['recent_product_history'],$_GET['uid']) && !empty($_GET['uid']) && $_GET['m'] == 'shop')
{
$_SESSION['recent_product_history'][] = array($_GET['uid'],$R['name'],getPic($R,$m,4) ,$_GET['cat']);
}
?>
// 세션 보여주는 부분
<div id="today" style="width:100px; height:270px;" align="center">
<b>오늘본상품</b>
<? for($i=0;$i<count($_SESSION['recent_product_history']); $i++) { ?>
<ul id="recent_id">
<li><a href="./?r=home&m=shop&cat=<?=$_SESSION['recent_product_history'][$i][3]?>&uid=<?=$_SESSION['recent_product_history'][$i][0]?>"><img src="<?=$_SESSION['recent_product_history'][$i][2]?>" alt="<?=$_SESSION['recent_product_history'][$i][1]?>" title="<?=$_SESSION['recent_product_history'][$i][1]?>" style="height:40px;" /></a></li>
</ul>
<? } ?>
</div>
!-->
답변을 작성하시기 전에 로그인 해주세요.