【发布时间】:2011-07-21 17:54:21
【问题描述】:
我在 PHP + JS + HTML + CSS 中遵循 MVC 模型 另外,我使用 CodeIgniter 作为框架。
我想知道,我需要做什么才能重定向到另一个控制器。我在我的项目的主页中.. 当我单击产品的“详细信息”(div = prod_details)时,应该是什么参考。
寻求帮助,这是我的代码
我的家控制器
class ordiDepot extends Controller {
function ordiDepot(){
parent::Controller();
}
function index(){
$data['base'] = $this->config->item('base_url');
$data['css'] = $this->config->item('chemin').'views/style.css';
$data['image'] = $this->config->item('chemin').'views/images';
$data['js'] = $this->config->item('chemin').'views/boxOver.js';
$data['abs'] = 'ordiDepot/accueil';
$this->load->view('ordiDepotH',$data);
$this->load->view('ordiDepotB',$data);
$this->load->view('ordiDepotF',$data);
}
function accueil($page){
$data['details_page'] = $this->config->item($page);
$data['css'] = $this->config->item('chemin').'views/style.css';
$this->load->view('details.php',$data);
}
}
我的观点
<div class="left_content">
<div class="title_box">Pieces</div>
<ul class="left_menu">
<li class="odd"><a href="services.html">Processeurs</a></li>
<li class="even"><a href="services.html">Carte Mere</a></li>
<li class="odd"><a href="services.html">Carte Video</a></li>
<li class="even"><a href="services.html">Carte Reseau</a></li>
<li class="odd"><a href="services.html">Bloc d'alimentation</a></li>
<li class="even"><a href="services.html">Disque dur</a></li>
<li class="odd"><a href="services.html">Boitiers</a></li>
</ul>
<div class="title_box">Produit en special</div>
<div class="border_box">
<div class="product_title"><a href="details.html">Motorola 156 MX-VL</a></div>
<div class="product_img"><a href="details.html"><img src= <?php echo $image?>/laptop.png alt="" title="" border="0" /></a></div>
<div class="prod_price"><span class="reduce">350$</span> <span class="price">270$</span></div>
</div>
感谢大家
<div class="banner_adds">
<a href="#"><img src="images/bann2.jpg" alt="" title="" border="0" /></a>
</div>
新产品
<div class="prod_box">
<div class="top_prod_box"></div>
<div class="center_prod_box">
<div class="product_title"><a href="details.html">Motorola 156 MX-VL</a></div>
<div class="product_img"><a href="details.html"><img src=<?php echo $image?>/laptop.gif alt="" title="" border="0" /></a></div>
<div class="prod_price"><span class="reduce">350$</span> <span class="price">270$</span></div>
</div>
<div class="bottom_prod_box"></div>
<div class="prod_details_tab">
<a href="#" title="header=[Add to cart] body=[ ] fade=[on]"><img src="<?php echo $image;?>/cart.gif" alt="" title="" border="0" class="left_bt" /></a>
<a href="details.php" class="prod_details">details</a>
</div>
</div>
<div class="prod_box">
<div class="top_prod_box"></div>
<div class="center_prod_box">
<div class="product_title"><a href="details.html">Ipod</a></div>
<div class="product_img"><a href="details.html"><img src= <?php echo $image?>/p4.gif alt="" title="" border="0" /></a></div>
<div class="prod_price"><span class="price">270$</span></div>
</div>
<div class="bottom_prod_box"></div>
<div class="prod_details_tab">
<a href="#" title="header=[Ajouter panier] body=[ ] fade=[on]"><img src="<?php echo $image;?>/cart.gif" alt="" title="" border="0" class="left_bt" /></a>
<a href="details.html" class="prod_details">details</a>
</div>
</div>
<div class="prod_box">
<div class="top_prod_box"></div>
<div class="center_prod_box">
<div class="product_title"><a href="details.html">Webcam Samsung</a></div>
<div class="product_img"><a href="details.html"><img src=<?php echo $image?>/p5.gif alt="" title="" border="0" /></a></div>
<div class="prod_price"><span class="reduce">350$</span> <span class="price">270$</span></div>
</div>
<div class="bottom_prod_box"></div>
<div class="prod_details_tab">
<a href="#" title="header=[Ajouter panier] body=[ ] fade=[on]"><img src="<?php echo $image;?>/cart.gif" alt="" title="" border="0" class="left_bt" /></a>
<a href="details.html" class="prod_details">details</a>
</div>
</div>
<div class="prod_box">
<div class="top_prod_box"></div>
<div class="center_prod_box">
<div class="product_title"><a href="<?php echo $abs;?>/details">Motorola 156 MX-VL</a></div>
<div class="product_img"><a href="details.html"><img src=<?php echo $image?>/laptop.gif alt="" title="" border="0" /></a></div>
<div class="prod_price"><span class="reduce">350$</span> <span class="price">270$</span></div>
</div>
<div class="bottom_prod_box"></div>
<div class="prod_details_tab">
<a href="#" title="header=[Ajouter panier] body=[ ] fade=[on]"><img src="<?php echo $image;?>/cart.gif" alt="" title="" border="0" class="left_bt" /></a>
<a href="details.html" class="prod_details">details</a>
</div>
</div>
<div class="prod_box">
<div class="top_prod_box"></div>
<div class="center_prod_box">
<div class="product_title"><a href="details.html">Iphone</a></div>
<div class="product_img"><a href="details.html"><img src=<?php echo $image?>/p4.gif alt="" title="" border="0" /></a></div>
<div class="prod_price"><span class="price">270$</span></div>
</div>
<div class="bottom_prod_box"></div>
<div class="prod_details_tab">
<a href="#" title="header=[Ajouter panier] body=[ ] fade=[on]"><img src=<?php echo $image;?>/cart.gif alt="" title="" border="0" class="left_bt" /></a>
<a href="details.html" class="prod_details">details</a>
</div>
</div>
<div class="prod_box">
<div class="top_prod_box"></div>
<div class="center_prod_box">
<div class="product_title"><a href="details.html">Webcam Samsung</a></div>
<div class="product_img"><a href="details.html"><img src=<?php echo $image?>/p5.gif alt="" title="" border="0" /></a></div>
<div class="prod_price"><span class="reduce">350$</span> <span class="price">270$</span></div>
</div>
<div class="bottom_prod_box"></div>
<div class="prod_details_tab">
<a href="#" title="header=[Ajouter panier] body=[ ] fade=[on]"><img src= <?php echo $image;?>/cart.gif alt="" title="" border="0" class="left_bt" /></a>
<a href="details.html" class="prod_details">details</a>
</div>
</div>
配饰
<div class="prod_box">
<div class="top_prod_box"></div>
<div class="center_prod_box">
<div class="product_title"><a href="details.html">Motorola 156 MX-VL</a></div>
<div class="product_img"><a href="details.html"><img src= <?php echo $image?>/laptop.gif alt="" title="" border="0" /></a></div>
<div class="prod_price"><span class="reduce">350$</span> <span class="price">270$</span></div>
</div>
<div class="bottom_prod_box"></div>
<div class="prod_details_tab">
<a href="#" title="header=[Ajouter panier] body=[ ] fade=[on]"><img src="<?php echo $image;?>/cart.gif" alt="" title="" border="0" class="left_bt" /></a>
<a href="details.html" class="prod_details">details</a>
</div>
</div>
<div class="prod_box">
<div class="top_prod_box"></div>
<div class="center_prod_box">
<div class="product_title"><a href="details.html">Iphone</a></div>
<div class="product_img"><a href="details.html"><img src=<?php echo $image?>/p4.gif alt="" title="" border="0" /></a></div>
<div class="prod_price"><span class="price">270$</span></div>
</div>
<div class="bottom_prod_box"></div>
<div class="prod_details_tab">
<a href="#" title="header=[Ajouter panier] body=[ ] fade=[on]"><img src="<?php echo $image;?>/cart.gif" alt="" title="" border="0" class="left_bt" /></a>
<a href="details.html" class="prod_details">details</a>
</div>
</div>
<div class="prod_box">
<div class="top_prod_box"></div>
<div class="center_prod_box">
<div class="product_title"><a href="details.html">Webcam Samsung</a></div>
<div class="product_img"><a href="details.html"><img src= <?php echo $image?>/p5.gif alt="" title="" border="0" /></a></div>
<div class="prod_price"><span class="reduce">350$</span> <span class="price">270$</span></div>
</div>
<div class="bottom_prod_box"></div>
<div class="prod_details_tab">
<a href="#" title="header=[Ajouter panier body=[ ] fade=[on]"><img src= <?php echo $image;?>/cart.gif alt="" title="" border="0" class="left_bt" /></a>
<a href="details.html" class="prod_details">details</a>
</div>
</div>
购物车
<div class="cart_details">
3 items <br />
<span class="border_cart"></span>
Total: <span class="price">350$</span>
</div>
<div class="cart_icon"><a href="#" title="header=[Au panier] body=[ ] fade=[on]"><img src= <?php echo $image;?>/shoppingcart.png alt="" title="" width="48" height="48" border="0" /></a></div>
</div>
<div class="title_box">Nouveaux</div>
<div class="border_box">
<div class="product_title"><a href="details.html">Motorola 156 MX-VL</a></div>
<div class="product_img"><a href="details.html"><img src= <?php echo $image?>/p2.gif alt="" title="" border="0" /></a></div>
<div class="prod_price"><span class="reduce">350$</span> <span class="price">270$</span></div>
</div>
<div class="title_box">Logiciels</div>
<ul class="left_menu">
<li class="odd"><a href="services.html">Jeux</a></li>
<li class="even"><a href="services.html">Utilitaires</a></li>
<li class="odd"><a href="services.html">OS</a></li>
</ul>
<div class="banner_adds">
<a href="#"><img src=<?php echo $image?>/bann1.jpg alt="" title="" border="0" /></a>
</div>
【问题讨论】:
-
这是 MVC 被滥用的一个很好的例子
标签: php javascript codeigniter http-redirect