Flourish PHP Unframework
This is an archived copy of the forum for reference purposes

Quotes and Prepare

posted by irob 8 years ago

Hello everybody... I'm newer flourish user -i likes a lot- and this is my first post... I got only 1 week using FL and averything is ok .... well just for only one thing.... the quotes, I really don't understand how does it works and I don't know how solve it.... why the " turns " ?? why if I use it inside the <> works and in other case don't ?? .... watch the next code please and give me a tip or something...

Thank you!

file.php

	$js_jquery = '<script type="text/javascript">
		$().ready(function() {
			""
		}
	</script>';
	$tmpl->set('js_jquery', $js_jquery);

views/index.php

	<?php echo $this->prepare('js_jquery') ?>

result (" changed by &amp;quot;):

#!text/html
	<script type="text/javascript">
		$().ready(function() {
			&amp;quot;&amp;quot;
		}
	</script>

So the fHTML::prepare(), and consequently the fTemplating::prepare() method, will take semi-valid HTML and fix unencoding ampersands, less than symbols, greater than symbols and quotes that are not part of a valid HTML tag or HTML entity. In the case of the example you provided, it did the "right" thing because those quotes are not part of an HTML tag or entity and thus should be written as HTML entities.

That said, why are you trying to prepare your javascript? It seems like you should just be able to echo it, especially since I presume it is coming from a safe source.

posted by wbond 8 years ago

ooooh! I got it... thanku wbond

I didn't think in that option, I'm always thinking that the -templates- were ultra-protected, I'm so newer in flourish but I likes a lot....

Thank you again!

posted by irob 8 years ago