Yii Module & Widget that registers inline JS and CSS as an external file.
##install
-
Place EScriptStore into your modules directory.
-
Edit config/main.php
'import'=>array(
…,
'application.modules.EScriptStore.widgets.CMeInFile.*',
),
…,
'modules=>array(
'EScriptStore',
…,
),
…,
##Examples
- Register Inline JS as external script. The code bellow will register a script include to the head of your document.
<?php $this->beginWidget('EJSscript'); ?>
var x = 100;
<?php $this->endWidget(); ?>
<h1>Some Heading</h2>
<?php $this->beginWidget('EJSscript'); ?>
alert(x);
<?php $this->endWidget(); ?>
- Register Inline CSS as external script. The code bellow will register a script include to the head of your document.
<?php $this->beginWidget('ECSSscript'); ?>
.someClass: {width:100px;}
.someOther: {width:200px;}
<?php $this->endWidget(); ?>
<?php $this->beginWidget('ECSSscript'); ?>
.someClassTwo: {width:101px;}
.someOtherThree: {width:201px;}
<?php $this->endWidget(); ?>