Can I not use constants in revserver scripts ?

Mike Bonner bonnmike at gmail.com
Fri Feb 10 10:52:15 EST 2012


Oh, while not worth it, it might work to wrap the workhorse part of the
script into a command.

<?lc
command renderpage
constant myconstant="stuff"
do1 k
do2 k
do3




end renderpage
command do1 pvar

end do1

command do2 pvar

end do2

command do3 pvar

end do3

renderpage
?>

Would probably work but doubt it would be worth the effort when a regular
old var can be used.

Hmm I do wonder though.. Since stacks are now supported it might work to
have a stack that sets the constant and see if it works that way.
On Fri, Feb 10, 2012 at 8:48 AM, Mike Bonner <bonnmike at gmail.com> wrote:

> e I think there was a thread on this that I read before.
>
> If I recall correctly, setting a constant inside a handler works for THAT
> handler.  So if you have.
>
> <?lc
> command tryConst
> constant k="inside handler"
> put k
> end tryConst
>
> tryconst
>
> "inside handler" will be displayed. But setting it outside of a handler
> doesn't work.
>
> If you have the following
>
> <?lc
> command showConst
> constant k="inside handler"
> put k
> end showConst
> constant k="OutsideHandler"
> put k
> showconst
> put k
>
> ?>
>
> You end up with kinsidehandlerk
>
> Keith, yeah revserver supports put.  Anything that is "put" without a
> destination container ends up as part of the final page.
>
> On Fri, Feb 10, 2012 at 8:30 AM, Matthias Rebbe <
> matthias_livecode_150811 at m-r-d.de> wrote:
>
>> Hi Alex,
>>
>> Tried here with LiveCodeServer 5.0.2 and got the same result. :(
>>
>> Regards,
>>
>> Matthias
>>
>> Am 10.02.2012 um 16:01 schrieb Alex Tweedly:
>>
>> >> constant K = "asdf"
>> >> put K
>> >
>> > If I put the above 2 lines in a script in a stack or in the IDE/msgbox,
>> I get (as expected) "asdf" output.
>> >
>> > But if do the same thing in a revserver script  (in my case, on-rev),
>>  I get "K".
>> >
>> > That seems wrong to me, and the dictionary for constant includes server
>> in its platform list.
>> > Am I missing something ?  Can someone else try it and see if I'm doing
>> something odd.
>> >
>> > Thanks
>> > -- Alex.
>> >
>> > _______________________________________________
>> > use-livecode mailing list
>> > 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
>>
>>
>> _______________________________________________
>> use-livecode mailing list
>> 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
>>
>
>



More information about the use-livecode mailing list