开发者

CakePHP submit button Image

I am trying to use image for a submit button

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

thats the code i am using. but the image is not able to load The image 开发者_运维百科is present in the following directory

Webroot/img/prelaunch/

**Updated**

HTML Generated

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

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

URL http://bakasura.in/ginger/users/signup

Image URL http://bakasura.in/ginger/img/prelaunch/btn_signup.jpg


The image is a jpg, you have put a gif in the submit button source code. Simple mistake :D


Another solution is:

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

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


Just create a class name in css and add the image

Form->submit('submit',array('class'=>'show-image')); ?>

CSS

.show-image{ background-image:url(../img/prelaunch/btn_signup.gif); background-repeat:no-repeat; display:block; width:30px; height:30pxtext-transform:capitalize; }


I created a custom button using an image in my under app/webroot/img that uses inline style for specifying size and changing the position to center

$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();
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜