iRev - Ajax - jQuery

Sivakatirswami katir at hindu.org
Thu Dec 31 22:52:57 EST 2009


I'll second Jim motion that because we have iRev now, doesn't meant that 
stacks on the web server accessed by CGI aren't still very powerful tools.

Like he says: instead of a mess of text files you might call as 
includes, or HTML templates as separate files, just push these all into 
a single project stack. Then, think of your CGI as a "front script"
or API you use from your iRev page.

It has the advantage that you can push back 80% of the content/code into 
the stack and dev that in the IDE instead of on the iRev page.

Then you just call it with a CGI and  use a little POST or GET call in 
your iRev page to get your data.


here is really simple example. In this case I have a single function I 
want to call from a big stack

on the iRev page:

put url 
"http://www.himalayanacademy.com/cgi-bin/getRandomLexiconWord.cgi" into 
tWordOfTheDay

getRandomLexiconWord.cgi reads:

#!/opt/web/bin/revolution -ui

on startup
	start using stack "../public_html/resources/lexicon/lexicon.rev"
	put getRandomWord() into buffer
	  put "Content-Type: text/plain" & cr
   put "Content-Length:" && the length of buffer & cr & cr
   put buffer
end startup

so you could have quite a bit of code, content, custom props etc stored 
in a single "project" stack, then pull this via cgi into your iRev page.

and it's lightening fast too.

Other advantage: I can outsource "work" on the back end stack.. I send 
to an editor who uses a RunRev Player to open my stack, she can do 
edits, clean up text, make changes etc. and periodically, I just drop 
that stack back on the server and bingo, updated!

Happy New Year!

Sivakatirswami









Jim Ault wrote:
> On-Rev allows both irev and cgi to work on the same web page or web query.
> Mix and match depending on your combined environment.
> 
> For pure irev scripts, you could use either text files or sql.
> In that case, you might want to factor another level or two to make 
> coding simpler.
> 
> ---- the following is probably more than you want to
>         know at this moment
>         so ignore it if you wish
> Now we are a short distance from the power of
> multidimensional arrays stored as a single text file,
> then use arrayDecode(allTemplates.txt)
> 
> The irev script can call multiple Rev cgi (or PHP cgi) scripts that 
> reside on any server.
> 
> I am building a stack to run as cgi where each card has a web page 
> format template that includes HTML, CSS, javascript, php, and jquery.  
> Beyond that, it will also build a usage database for tracking a 
> multi-site network of pages.  Each card has its own custom properties, 
> does not need a forest of text files, and parsing is all done inside Rev 
> code.
> --- end of advanced ideas
> 
> PS  I own but don't use Rapidweaver & Dreamweaver as they mostly create 
> more anomalies and head scratching than they solve.
> 
> I do most all of my work in BBEdit (just like TextWrangler, same 
> author), and use a very valuable tool - Firebug in FireFox
> 
> To do the On-Rev desktop backup, build a little scanner app that 
> archives the most recent file in the local folder, if it has changed 
> since the last backup one minute ago.
> 
> Have a good New Year's Eve !!
> 
> Jim Ault
> Las Vegas
> 
> On Dec 31, 2009, at 2:26 PM, Thomas McGrath III wrote:
> 
>> That is much less painful for sure, by an order of magnitude.
>> I didn't know that the iRev environment can save it self as a stack? 
>> Is that right?
>> And then of course if it is true then the custom props is possible too 
>> then?
>>
>> This is much easier. Thanks Jim
>>
>> Tom McGrath III
>> Lazy River Software
>> 3mcgrath at comcast.net
>>
>> iTunes Library Suite - libITS
>> Information and download can be found on this page:
>> http://www.lazyriversoftware.com/RevOne.html
>>
>>
>> On Dec 31, 2009, at 4:43 PM, Jim Ault wrote:
>>
>>> I use a much cleaner system for 'mashing up' code for HTML and 
>>> javascript
>>> Try a couple of these tips and see if the pain goes away.
>>>
>>>
>>> --// a couple notes about browsers
>>>  --// html honors both quote types, ignores extra spaces
>>>  --// javascript honors both quote types
>>>
>>>  --build the Rev string without ANY ampersands
>>>  --use single, not double quotes
>>>  get "  <a href='zhrefz' class='zclassz' rel='zrelz' title='ztitlez'>"
>>>  put IT & "<img src='zsrcz/' alt='zaltz'/></a>  " into tImg
>>>  --now do the replacements so they are easily visible/editable
>>>  replace "zhrefz" with  "photos/test/" in tImg
>>>  replace "zclassz" with "pirobox_gall" in tImg
>>>  replace "zrelz" with    "lightbox" in tIm
>>>  replace "ztitlez" with  "Best Photo" in tImg
>>>  replace "zsrcz" with   "photos/test/" in tImg
>>>  replace "zaltz" with    tSizeSpec in tImg
>>>  --send to browser
>>>  put tImg
>>>
>>>  --the next level of factoring could be custom props
>>>  --create an image link template
>>>  get "  <a href='zhrefz' class='zclassz' rel='zrelz' title='ztitlez'>"
>>>  get IT & "<img src='zsrcz/' alt='zaltz'/></a>  "
>>>  set the cpImgLinkTmpl of this stack to IT
>>>  save this stack
>>>  --now use the image link template
>>>  put the cpImgLinkTmpl of this stack into tImg
>>>  replace "zhrefz" with  "photos/test/" in tImg
>>>  replace "zclassz" with "pirobox_gall" in tImg
>>>  replace "zrelz" with    "lightbox" in tIm
>>>  replace "ztitlez" with  "Best Photo" in tImg
>>>  replace "zsrcz" with   "photos/test/" in tImg
>>>  replace "zaltz" with    tSizeSpec in tImg
>>>  --send to browser
>>>  put tImg
>>>
>>> Hope this gives you some ideas.
>>>
>>> Jim Ault
>>> Las Vegas
>>>
>>>
>>>
>>> On Dec 31, 2009, at 7:41 AM, Thomas McGrath III wrote:
>>>
>>>> And NO ONE should ever have to look at something like this again, 
>>>> let alone have to type it:
>>>> put "<a href=" & quote & "photos/test/"  & L & quote && " class=" & 
>>>> quote & "pirobox_gall" & quote & && " rel=" & quote & "lightbox" & 
>>>> quote & && " title=" & quote & L & quote & "><img src=" & quote & 
>>>> "photos/test/" & L & quote & " alt=" & quote & L & quote && 
>>>> tSizeSpec &  "/></a>" into tImg
>>>
>>>
> 
> 
> 
> 
> 
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your 
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution
> 



More information about the Use-livecode mailing list