2011-12-23 56 views
0

我嘗試使用收藏夾,我是按照代碼在這個link所有步驟,但問題鏈接和圖片幫助錯誤

<a href="images/image-1.jpg" rel="lightbox"> 
<img src="images/thumb-1.jpg" width="100" height="40" alt="" /> 
</a> 

我把圖片文件夾中的根目錄

C:\wamp\www\tet\app\webroot\img\images 

代替上面的代碼我使用

$thumb = $this->Html->image('images/thumb-1.jpg'); 
$full = $this->Html->image('/images/image-1.jpg', array('rel' => 'lightbox')); 
echo $this->Html->link($thumb,$full, array('escape' => false)); 

但我仍然看到這個錯誤

Missing Method in ImagesController 

Error: The action <img src=" is not defined in controller ImagesController 

Error: Create ImagesController::<img src="() in file: app\controllers\images_controller.php. 

<?php 
class ImagesController extends AppController { 

    var $name = 'Images'; 


    function <img src="() { 

    } 

} 
?> 

任何幫助,請

回答

0

因爲你做錯了。它應該像

$this->Html->image('images/thumb-1.jpg', array('url' => 'images/image-1.jpg')); 
+0

沒有你的代碼是不是真的,,因爲我但圖像文件夾,這樣C:\ WAMP \ WWW \ TET \程序\ webroot的\ IMG \在這種情況下,圖像 – user1080247 2011-12-23 12:58:46

+0

刪除前導斜槓。我已經更新了代碼。 – Ehtesham 2011-12-23 13:12:01

+0

不,它是不工作..當我點擊圖像鏈接產生像這樣的http://localhost/tet/images/images/image-1.jpg...並仍然看到這個錯誤ImagesController中缺少方法 錯誤:動作圖像未在控制器中定義ImagesController 錯誤:在文件:app \ controllers \ images_controller.php中創建ImagesController :: images()。 <?php class ImagesController extends AppController { \t var $ name ='Images'; \t功能的圖像(){ \t} } ?> – user1080247 2011-12-23 13:39:08