<a href="../Public/singleproduct?id=<?php echo $row["Product"]["id"];?>">
<div class="single-products">
<div class="productinfo text-center myimg">
<?php echo $this->Html->image("product/".$row["Product"]["photo"]); ?>
<h2>Rs.<?php echo $row["Product"]["price"];?></h2>
<p><?php echo $row["Product"]["name"];?></p>
<a href="javascript:document.ff<?php echo ($i++);?>.submit()" class="btn btn-default add-to-cart"><i class="fa fa-shopping-cart"></i>Add to cart</a>
<?php echo $this->Session->flash('flash', array('element' => 'flash_notification')); ?>
</div>
</div>
</a>
在使用分页时,我需要以 cakephp 方式转换此链接,因为在分页的其他页面上,此 html<a href=""></a>
将不起作用。
这是我那个 .ctp 文件的所有代码
<?php
$i=0;
foreach($product as $row)
{
?>
<form name="ff<?php echo $i;?>" method="post">
<input type="hidden" name="product_tbls_id" value="<?php echo $row["Product"]["id"];?>">
<input type="hidden" name="qty" value="1">
<div class="col-sm-4">
<div class="product-image-wrapper">
<a href="../Public/singleproduct?id=<?php echo $row["Product"]["id"];?>">
<div class="single-products">
<div class="productinfo text-center myimg">
<?php echo $this->Html->image("product/".$row["Product"]["photo"]); ?>
<h2>Rs.<?php echo $row["Product"]["price"];?></h2>
<p><?php echo $row["Product"]["name"];?></p>
<a href="javascript:document.ff<?php echo ($i++);?>.submit()" class="btn btn-default add-to-cart"><i class="fa fa-shopping-cart"></i>Add to cart</a>
<?php echo $this->Session->flash('flash', array('element' => 'flash_notification')); ?>
</div>
</div>
</a>
</div>
</div>
</form>
<?php
}
?>