feulf / raintpl

Easy Php Template Engine
https://feulf.github.io/raintpl
188 stars 47 forks source link

unexpected url replace #13

Closed alex-arhat closed 13 years ago

alex-arhat commented 13 years ago
Hi!
php file:
oTpl = new RainTPL;
$oTpl->configure('base_url', 'http://home.example.com/');
$oTpl->configure('path_replace', true);
$oTpl->assign('aSite','http://google.com');
============================================
tpl file:
_a href="{aSite}">You search machine
============================================
or
tpl file:
_a href="{aSite}#">You search machine
============================================

But in html:
_a href="http://home.example.com/http://google.com">You search machine

Var replace after compile template.
Why? Please fix it.
sorry for the change in  a-tag '_'   from github parser
feulf commented 13 years ago

Thanks for pointing out this issue. Actually isn't a very issue but more a choice we made, and the reason is simple, the # symbol used in a link point to an anchor in the html page, e.g. Go at bottom page will be compiled to Go at bottom page

The only way to don't parse the links is to use {noparse} {noparse}Go at bottom page{/noparse}

or either you can configure the path_replace of the link off: http://www.raintpl.com/Documentation/Documentation-for-PHP-developers/Methods/Configure/#path_replace_list

Do you have any suggestions to solve this issue in a better way? The reason why we chosed to use the # character, is because it doesn't affect how you see the image, so if you're using it the template is still WYSIWYG e.g.: <img src="http://www.google.com/intl/en_com/images/srpr/logo1w.png#" />

you can see the image in your template and Rain with the # won't change the path of this image in compilation.

Any comments and solutions are welcome, RainTM

alex-arhat commented 13 years ago

my recipe: in html: _a href="http://{$aSite}#" class="logo"> in code: $oTpl->assign('aSite','google.com');

nice hack ;-)

feulf commented 13 years ago

Nice Hack!

On Mon, Jul 18, 2011 at 12:40 PM, lazyal < reply@reply.github.com>wrote:

my recipe: in html: _a href="http://{$aSite}#" class="logo"> in code: $oTpl->assign('aSite','google.com');

nice hack ;-)

Reply to this email directly or view it on GitHub: https://github.com/rainphp/raintpl/issues/13#issuecomment-1598150