embeded php
[1/18] from: al::bri::xtra::co::nz at: 6-Feb-2001 11:46
Rene wrote:
> In a sample Chapter "Rebol for Dummies" I read, that it is possible to
embed php to Rebol. Is it real??? A test went wrong...
> #!/path/to/rebol -cs
> REBOL [
<<quoted lines omitted: 4>>
> </html>
> }
Try:
write %MyPhpFile.php reduce [
<html>
<body>
"The time is: " now "."
join "<?" [
{print("Hello world")} {?>}
]
</body>
</html>
]
Andrew Martin
ICQ: 26227169 http://members.nbci.com/AndrewMartin/
[2/18] from: rene:villa-cossio at: 5-Feb-2001 23:36
On Mon, Feb 05, 2001 at 10:57:46PM +0100, Rene Schrader-Boelsche wrote:
I get only the <h1>Hello</h1>
#!/path/to/rebol -cs
REBOL [
]
print {
<html>
<h1>Hello</h1>
<? print("Hello world")?>
</html>
}
BTW: php is installed on my machine ;)
bye and :!wq
Rene
--
Rene Schrader-Boelsche +49 (0)171 5482906
Dellbruecker Steinweg 10 www.villa-cossio.com
D-51069 Cologne
[3/18] from: ralph:abooks at: 5-Feb-2001 18:12
>In a sample Chapter "Rebol for Dummies" I read, that it is possible to
>embed php to Rebol. Is it real??? A test went wrong...
<<quoted lines omitted: 6>>
></html>
>}
Hi Rene... yes, it's certainly possible to embed PHP in REBOL (and vice
versa), and I do both quite often, being a firm believer in hybrid
programming. ... The example in the book is general. One application for
embedding PHP code in HTML and in turn embedding all of that in REBOL would
involve a page generated by REBOL and saved to the web space. Assuming the
PHP parser then recognizes it (i.e. a correct extension), then all the PHP
code executes. In essense, instead of just a dynamic PHP page, you get a
dynamic-dynamic page<g>.
I suppose I need to post some more specific examples.
--Ralph
Ralph Roberts, author
REBOL FOR DUMMIES
[4/18] from: ralph:abooks at: 5-Feb-2001 18:57
Rene, here's an example of a dynamic-dymamic program... run this script in
REBOL, then just run the generated page:
write %/c/apache/htdocs/test.php {
<html>
<body>}
repeat count 10 [
write/append %/c/apache/htdocs/test.php join count <br>
]
write/append %/c/apache/htdocs/test.php {/n<?PHP print("Hello PHP and REBOL
worlds!<br>"); ?>
</body></html>}
Actually, I just thought of an example where you can use PHP to generate and
run a REBOL script which in turns dymamically generates a page with PHP
code.
Later for that... you guys play with the concept some<g>, I gotta get back
to writing.
Best,
--Ralph Roberts
[5/18] from: gjones05:mail:orion at: 5-Feb-2001 18:24
Hi, Ralph,
I know some writers are hesitant to say anything about their current work in
progress, so please feel free to say nothing. But I'm curious what you are
currently working on. Any hints?
Thanks either way.
--Scott
Ralph Roberts wrote:
...
[6/18] from: ralph:abooks at: 5-Feb-2001 19:52
>Hi, Ralph,
>I know some writers are hesitant to say anything about their
<<quoted lines omitted: 3>>
>Thanks either way.
>--Scott
Thanks for asking, Scott... Doesn't bother me<g>. Right now, my major
project is the second edition of GENEALOGY VIA THE INTERNET. Also just
finished up LEO WHITE: MOUNTAIN ROCKET MAN (about the V-2 program at White
Sands in the 40s and 50s). And putting the finishing touches on a novel, THE
HUNDRED-ACRE SPACESHIP. ... Considering doing a book about REBOL and
e-commerce, but sorta waiting to see the direction REBOL's going in right
now. I remain excited about the language and still use it daily.... Hence,
I'm always lurking about on this list<g>.
--Ralph
[7/18] from: gjones05:mail:orion at: 6-Feb-2001 4:51
> Thanks for asking, Scott... Doesn't bother me<g>. Right now, my major
> project is the second edition of GENEALOGY VIA THE INTERNET. Also just
> finished up LEO WHITE: MOUNTAIN ROCKET MAN (about the V-2 program at White
> Sands in the 40s and 50s). And putting the finishing touches on a novel,
THE
> HUNDRED-ACRE SPACESHIP. ... Considering doing a book about REBOL and
> e-commerce, but sorta waiting to see the direction REBOL's going in right
> now. I remain excited about the language and still use it daily.... Hence,
> I'm always lurking about on this list<g>.
>
> --Ralph
Thanks, Ralph. The books sound interesting. I'll keep an eye out. --Scott
[8/18] from: g:santilli:tiscalinet:it at: 6-Feb-2001 12:54
Rene Schrader-Boelsche wrote:
> I get only the <h1>Hello</h1>
I think you should:
print "Content-Type: application/x-httpd-php3^M^J^M^J"
at the beginning. (Use application/x-httpd-php for PHP4.)
HTH,
Gabriele.
--
Gabriele Santilli <[giesse--writeme--com]> - Amigan - REBOL programmer
Amiga Group Italia sez. L'Aquila -- http://www.amyresource.it/AGI/
[9/18] from: ralph:abooks at: 6-Feb-2001 9:54
>Rene Schrader-Boelsche wrote:
>> I get only the <h1>Hello</h1>
<<quoted lines omitted: 3>>
>HTH,
> Gabriele.
Thanks Gabriele... I couldn't think of that last night and I KNEW I was
thinking of an easier way to embed when I wrote the Dummies book<g>.
--Ralph
[10/18] from: kracik:mbox:dkm:cz at: 6-Feb-2001 17:56
Hi,
I thought that web servers do not interpret CGI-generated output once
again with another interpreter. Does this code actually work in Apache?
That would kind of solve MySQL database inaccessibility from REBOL!
--
Michal Kracik
Ralph Roberts wrote:
[11/18] from: rene:villa-cossio at: 5-Feb-2001 22:57
Hi there,
In a sample Chapter "Rebol for Dummies" I read, that it is possible to
embed php to Rebol. Is it real??? A test went wrong...
#!/path/to/rebol -cs
REBOL [
]
print {
<html>
<? print("Hello world")?>
</html>
}
cu
Rene
--
Rene Schrader-Boelsche +49 (0)171 5482906
Dellbruecker Steinweg 10 www.villa-cossio.com
D-51069 Cologne
[12/18] from: al:bri:xtra at: 7-Feb-2001 17:05
Michal Kracik wrote:
> I thought that web servers do not interpret CGI-generated output once
again with another interpreter. Does this code actually work in Apache?
I believe you're correct.
> That would kind of solve MySQL database inaccessibility from REBOL!
How about pre-generating PHP pages with Rebol? Write the PHP/HTML page in my
eText dialect or HTML dialect or plain Rebol script, and embed PHP tags in
the generated HTML page. Then run the the pre-generated pages through your
webserver. That way, the dynamic content can be added through the PHP code
to access your database.
Andrew Martin
ICQ: 26227169 http://members.nbci.com/AndrewMartin/
[13/18] from: g:santilli:tiscalinet:it at: 7-Feb-2001 13:15
Ralph Roberts wrote:
> >I think you should:
> >
<<quoted lines omitted: 6>>
> Thanks Gabriele... I couldn't think of that last night and I KNEW I was
> thinking of an easier way to embed when I wrote the Dummies book<g>.
Actually I didn't test that, so I'm not completely sure it will
work... Please let me know if it does.
Regards,
Gabriele.
--
Gabriele Santilli <[giesse--writeme--com]> - Amigan - REBOL programmer
Amiga Group Italia sez. L'Aquila -- http://www.amyresource.it/AGI/
[14/18] from: g:santilli:tiscalinet:it at: 7-Feb-2001 13:20
Michal Kracik wrote:
> I thought that web servers do not interpret CGI-generated output once
> again with another interpreter. Does this code actually work in Apache?
> That would kind of solve MySQL database inaccessibility from REBOL!
I'm not very sure, but I think Apache can be made to do that. (You
can do it from a module, that is, I'm quite sure I was able to do
something like that from REBOL/Apache.)
Regards,
Gabriele.
--
Gabriele Santilli <[giesse--writeme--com]> - Amigan - REBOL programmer
Amiga Group Italia sez. L'Aquila -- http://www.amyresource.it/AGI/
[15/18] from: kracik:mbox:dkm:cz at: 7-Feb-2001 18:28
Andrew Martin wrote:
> How about pre-generating PHP pages with Rebol? Write the PHP/HTML page in my
> eText dialect or HTML dialect or plain Rebol script, and embed PHP tags in
> the generated HTML page. Then run the the pre-generated pages through your
> webserver. That way, the dynamic content can be added through the PHP code
> to access your database.
>
Yes, the method of generating PHP code and then running it is suggested
in the REBOL for Dummies book. But I want the resulting page (generated
from SQL SELECT statement) to be unique for each user that accesses my
web site at the same time. I cannot just write a dynamic page to a file,
redirect to it and hope that some other user of the web site is not
doing the same thing just now.
I agree that pre-generating "static" PHP scripts from REBOL could be
easier than writing them completely in PHP, I've done that for
ASP/VBScript before.
--
Michal Kracik
[16/18] from: gjones05:mail:orion at: 7-Feb-2001 13:48
Michal Kracik wrote:
> I thought that web servers do not interpret CGI-generated output once
> again with another interpreter. Does this code actually work in Apache?
> That would kind of solve MySQL database inaccessibility from REBOL!
and later wrote:
> Yes, the method of generating PHP code and then running it is suggested
> in the REBOL for Dummies book. But I want the resulting page (generated
<<quoted lines omitted: 5>>
> easier than writing them completely in PHP, I've done that for
> ASP/VBScript before.
Hi, Michal,
Set-up a PHP page that dynamically manages the database access. If the
result of the MySQL query is short, it could be passed as a GET query string
to a URL for a REBOL script. The pass could be done by one of the several
methods of redirection under PHP. If the query result is long, then the
result is written to a temporary page whose file name is unique. Then this
page's file name is passed/redirected to the REBOL script. The REBOL script
processes the results in the temporary file and then deletes temporary
file. Since occasionally searches are aborted, orphaned temporary files may
accumulate, so then you run a clean-up script once a day or week to clean
these out. I have accomplished this approach in other languages, so it
should work. But, I haven't actually set this up as a specific experiment
using REBOL.
Hope this helps.
Regards,
--Scott
[17/18] from: kracik:mbox:dkm:cz at: 9-Feb-2001 12:54
Thanks, the approach with unique temporary files should work.
I can even generate REBOL script from PHP and MySQL and redirect to it,
and then dynamically create another PHP page. I wouldn't want to
explain such a solution to a web server administrator though :-)
Regards,
Michal Kracik
GS Jones wrote:
[18/18] from: ralph:abooks at: 9-Feb-2001 10:41
\Yeah! Hybrid programming<g>... it cures shortcomings in all languages.
--Ralph
Notes
- Quoted lines have been omitted from some messages.
View the message alone to see the lines that have been omitted