Announcement

Collapse
No announcement yet.

MivaScript wget() or wdownload() examples.

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    MivaScript wget() or wdownload() examples.

    Hi Guys, Its been a while. (Miva is keeping me busy)

    Does anyone have MivaScript wget() or wdownload() examples they are willing to share.

    Ray Yates
    "If I have seen further, it is by standing on the shoulders of giants."
    --- Sir Isaac Newton

    #2
    What kind of example are you looking for? I use wget on a regular basis.
    M.A.D.* since 1997

    http://www.scotsscripts.com

    *miva application developers

    Comment


      #3
      I'm trying to use wdownload without success so tried to do the following in a page template.
      wget() returns -1
      The url file and path both exist.

      Code:
      <mvt:assign name="g.img_url" value="'http://www.pipusa.com/archive/products/1200/07-K200---UP.jpg'" />
      <mvt:assign name="g.image_path" value="'/mm5/graphics/00000001/pip/'" />
      <mvt:assign name="g.location" value="'script'" />
      
      <mvt:assign name="g.ok" value="wget( g.img_url, g.image_path, g.location )" />
      
      &mvt:global:img_url;<br>
      &mvt:global:image_path;<br>
      &mvt:global:ok;<br>
      Ray Yates
      "If I have seen further, it is by standing on the shoulders of giants."
      --- Sir Isaac Newton

      Comment


        #4
        Ok, here's the issue I think. This line:
        Code:
         
         <mvt:assign name="g.image_path" value="'/mm5/graphics/00000001/pip/'" />
        You need the filename:
        Code:
          
         <mvt:assign name="g.image_path" value="'/mm5/graphics/00000001/pip/some_image.jpg'" />
        M.A.D.* since 1997

        http://www.scotsscripts.com

        *miva application developers

        Comment


          #5
          Got this:
          Code:
              <MvASSIGN NAME = "l.source" VALUE = "{ l.module:pmDownloadURL $ l.module:code $ '.upd' }">
                  <MvCOMMENT> assign target, temp and backup filenames </MvCOMMENT>
                  <MvASSIGN NAME = "l.target" VALUE = "{ g.Module_Root $ l.module:module }">
                  <MvASSIGN NAME = "l.temptarget" VALUE = "{ glosub(l.target, '.mvc', '.upd') }">
                  <MvASSIGN NAME = "l.backuptarget" VALUE = "{ glosub(l.target, '.mvc', '.bak') }">
          
                  <MvCOMMENT> delete any leftover backup file </MvCOMMENT>
                  <MvIF EXPR = "{ sexists( l.backuptarget) }">
                      <MvASSIGN NAME = "l.delete" VALUE = "{ sdelete(l.backuptarget) }">
                  </MvIF>
          
                  <MvCOMMENT> get file from server </MvCOMMENT>
                  <MvASSIGN NAME = "l.get" VALUE = "{ wget(l.source, l.temptarget, 'script') }">
                  <MvCOMMENT> if response OK </MvCOMMENT>
                  <MvIF EXPR = "{ l.get EQ 200 }">
                      <MvCOMMENT> rename original to backup </MvCOMMENT>
                      <MvASSIGN NAME = "l.backup" VALUE = "{ srename(l.target, l.backuptarget) }">
                      <MvCOMMENT> rename update to mvc </MvCOMMENT>
                      <MvASSIGN NAME = "l.update" VALUE = "{ srename(l.temptarget, l.target) }">
                      <MvIF EXPR = "{ l.backup AND l.update AND ( NOT IsDevSite() ) }">
                          <MvCOMMENT> update license status to CURRENT </MvCOMMENT>
                          <MvASSIGN NAME = "l.lic_struct:status" VALUE = "{ 'CURRENT' }">
                          <MvASSIGN NAME = "l.ok" VALUE = "{ SaveLicense(l.module, l.lic_struct) }">
                      </MvIF>
                  </MvIF>
          Bruce Golub
          Phosphor Media - "Your Success is our Business"

          Improve Your Customer Service | Get MORE Customers | Edit CSS/Javascript/HTML Easily | Make Your Site Faster | Get Indexed by Google | Free Modules | Follow Us on Facebook
          phosphormedia.com

          Comment


            #6
            Ahh, those make sense. Thanks guys. BTW, if you ever need to contact me directly, my Miva email address starts with ryates.
            Ray Yates
            "If I have seen further, it is by standing on the shoulders of giants."
            --- Sir Isaac Newton

            Comment


              #7
              anytime we can repay you for your education efforts is a good time!
              Bruce Golub
              Phosphor Media - "Your Success is our Business"

              Improve Your Customer Service | Get MORE Customers | Edit CSS/Javascript/HTML Easily | Make Your Site Faster | Get Indexed by Google | Free Modules | Follow Us on Facebook
              phosphormedia.com

              Comment

              Working...
              X