簡體   English   中英

CakePHP提交按鈕圖片

[英]CakePHP submit button Image

我正在嘗試使用圖像作為提交按鈕

<?php echo $this->Form->submit('/img/prelaunch/btn_signup.gif'); ?>

這就是我正在使用的代碼。 但圖像無法加載圖像存在於以下目錄中

Webroot公司/ IMG /發射前/

**更新**

HTML生成

<div class="submit">
<input type="image" src="/ginger/img/prelaunch/btn_signup.gif">
</div>

Webiste Base URL http://bakasura.in/ginger/

網址 http://bakasura.in/ginger/users/signup

圖片網址 http://bakasura.in/ginger/img/prelaunch/btn_signup.jpg

圖像是jpg,你在提交按鈕源代碼中放了一個gif。 簡單的錯誤:D

另一種解決方案是

<?php echo $form->submit('Sign up', array('type'=>'image','src' => '/img/prelaunch/btn_signup.gif'));  ?>

來自: http//php-freelancer.in/2010/04/28/cakephp-how-to-make-image-submit-button/

只需在css中創建一個類名並添加圖像

形狀配合>提交( '提交',陣列( '類'=> '顯示圖像')); ?>

CSS

.show-image {background-image:url(../ img / prelaunch / btn_signup.gif); 背景重復:不重復; 顯示:塊; 寬度:30像素; 高度:30pxtext變換:利用; }

我使用我的under app / webroot / img中的圖像創建了一個自定義按鈕,它使用內聯樣式指定大小並將位置更改為居中

$options=array('type'=>'Make secure payment', 'type'=>'image', 'style'=>'width:200px; height:80px; display:block; margin-left:auto; margin-right:auto;');
echo $this->Form->submit('/img/axiaepaysecurebuttongray_med.png', $options);
echo $this->Form->end();

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM