[Solar-talk] Template Parser / Compiler
Rodrigo Moraes
rodrigo.moraes at gmail.com
Tue May 1 02:06:56 PDT 2007
On 7/28/06, Paul M Jones wrote:
> On Jul 19, 2006, at 9:54 AM, Rodrigo Moraes wrote:
> > The simple question is: will Solar_View have a parser / compiler
> > plugin one day?
>
> I don't see why not. My bet is that it would make more use of
> streams than Savant3 does.
>
> However, I also think this might be a good candidate for a helper
> class to take user markup and translate it to output. Then only the
> user-provided portion of the view has to be run through the helper,
> rather than run an entire template series through a separate compiler.
This was asked a long time ago... before Solar_Markdown and a lot of
other things.
One solution I came up with yesterday was to combine a view helper
with a Solar_Markdown plugin. Basically a view helper calls
Solar_Markdown to parse a template which may contain special tags
like:
<plugin name="calendar" />
A special Solar_Markdown_Plugin then parses all <plugin> tags and
returns back the result of a view helper defined in the "name"
attribute. In the example above, it will replace the tag by the result
of the view helper *_Helper_Calendar.
Other attributes can be passed to the view helper, so:
<plugin name="blogRoll" amount="5" />
...will return the result of the helper *_Helper_BlogRoll passing
array('amount' => 5) as parameter.
It's a very simple solution, and now I'm thinking if I really need
Solar_Markdown for this, because I could just parse the special tag
inside a view helper with the same technique used by Solar_Markdown
plugins. Thoughts?
cheers,
rodrigo
More information about the solar-talk
mailing list