anythingslider and cakephp
Let's say that i wish to dynamically generate a开发者_如何学Python anythingSlider jquery script from a cakephp view. Even if CakePHP seems to have some useful functions isn JS helper good to use in this task, I can't figure it how to do it. Do I have to rewrite the jquery script or what cakephp method to use?
$(function() {
$('#slider1').anythingSlider({
buildArrows : false,
});
});
"the thing is that i need to send the params dynamically"
Many ways to do this:
<script type="text/javascript" charset="utf-8">
$(function() {
$('<?php echo $variable; ?>').anythingSlider({
buildArrows : false
});
});
</script>
Or:
$this->Html->scriptBlock('$(function() { $("' . $variable . '").anythingSlider({ buildArrows : false }); });', array('inline' => false));
Or:
<script type="text/javascript" charset="utf-8">
var foo = '<?php echo $variable; ?>';
</script>
$(function() {
$(foo).anythingSlider({
buildArrows : false
});
});
精彩评论