On 10/24/06, Don Park <don.park at gmail.com>
wrote:>
> hello.
> im stuck writing a PHP app when I want to write a rails app. The
> people writing the view code require PHP. So the thought struck me,
> could a rails template engine be written that evaluated html/php code
> instead of the .rhtml files that rails nomally uses.
>
> i figured you''d be the person to ask seeing as how masterview
seems to
> be the leading alternative rails template engine.
>
> do you know if such a thing has been written or how difficult it would be
> to do?
Don,
I understand your dilemma, I have a similar situation at work where we have
legacy java code to integrate with. It kills me to have to continue to use
unproductive java code when a few lines of ruby would be much simpler, but
it is what it is.
Anyway, if I understand your question, then the answer is yes. To rephrase
your question I believe you are asking whether a template engine like
MasterView could generate PHP instead of rhtml. If that is the question then
the answer is yes.
When I was posed with a recent requirement, I concluded that one of the
quickest ways for me to implement the new code in java (and even be able to
regenerate for ruby) would be to use MasterView.
The WYSIWYG editable templates could be styled and laid out by a designer
(or a developer using something like NVU) and then easily generate the
marked up jsp or rhtml.
MasterView doesn''t have a hard requirement to use rails, its has many
directives to make using with rails easy, but doesn''t require it. So
that
being said it would be fairly simple with the latest version of MasterView
to generate JSP, rhtml, or even PHP. Really it could be used to generate any
html like syntax.
The newest version which we are preparing to release (just working on
release docs) has simplified greatly the creation of directives, so that it
is very simple to create custom directives that would generate jsp markup,
php markup, etc.
If all goes well, I will be using MasterView for my own legacy java project,
so I will be first hand using it to generate for another language. It
wouldn''t be hard to create what you need for PHP too.
So if you want to go down that path, I will do my best to support you.
I''ll
hopefully be doing a similar thing for Java as well.
And though I still think MasterView has some signifigant advantages over
some of the other projects, for completeness I would also mention that
Kwartz another template engine has the ability to generate for Java, Ruby,
and PHP currently. However it''s not a WYSIWYG solution and falls short
on
many other areas too, but I thought I would mention it anyway.
http://www.kuwata-lab.com/kwartz/
Anyway, thanks for taking the time to write. I think there would be some
nice merit in going down the path of generating PHP (or JSP) from MasterView
in addition to rhtml, it also allows us a way to potentially run in either
environment. For instance this legacy project I am referring to might have
to have that code run inside a Java web container along with the other code
or it might also be running standalone disconnected on laptops not
integrated with anything else (in which case it might be running on
something lightweight like rails).
I think MasterView would provide an elegant way to handle a good portion of
the work to do this. It certainly would be straight forward to generate the
view portion. I''ll know more as we get into it, but from the surface
that
would seem pretty straight forward.
Blessings,
Jeff
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
http://rubyforge.org/pipermail/masterview-devel/attachments/20061025/a8ec29fa/attachment.html