Short Description ¶
Will add a Javascript based RegularExpression Syntaxhighlighter to Yii.
Authors ¶
- The colorization output is from: Steven Levithan
- The dynamic hovering of brackets and so on is from: Jeff Roberson
- The extension and functionWrapping is from me
Requirements ¶
No requirements - the javascript is bundled..
Yii-1.1 and firefox is tested.. so it might happen, that some parts don't work with ie..
Usage ¶
Configuration ¶
This extension mostly doesn't need configuration - but if you want:
$cssFile; // will overwrite the colorcss-file from syntaxhighlighter - look at the original cssfile what you can change
$className = 'regex'; // css-classname which should be highlighted
public $dynamic = true; // if the dynamichighlighter should be included or only coloroutput
public $functionName; // if you don't want autoloading that script and toggle it by a function
Implementation ¶
Most important is that your regex lies within a container of class="regex" - then you just have to add the extension and it will work But this example will show you the functionName configuration
<input type="button" onclick="javascrip:regexHighlight()" value="Highlight or remove Highlight of that regex" />
<div class="regex" style="width:700px;">
http:\/\/(((([a-zäöüß\d](([a-zäöüß\d]|-)*[a-zäöüß\d])?\.)*([a-zäöüß](([a-zäöüß\d]|-)*[a-zäöüß\d])?))|((\d{1,3})(\.\d{1,3}){3}))(:(\d{1,5}))?)(\/(((([a-z\d$\-_.+!*'(),]|(%[a-f\d]{2}))|[;:@&=])*)(\/((([a-z\d$\-_.+!*'(),]|(%[a-f\d]{2}))|[;:@&=])*))*)?)?(\?((([a-z\d$\-_.+!*'(),]|(%[a-f\d]{2})|(\/))|[;:@&=])*))?(#[a-z\d]?)?
</div>
<?php $this->widget('application.extensions.EReSyntaxHighlighter.EReSyntaxHighlighter', array('functionName'=>'regexHighlight'));?>
Resources ¶
- example
- Colorization Steven Levithan
- Dynamic hovering: Jeff Roberson
If you have any questions, please ask in the forum instead.
Signup or Login in order to comment.