Bringing the internet highway into your project? Building FTP, HTTP, email, chat or other client solutions?
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
-
teriibi
- Posts: 254
- Joined: Mon Nov 13, 2017 3:49 pm
Post
by teriibi » Thu Feb 08, 2018 8:44 pm
Hi,
Is there a way to distribute the returned values of 2 Echos into 2 dif. LC fields ?
i.e.
Code: Select all
<?php
echo "Start date : ".$date1;
echo "End date : ".$date2;
?>
Both values will "fall" into a single LC field, or is it just the only way PHP Echo does works

-
ghettocottage
- Livecode Opensource Backer

- Posts: 366
- Joined: Tue Apr 10, 2012 9:18 am
Post
by ghettocottage » Thu Feb 08, 2018 11:48 pm
your could simplify your php to just this
and then in your LC App do something like:
Code: Select all
put it into toParse
repeat with i = 1 to the number of lines of toParse
put item 1 of toParse into field "start date"
put item 2 of toParse into field "end date"
end repeat
-
teriibi
- Posts: 254
- Joined: Mon Nov 13, 2017 3:49 pm
Post
by teriibi » Fri Feb 09, 2018 2:45 am
ok, so gathering both echos - into one line - first, is a must ? ...
PS: Works perfectly, Tks again !!
On the other side if there is another way to dispatch them properly even when they are on two distinct lines ..i m still intereted
(thats the case for now)
-
ghettocottage
- Livecode Opensource Backer

- Posts: 366
- Joined: Tue Apr 10, 2012 9:18 am
Post
by ghettocottage » Fri Feb 09, 2018 5:19 am
You could do it either way. If you want it on separate lines you could do something like:
Code: Select all
<?php
echo $date1.",";
echo $date2;
?>
then with LC just do the same thing as my other reply. Adding the comma will give LC something to use as a delimiter. There is probably another way, as usual with coding, but this should work
-
AxWald
- Posts: 578
- Joined: Thu Mar 06, 2014 2:57 pm
Post
by AxWald » Fri Feb 09, 2018 12:39 pm
Hi,
that's easy. If I fill your variables with date("c") each, your .php returns:
Code: Select all
Start date : 2018-02-09T12:18:49+01:00End date : 2018-02-09T12:18:49+01:00
So the second string starts with "End date :". Here we go:
Code: Select all
on mouseUp
-- get URL myPhp -- we would fetch the php data this way
get "Start date : 2018-02-09T12:18:49+01:00End date : 2018-02-09T12:18:49+01:00"
-- but we already know the data ;-)
put CR after char offset("End date :", it) -1 of it
put line 1 of it into fld "Start"
put line 2 of it into fld "End"
end mouseUp
All code published by me here was created with Community Editions of LC (thus is GPLv3).
If you use it in closed source projects, or for the Apple AppStore, or with XCode
you'll violate some license terms - read your relevant EULAs & Licenses!
-
teriibi
- Posts: 254
- Joined: Mon Nov 13, 2017 3:49 pm
Post
by teriibi » Fri Feb 09, 2018 7:39 pm
Thanks to both, I ll keep that at hand, very usefull !
