Re: [Mav-user] PHP

2004-05-25 Thread Doug Kirk
The easiest way is to simply create some new Velocity templates that 
provide you an easily parseable (from PHP) representation of the data 
you need. Then just wrap the client request with a request to the 
Maverick + Velocity processed pages using alternate Velocity templates 
for the "view" layer. Since Velocity is just a nifty templating engine, 
there's nothing that says that you have to output HTML, or XML, or 
markup for that matter.

The really cool thing is that you can retain the existing user URLs if 
you want, and simply specify a different view with a request parameter 
(which a user with a browser would never do) to get to the alternate 
Velocity template. Then, you're simply adding to the existing system 
instead of replacing it. Maverick would just have to be configured to 
dispatch to the alternate views.

For example a Velocity template like this:
-Start of Velocity Template
$!firstName^$!lastName^$!email^$!phone
-End of Velocity Template
 (where the "$" indicates a Velocity variable,
  the "!" indicates not to output anything if the value is null,
  and the values are simply separated with "^" in a single line.
  Velocity docs are at )
...can be processed like this:

   $url = "http://localhost/my/java/url?param=value&view=data";;  // 
...set the Maverick+Velocity URL to read, with params

$f = fopen ("$url", "r");
$data = fread($f, 65536); // Get the result of Java+Velocity output
fclose($f);
// Now process the results in $data...
$results = explode("^", $data); // assuming variable-length 
data separated by "^"
$firstName = $results[0];
$lastName = $results[1];
$email = $results[2];
$phone = $results[3];

// etc...
?>
--doug
On May 25, 2004, at 1:21 PM, Lee McColl wrote:
Hi all,
 
I've recently teamed up with an applications developer to offer my web 
development skills and am currently picking apart his software.  He 
currently has a nifty Java based server app which displays information 
through Maverick and Velocity.  I believe there are lines in his 
Maverick Web.xml that read -
 

  velocityViewer
  net.nt.frontend.servlets.VelocityViewer
  10
 
 
It is these lines that I am assuming allow his Java server app to send 
properties and results to his Velocity pages.
 
Anyway, what I want to do, if it is at all possible, is to change his 
system so that it sends the information to and through PHP pages.  I'm 
happy to continue using Maverick if I can, but seeing as the system I 
built that bolts onto his software uses PHP, I would like to exchange 
all the .vm pages to also use the same PHP classes.  Make sense?  (I 
babble).
 
How can I do this?  And if it's not possible with Maverick, what system 
can I use?
 
I originally thought Ambivalence was made for this, but having read the 
manual for it, it now seems more like a PHP templating system to 
seperate PHP code from the presentation, much like Maverick seperates 
Java from presentation But I've already built the PHP templating 
system using other means.
 
Please please help,
 
Lee


---
This SF.Net email is sponsored by: Oracle 10g
Get certified on the hottest thing ever to hit the market... Oracle 10g.
Take an Oracle 10g class now, and we'll give you the exam FREE.
http://ads.osdn.com/?ad_id149&alloc_id66&op=click
[INVALID FOOTER]


RE: [Mav-user] PHP

2004-05-25 Thread Schnitzer, Jeff









His controllers build java objects which
become the model to be hand off to the view layer.  How would you hand java
objects to php pages?  Any MVC webapp framework will have this problem.  You
could serialize out the java objects to the filesystem as XML and read that
into the PHP pages, but that is a colossal hack.

 

You could use Ambivalence to rebuild the
business logic in PHP, or you can rewrite your PHP templates as JSP (or
Velocity), but either way you probably need to change something.  These
technologies are more or less immiscible at the level of granularity you are
looking for.

 

3jeff

 

 



-Original Message-
From:
[EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On
Behalf Of Lee McColl
Sent: Tuesday, May 25, 2004 11:21
AM
To: [EMAIL PROTECTED]
Subject: [Mav-user] PHP

 



Hi all,





 





I've recently teamed up with an applications developer to
offer my web development skills and am currently picking apart his
software.  He currently has a nifty Java based server app which displays
information through Maverick and Velocity.  I believe there are lines
in his Maverick Web.xml that read -





 






  velocityViewer
  net.nt.frontend.servlets.VelocityViewer
  10
 





 





It is these lines that I am assuming allow his Java server
app to send properties and results to his Velocity pages.





 





Anyway, what I want to do, if it is at all possible, is to
change his system so that it sends the information to and through PHP
pages.  I'm happy to continue using Maverick if I can, but seeing as the
system I built that bolts onto his software uses PHP, I would like to
exchange all the .vm pages to also use the same PHP classes.  Make
sense?  (I babble).





 





How can I do this?  And if it's not possible with
Maverick, what system can I use?





 





I originally thought Ambivalence was made for this, but
having read the manual for it, it now seems more like a PHP templating system
to seperate PHP code from the presentation, much like Maverick seperates Java
from presentation But I've already built the PHP templating system using
other means.





 





Please please help,





 





Lee












[Mav-user] PHP

2004-05-25 Thread Lee McColl



Hi all,
 
I've recently teamed up with an applications 
developer to offer my web development skills and am currently picking apart his 
software.  He currently has a nifty Java based server app which displays 
information through Maverick and Velocity.  I believe there are lines 
in his Maverick Web.xml that read -
 
  velocityViewer  net.nt.frontend.servlets.VelocityViewer  10 
 
It is these lines that I am assuming allow his Java 
server app to send properties and results to his Velocity pages.
 
Anyway, what I want to do, if it is at all 
possible, is to change his system so that it sends the information to and 
through PHP pages.  I'm happy to continue using Maverick if I can, but 
seeing as the system I built that bolts onto his software uses PHP, I 
would like to exchange all the .vm pages to also use the same PHP classes.  
Make sense?  (I babble).
 
How can I do this?  And if it's not possible 
with Maverick, what system can I use?
 
I originally thought Ambivalence was made for this, 
but having read the manual for it, it now seems more like a PHP templating 
system to seperate PHP code from the presentation, much like Maverick seperates 
Java from presentation But I've already built the PHP templating system 
using other means.
 
Please please help,
 
Lee