LC Script in PHP File

Nakia Brewer Nakia.Brewer at westrac.com.au
Sun Nov 23 06:22:50 EST 2014


Okay, this seems to make sense.

Thanks for your help, I'll give it a go tomorrow..

I'm slowly getting there with PHP, it's just taking a little longer than it took me to pick up LC...



Nakia Brewer | Technology & Solutions Manager | Equipment Management Solutions
t: (02) 49645051<tel:(02)%2049645051>
m: 0458 713 547<tel:0458%20713%20547>
i: www.westrac.com.au<http://www.westrac.com.au/>
ACN 009 342 572<tel:009%20342%20572>

On 23 Nov 2014, at 6:10 pm, Peter W A Wood <peterwawood at gmail.com<mailto:peterwawood at gmail.com>> wrote:

You should be able to use file_get_contents in PHP to do what you want. Though it will take longer to get the results from LiveCode than it would from PHP.

Here is an example:

PHP file:
<!DOCTYPE html>
<html>
   <head>
       <meta http-equiv="content-type" content="text/html;charset=utf-8" />
       <title>Testing Getting Results From Website</title>
   </head>
   <body>
       <p>
         <?php
           $livecode_returned = file_get_contents('http://localhost/webtest.lc');
           echo($livecode_returned);
         ?>
       </p>
   </body>
</html>

LiveCode file:
<?lc
   if $_GET["name"] <> "" then
     put "Peter" into tName
  else
     put "World" into tName
  end if
   put header "Content-Type: text/html"
   put "<html>"
   put "<head>"
   put "<title>My LiveCode Server Test Page</title>"
   put "</head>"
   put "<body>"
   put "<h1>My LiveCode Server Test Page</h1>"
   put "<p>Hello" && tName && "from LiveCode Server</p>"
   put "<p>The date is" && the internet date & "</p>"
   put "<p>" & the second char of "12345" & "</p>"
   put "</body>"
   put "</html>"
?>

Results:
My LiveCode Server Test Page

Hello World from LiveCode Server

The date is Sun, 23 Nov 2014 14:27:24 +0800

2

Hope this helps.

Peter

On 23 Nov 2014, at 13:29, Nakia Brewer <Nakia.Brewer at westrac.com.au<mailto:Nakia.Brewer at westrac.com.au>> wrote:

Hi,

I am in the process of putting a web app together using the UserFrosting system as a starting point.
I am slowly getting the hang of the framework and am now wishing to start using LC Server to do some backend crunching to render the pages. (Im not picking up PHP as fast as I hoped!)

The UserFrosting system bases all of its page contents in PHP Files by design.

For example the index file is index.php

My question is, am I able to call LC functions from within a PHP file?

For example, in the below page (which is a PHP file)
Red content...

<?php
/*

_______________________________________________
use-livecode mailing list
use-livecode at lists.runrev.com<mailto:use-livecode at lists.runrev.com>
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
COPYRIGHT / DISCLAIMER: This message and/or including attached files may contain confidential proprietary or privileged information. If you are not the intended recipient, you are strictly prohibited from using, reproducing, disclosing or distributing the information contained in this email without authorisation from WesTrac. If you have received this message in error please contact WesTrac on +61 8 9377 9444. We do not accept liability in connection with computer virus, data corruption, delay, interruption, unauthorised access or unauthorised amendment. We reserve the right to monitor all e-mail communications.




More information about the use-livecode mailing list