用于CakePHP的googleajax库API处理程序

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了用于CakePHP的googleajax库API处理程序相关的知识,希望对你有一定的参考价值。

[Google's "AJAX Libraries API"](http://code.google.com/apis/ajaxlibs/) is great and all, but can slow things down if you're doing a lot of refreshing/cache clearing while debugging. Here's a neat trick: stuff something like this in the `` of your Cakephp Layout to use local versions of these libraries while you're debugging:
  1. /**
  2.  * Google Ajax Libraries API handler for CakePHP
  3.  *
  4.  * Neat trick to load local versions of javascript libraries while
  5.  * debugging, but Google-hosted versions for production.
  6.  * Automatically detects whether debugging is turned on, and
  7.  * defaults to jQuery, the best JavaScript library.
  8.  *
  9.  * Just shove it in your <head> and forget about it :)
  10.  * I usually store it somewhere like: /elements/google-jsapi.ctp
  11.  */
  12.  
  13. if (!isset($library)) $library = 'jquery';
  14. if (!isset($useLocal)) $useLocal = (Configure::read('debug') != 0);
  15.  
  16. if (!$useLocal) e($javascript->link('http://www.google.com/jsapi'));
  17. else $library .= '-local';
  18.  
  19. switch ($library) {
  20.  
  21. case 'jquery':
  22. e($javascript->link('google-jsapi-jquery'));
  23. break;
  24. case 'jquery-local':
  25. e($javascript->link('jquery'));
  26. e($javascript->link('jquery-ui'));
  27. break;
  28.  
  29. case 'prototype':
  30. e($javascript->link('google-jsapi-prototype'));
  31. break;
  32. case 'prototype-local':
  33. e($javascript->link('prototype'));
  34. e($javascript->link('scriptaculous'));
  35. break;
  36.  
  37. }

以上是关于用于CakePHP的googleajax库API处理程序的主要内容,如果未能解决你的问题,请参考以下文章

在Wordpress中从googleajax库API加载jQuery

php [cakephp:API组件和控制器]用于ajax请求和Server-Sent事件的Cake模块。 #cakephp

在AWS S3上存储CakePHP库以用于多个应用程序

带有 PHP 框架的 ORM。切换到 CakePHP 或找到一些更好的 CI 库 [关闭]

用googleajax加载HTML5开始布局

api cakephp 休息认证