iRev - Ajax - jQuery

Jim Ault jimaultwins at yahoo.com
Thu Dec 31 16:43:50 EST 2009


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







More information about the use-livecode mailing list