Page 1 of 1

A better way of registering a block tags?

Posted: Mon Jun 12, 2006 6:27 pm
by mahjong
Hi. I'm running CMS Made Simple 0.13 Canary.

I wanted to register a block tag :

Code: Select all

{my_tag} ... {\my_tag}
CMS Made Simple doesn't seem to be designed to accept them natively. There is no hook like for function tags. So, I've modified the source code of lib\content.functions.php. I've added the block type in the plugins registering loop :

Code: Select all

Near line 671 : 
  $types=array('function','compiler','prefilter','postfilter','outputfilter','modifier','block');

Near line 710 :
  case 6: $smarty->register_block($file, "smarty_cms_block_" . $file); break;
Now, I can create block.my_tag.php in the plugin folder, the same way as for regular function tags, function.my_tag.php. I works, but on next update of CMS Made Simple, I'll to edit once again lib\content.functions.php.

Is there a better way of registering block tags, without hacking CMS's core? Maybe with a module?

Re: A better way of registering a block tags?

Posted: Mon Jun 12, 2006 7:26 pm
by Ted
This is a reasonable change.  I'm just going to commit it into svn and it'll be in the next release.  :)

Thanks!

Re: A better way of registering a block tags?

Posted: Mon Jun 12, 2006 9:59 pm
by mahjong
Wow! Thank you.

Re: A better way of registering a block tags?

Posted: Fri Jun 16, 2006 8:43 am
by Ryno
Hey guys,

Sounds really interesting but I have no idea what you both are talking about?

Can one of you give an example of when you'd need a block tag, as well as what a block tag is?

Sorry, I'm still learning my Smarty ABC's...

Ryno

Re: A better way of registering a block tags?

Posted: Fri Jun 16, 2006 9:31 am
by Ted
Say you want a tag that does something on a block of text.  Like, {literal}whole bunch of stuff that should be escaped{/literal}.  http://smarty.php.net/manual/en/plugins ... ctions.php

Keep in mind that this isn't user defined tags in the admin, but tags created in the /plugins directory.