Guidelines for Using Stacks on Web Back End

David Bovill david at openpartnership.net
Tue Aug 14 15:40:40 EDT 2007


On 14/08/07, Sivakatirswami <katir at hindu.org> wrote:
>
>
> 1) I had some failures which were cured by adding the
> word "stack" but, frankly I wasn't debugging from ground zero and possibly
> I had another error in my script and was blinded sided
> into drawing wrong conclusions. So:
>
> is there or should there be any difference between:
>
> start using "../httpdocs/Music/SongsListing.rev"
> start using stack "../httpdocs/Music/SongsListing.rev"
>
> or should these be equivalent?


I think they both work - the latter is prefered IMO

2) read reference to data in fields of the library stack require using
> explicit
> stack declarations
>
> start using "../httpdocs/Music/SongsListing.rev"
> put fld "artists"  into tArtists
>
> # the above fails...
>
> start using "../httpdocs/Music/SongsListing.rev"
> put fld "artists" of stack "SongsListing" into tArtists
>         # where we use the stack name minus the file extension
>
> # the above works... why?


My reading is that the cgi script is effectively executed as if it were in
some "root level". In fact if you test "put the long name of me & CR after
buffer" in a cgi it returns:

stack "script"


Which is I guess some sort of memory resident stack without a filename (the
filename of me is empty). As the script is effectively in another stack "put
fld "artists" of stack "SongsListing" into tArtists" makes sense in that
context.


3)  write reference: adding data to a back end stack library:
>
> put cr & "AR | Aruni Ranganathan" after fld "artists"
> put cr & "AR | Aruni Ranganathan" after fld "artists" of stack
> "SongsListing"
> save this stack # or # save stack "SongsListing"
>
> # both the above fail?


I think this is due to permissions of the stack and the cgi user not being
able to save data to the folder the stack is in? Can you write a text file
using a cgi to the same folder the stack is in?



More information about the use-livecode mailing list