2013-06-22 57 views
0

Iam使用html標籤在cakephp中創建圖片鏈接,我在添加src路徑時遇到了問題。在cakephp中添加image src路徑

我試圖

<a href="#today1" id="lnk3"> 
<img src="/iserprofiles/app/webroot/img/todaysallocation.png">Todays Allocation</a> 

,但沒有加載圖像。如果有人知道,請回復。我知道,我們也可以使用CakePHP創建圖像鏈接,但我遇到一個問題

IU的sed這個代碼

<?php echo $this->Html->link($this->Html->image('todaysallocation.png', 
    array('width' => '200', 'height' => '45')) , 
        '#today',array('escape' => false));?> 

我不希望使用任何控制器或行動網址,只需我只是說「#今天', 但我的問題是我需要爲此添加一個ID。我們怎麼能做到這一點?

+3

我建議使用當地environent合適的虛擬主機設置(HTTP ://www.dereuromark.de/2011/05/29/working-with-domains-locally/)。然後你的'Html->圖像'('todaysallocation.png')'會產生一個正確的src路徑'/ img/todaysallocation.png',然後一旦你部署到活動服務器,它也能正常工作。 – mark

回答

1

入住您的瀏覽器補丁:localhost/iserprofiles/app/webroot/img/todaysallocation.png ,但我認爲這個問題是在你的.htaccess文件,因爲路徑圖像看起來就像localhost/iserprofiles/img/todaysallocation.png

+0

當我嘗試訪問本地主機/ iserprofiles /應用程序/ webroot/img/todaysallocation.png它顯示對象未找到 – SibinF

+0

我認爲,檢查第二條路徑 – kicaj

+0

它顯示相同的錯誤 – SibinF