I am trying to get jquery works in my cakephp.
source: http://www.cakephp.bee.pl/
But i cannot see the slider..What is wrong? I see no error messages.
As instructed in the site, I placed the helpers under /app/views/
helpers/
copied all the js into /app/webroot/js/
added the following into /app/views/layouts/default.ctp
<?php echo $javascript->link('jquery-1.4.2.min');?>
<?php echo $javascript->link('jquery-ui-1.7.2.custom.min');?>
added var $helpers = array('Javascript', 'Ajax'); to my controller.
below is default.ctp
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title><?php echo $title_for_layout?></title>
<link rel="shortcut icon" href="favicon.ico" type="image/x-icon">
<!-- Include external files and scripts here (See HTML helper for more
info.) -->
<?php echo $javascript->link('jquery-1.4.2.min');?>
<?php echo $javascript->link('jquery-ui-1.7.2.custom.min');?>
<?php echo $javascript->link('jquery.autocomplete.min');?>
<?php echo $javascript->link('jquery.jeditable.mini');?>
</head>
<body>
<!-- If you'd like some sort of menu to
show up on all of your views, include it here -->
<div id="header">
<div id="menu"></div>
</div>
<!-- Here's where I want my views to be displayed -->
<?php echo $content_for_layout ?>
<!-- Add a footer to each displayed page -->
<div id="footer"></div>
</body>
</html>
pasted the below in my view
<p>
<label for="amount">Donation amount ($50 increments):</label>
<input type="text" id="amount" style="border:0; color:#f6931f; font-
weight:bold; background-color: #a2abb9" />
</p>
<div id="slider2" class="slider"></div>
<?=$ajax->slider('slider2', array(
'value' => 100,
'min' => 0,
'max' => 500,
'step' => 50,
'slide' => '$("#amount").val("$" + ui.value);',
))?>
<br />
<script>
$(document).ready(function(){
$("#amount").val('$' + $("#slider2").slider("value"));
})
</script>
Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
No comments:
Post a Comment