[Catalyst] PHP::View and Template::Toolkit

mnichols at mojosoft.org mnichols at mojosoft.org
Wed Jun 21 03:34:47 CEST 2006


Yuval Kogman <nothingmuch at woobling.org> writes:

> On Tue, Jun 20, 2006 at 07:26:59 -0400, mnichols at mojosoft.org wrote:
>> 
>> I have a Template toolkit working and and a PHP view working.  I would
>> like to be able to use the template toolkit then pass to PHP or vise
>> versa.  It was suggested that this could be done on irc, I have made
>> some attempts at this with no luck.  I simply tried to forward on to
>> the two views but of course as soon as I forward to one thats it. I
>> tried to use the render and/or process instead of a forward but
>> without any luck.
>
> What are you trying to achieve? I don't know what your problem is,
> or what solution you are trying to solve it with, so it's very hard
> to answer.

I am trying to have the following template parse the perl variable
correctly and interpret the PHP as well.

<html><body><p> [% c.stash.message %] </p><p> <? php phpinfo() ?> </p></body></html>.

Ultimately a friend has some graphing/flash libs I'd like to make use of.  


I think I would like to process the TToolkit first if I had my choice,
and unless the php code some how interacts with the Perl I don't see
an reason why one would do the PHP first.  If TTookit goes first some
data can be written for the php or even some of the php itself.

>
> Several possible solutions you are trying:
>
> 	process with one view, then reprocess with another view treating
> 	the result of the previous view as a template

Yes this sounds like a good solution, although I suppose I want to
avoid writing it to disk, but I can do this too.  I was hoping I could
get my TToolkit view to  "run" the php interepter on after it "plugs"
in the perl variables....  but yes perhaps this is a bit vague.
Ultimately I have a freiend who does PHP.  I would like to leverage
some of the PHP stuff in my catalyst application, but do not want to
always use PHP or have to every PHP page by hand and try to match them
up.  Anyway I don't know if that is clear.  Or possible.  I think I
can get it to process one then write to disk, then process the next.

> ...
>
> Please try to describe this more accurately.
>
>> $c->stash->{template}="template.with.php.tt"
>> $c->forward("TToolkit::View");
>> $c->forward("PHP::View");
>
> It looks like you have the package names wrong. What is the full
> name of e.g. PHP::View? YourApp::View::PHP::View? or
> YourApp::View::PHP?

sorry this is for a php friend so I don't have the code handy, but
I'll try to get tommorrow.  Admittly I was being lazy and trying to
remember the code.  I could have gotten the much closer if I had
simply looked at an example.  I apologise.

Thanks,  I appreciate the effort in dealing with my vagueness. 

Mojo




More information about the Catalyst mailing list