Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

registerScriptFile with custom htmlOptions. #1761

metayii opened this Issue Nov 26, 2012 · 2 comments


2 participants

metayii commented Nov 26, 2012

Hi. I'm trying to create a widget encapsulating the new Dropbox Chooser API, which need to be included with a tag like this one:

<script type="text/javascript" src="https://www.dropbox.com/static/api/1/dropbox.js" id="dropboxjs" data-app-key="YOUR_APP_KEY"></script>

As you can see, there's a non standard attribute data-app-key in it. So, this Javascript library can not be inserted using registerScriptFile, since the render generates a fixed script tag. Of course I can just drop a CHtml::tag('script' blahblah) but this can not be included at the head section of the page and there's no way to control if you already included a library in case the widget is used elsewhere in the page (of course I could use a singleton or something else, but it would be cumbersome).

So, something like this would be useful:

public CClientScript registerScriptFile(string $url, integer $position=NULL, $htmlOptions=NULL)

Please take it in consideration.

Discussion here: http://www.yiiframework.com/forum/index.php/topic/37972-registerscriptfile-with-custom-htmloptions/

metayii commented Nov 28, 2012

Two classes with modifications needed for this feature have been posted in the forum's thread. They might be a start.


resurtm commented Mar 22, 2013

Duplicate of: #1724
Already fixed in: #2172

@resurtm resurtm closed this Mar 22, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment