Equivalent to PHP HereDoc?
Posted: Wed Apr 20, 2016 10:09 am
Hi,
I’m wondering if there’s an equivalent to PHP’s HereDoc funcitonality in LIveCode. In PHP I can do something like this:
The output from that would be
The above is really simple, but you can do some quite complex things with it - heredoc will process any variable names within between the END and END; and insert their values into the string.
In the case of LiveCode, I’m using shell scripts to process images, and I’m having to do stuff like this:
But more complex than that. My immediate thoughts would be to include placeholders for variables, and so search & replace to replace those with the real variables, which would make my scripts easier to read (right now, adding variables in like I do above doesn’t help with readability).
I’m wondering if there’s an equivalent to PHP’s HereDoc funcitonality in LIveCode. In PHP I can do something like this:
Code: Select all
$fruit="apples";
$myOutput = <<<END
I really like $fruit
END;
echo $myOutput;
Code: Select all
I really like apples
In the case of LiveCode, I’m using shell scripts to process images, and I’m having to do stuff like this:
Code: Select all
put convertPath into myCommand
put myCommand && "image.png" && myWidth && myHeight && "image2.png" into myCommand