Created
January 27, 2011 10:12
-
-
Save kanonji/798322 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Extended HtmlHelper | |
* @author kanonji | |
*/ | |
class ExHtmlHelper extends HtmlHelper { | |
/** | |
* $.webroot() for jQuery | |
* | |
* To get webroot path when using jQuery. | |
* This is a little closer to Helper::webroot(). | |
* | |
* $.getScript($.webroot('js/jquery.example-plugin.js'), function(){//callback}); | |
* | |
* @param array $options | |
*/ | |
public function setWebroot($options = array()){ | |
$url = $this->url('/'); | |
return $this->scriptBlock(" | |
$.extend({ | |
webroot: function(path) { | |
if(! path) | |
path = ''; | |
return '{$url}'+path; | |
} | |
});" | |
, $options); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
コメントどうもです。
おもいっきりミスってますね。作ったのに結局indexページでしか使わなかったので気がついてませんでした・・・