我是CakePhp和JQuery的新手.我在使用JQuery中的cakephp代码时遇到错误.
我的代码
<script type="text/javascript">
$(document).ready(function(){
var attributeid;var fieldname;
$("#"+<?=$r['Attribute']['id'];?>).change(function () {
fieldname=<?=$r['Attribute']['label'];?>;
alert(fieldname);//this show me that undefined
attributeid=<?=$r['Attribute']['id'];?>;
alert(attributeid);//But this works
});//attribute change
});//ready function
Run Code Online (Sandbox Code Playgroud)
如果我回应($r['Attribute']['label'];)
这个价值就在我的内心<?php ?>
.但不是在我的JQuery中.
注意 :
attributeid=<?=$r['Attribute']['id'];?>;
alert(attributeid);//But this works
Error:
Name is not defined
fieldname=name;
alert(fieldname);
Run Code Online (Sandbox Code Playgroud) 在我的CakePHP代码中,我有以下代码.如果我单击图像删除它将移动到href中的链接.在href我不知道如何显示我的PHP值.我尝试过如下,但它不起作用.
<a href="http://localhost/cake_1.2.1.8004/index.php/forms/delete/"<?php echo $r['Form']['id'];?> >
<img border="0" alt="Delete" src="/cake_1.2.1.8004/app/webroot/img/delete.png"/>
</a>
Run Code Online (Sandbox Code Playgroud)
有什么建议?
我正在为cakephp 1.2尝试几个身份验证样本,但没有找到任何完美无瑕的代码.你能给我一些代码吗?谢谢
阅读核心并查看几乎所有可用的助手/插件等,我注意到有很多评论.
CakePHP的结构使得确定事物的位置和所做的事情非常简单.是否真的有必要对所有这些代码进行评论?它会使源更混乱还是真的有用?当您查看评论时,您觉得它们有用吗?或者你甚至读过它们?
更新:以下是从CakePHP Core连接管理器获取的注释示例,例如:
/**
* Loads the DataSource class for the given connection name
*
* @param mixed $connName A string name of the connection, as defined in app/config/database.php,
* or an array containing the filename (without extension) and class name of the object,
* to be found in app/models/datasources/ or cake/libs/model/datasources/.
* @return boolean True on success, null on failure or false if the class is already loaded
* @access public
* @static
*/
Run Code Online (Sandbox Code Playgroud) cakephp ×4
php ×4
cakephp-1.2 ×2
cakephp-1.3 ×1
datetime ×1
formatting ×1
javascript ×1
jquery ×1
mysql ×1