2
我正在使用CodeIgniter PHP框架。試圖製作各種產品租賃頁面。我所做的:
使用codeigniter購物車,並使用戶可以添加一些產品。 現在的產品,其顯示:
OutputPHP作爲新的URL foreach
沒有一個鏈接或東西。 我想,每個產品都可以有獨特的鏈接,並在按下按鈕時彈出新窗口。我正在使用foreach。以某種方式可以做到這一點?
PHP代碼:
<?php
foreach($product as $row)
{
echo '
<div class="col-md-4" style="padding:16px; background-color:#f1f1f1; border:1px solid #ccc;
margin-bottom:16px; height:100%" align="center">
<img src="'.base_url().'/myassets/images/'.$row->product_image.'" class="img-thumbnail" height="2000" width="2000" />
<h4>'.$row->product_name.'</h4>
<h3 class="text-danger">'.$row->product_price.' €(dienai)</h3>
<input type="text" name="quantity" class="form-control quantity" placeholder="Dienų skaičius" id="'.$row->product_id.'" />
<b>Patalpino: </b><i>'.$row->owner.'</i></b></br/>
<button type="button" name="add_cart" class="btn btn-success add_cart" data-productname="'.$row->product_name.'"
data-price="'.$row->product_price.'" data-productid="'.$row->product_id.'" />Rezervuoti</button>
</div>
';
}
?>
難道我一些如何修改這個foreach循環創造每件產品的網址是什麼?
每個產品都有獨特的產品ID,也許鏈接可以像localhost/Shopping_cart/112
或其他等等?
MySQL的:
product_id
category_id
product_name
product_price
下一步將是一個搜索引擎是否將有可能對其進行管理。
首先你要如何輸出? 1.在彈出的窗口中2.在新窗口中。清除它。如果你想在彈出窗口中使用(使用引導模式),否則使用錨標籤與目標=「_ blank」 – chigs