Announcement

Collapse
No announcement yet.

File include in Miva?

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

    File include in Miva?



    Guys,

    Is there a way to include an html file from the ~/html tree inside my
    category header? I want to use the same HTML code snippet in both Miva and
    static pages...
    I understand that both MVCALL (OUI's %CALL%) and OUI's %INCLUDE% can load
    html files but from the ~/mivadata tree.
    I was thinking of using a Javascript function, but am not sure how the
    Miva/OUI/VC's CPT processing will handle that.

    Thanks,
    Alex




    #2
    File include in Miva?



    You can use this syntax...

    %OUI%%CALL(<A HREF ="http://www.yoursite.com/path/file.html|GET)%">http://www.yoursite.com/path/file.html|GET)%</A>

    to pull a page from your site (or from anywhere on the web) directly into a
    Merchant header or footer field. Note: Do NOT include the <html>, <head> or
    <body> tags inside the static page. You can then use server side includes to
    pull the same page into your other static pages.

    -----Original Message-----
    From: [email protected] [mailto:[email protected]] On Behalf
    Of Alex Brodsky
    Sent: Wednesday, March 02, 2005 10:06 PM
    To: [email protected]
    Subject: [meu] File include in Miva?

    Guys,

    Is there a way to include an html file from the ~/html tree inside my
    category header? I want to use the same HTML code snippet in both Miva and
    static pages...
    I understand that both MVCALL (OUI's %CALL%) and OUI's %INCLUDE% can load
    html files but from the ~/mivadata tree.
    I was thinking of using a Javascript function, but am not sure how the
    Miva/OUI/VC's CPT processing will handle that.

    Thanks,
    Alex



    Comment


      #3
      File include in Miva?



      > -----Original Message-----
      > To: [email protected]
      > Subject: [meu] File include in Miva?

      > I understand that both MVCALL (OUI's %CALL%) and OUI's %INCLUDE% can load

      umm, I'll be the first (perhaps the only) one to suggest that OUI and
      MEU should not mix.
      Best to send that to Merchant users, or Merchant coders. (I feel your
      pain, but I'll not mention your name)

      if it helps any, I would _love_ it if Miva had an "include" function.

      --
      Bill Guindon (aka aGorilla)

      Comment


        #4
        File include in Miva?



        Hi Bill,

        I thought there was MvCall?

        Forget what it does, though...

        Different from ?

        In VBSCRIPT, you can use standard includes, as shown above, or...=20

        File_name =3D "filename.ext"
        Server.execute(File_name)

        ... in case you want to get dynamic about it. Whether a good thing or
        bad thing, variables in the executed files are scoped locally for that
        files execution and pooled database connections cannot be used. A new
        instance of everything must be established.



        Andrew=20


        =20



        > -----Original Message-----
        > From: Bill Guindon [mailto:[email protected]]=20
        > Sent: Wednesday, March 02, 2005 11:12 PM
        > To: Alex Brodsky
        > Cc: miva-users
        > Subject: Re: [meu] File include in Miva?
        >=20
        >=20
        > > -----Original Message-----
        > > To: [email protected]
        > > Subject: [meu] File include in Miva?
        >=20
        > > I understand that both MVCALL (OUI's %CALL%) and OUI's=20
        > %INCLUDE% can=20
        > > load
        >=20
        > umm, I'll be the first (perhaps the only) one to suggest that=20
        > OUI and MEU should not mix. Best to send that to Merchant=20
        > users, or Merchant coders. (I feel your pain, but I'll not=20
        > mention your name)
        >=20
        > if it helps any, I would _love_ it if Miva had an "include" function.
        >=20
        > --=20
        > Bill Guindon (aka aGorilla)
        >=20

        Comment


          #5
          File include in Miva?



          On Thu, 3 Mar 2005 13:49:48 -0500, Andrew Noce
          <[email protected]> wrote:
          > Hi Bill,
          >
          > I thought there was MvCall?
          >
          > Forget what it does, though...
          >
          > Different from ?

          It has it's limitations, and I'm not so sure it's the most efficient
          way to do things. It can only access files that are on the web (so
          you can't hide 'partial' pages in your data dir), and it loops through
          them parsing for tags as it goes. So yeah, would work, just not as
          'clean' a solution as a simple 'include' would be.

          > In VBSCRIPT, you can use standard includes, as shown above, or...
          >
          > File_name = "filename.ext"
          > Server.execute(File_name)
          >
          > ... in case you want to get dynamic about it. Whether a good thing or
          > bad thing, variables in the executed files are scoped locally for that
          > files execution and pooled database connections cannot be used. A new
          > instance of everything must be established.

          Right, that's another reason I'd like an 'include', so I could create
          a 'library' script with common functions, and just 'include' those
          functions in any script. Saves the trouble of having to do MvDO all
          over the place.

          --
          Bill Guindon (aka aGorilla)

          Comment


            #6
            File include in Miva?



            What's wrong with MvDO? This is exactly the task it is designed for.
            Well, in Miva Script v4 (since v4.11) there is also MvINCLUDE.

            > Right, that's another reason I'd like an 'include', so I
            > could create a 'library' script with common functions,
            > and just 'include' those functions in any script.
            > Saves the trouble of having to do MvDO all over the place.

            There is no need for even with MvDO. Just declare the functions once in each
            file (just like in many other programming languages) and then you can call
            them directly as much as you want. I have common libraries and use this
            technique all over all my Miva Script files.

            Ivo
            http://mivo.truxoft.com



            -----Original Message-----
            From: Bill Guindon

            On Thu, 3 Mar 2005 13:49:48 -0500, Andrew Noce
            <[email protected]> wrote:
            > Hi Bill,
            >
            > I thought there was MvCall?
            >
            > Forget what it does, though...
            >
            > Different from ?

            It has it's limitations, and I'm not so sure it's the most efficient
            way to do things. It can only access files that are on the web (so
            you can't hide 'partial' pages in your data dir), and it loops through
            them parsing for tags as it goes. So yeah, would work, just not as
            'clean' a solution as a simple 'include' would be.

            > In VBSCRIPT, you can use standard includes, as shown above, or...
            >
            > File_name = "filename.ext"
            > Server.execute(File_name)
            >
            > ... in case you want to get dynamic about it. Whether a good thing or
            > bad thing, variables in the executed files are scoped locally for that
            > files execution and pooled database connections cannot be used. A new
            > instance of everything must be established.

            Right, that's another reason I'd like an 'include', so I could create
            a 'library' script with common functions, and just 'include' those
            functions in any script. Saves the trouble of having to do MvDO all
            over the place.


            Comment


              #7
              File include in Miva?



              On Thu, 3 Mar 2005 21:06:19 +0100, Ivo Truxa <[email protected]> wrote:
              > What's wrong with MvDO? This is exactly the task it is designed for.
              > Well, in Miva Script v4 (since v4.11) there is also MvINCLUDE.

              Ok, I'll change my comment to "It would be great if the had an
              'include', and the actually documented it".

              > > Right, that's another reason I'd like an 'include', so I
              > > could create a 'library' script with common functions,
              > > and just 'include' those functions in any script.
              > > Saves the trouble of having to do MvDO all over the place.
              >
              > There is no need for even with MvDO. Just declare the functions once in each
              > file (just like in many other programming languages) and then you can call
              > them directly as much as you want. I have common libraries and use this
              > technique all over all my Miva Script files.

              You mean copy/paste the functions? Or wrap the MvDO with local functions?

              I can see that wrapping them makes them appear local, but it's a bit
              tedious. Does the above MvINCLUDE solve this? Guess I'm off to write
              a couple tests.

              --
              Bill Guindon (aka aGorilla)

              Comment


                #8
                File include in Miva?



                From: Bill Guindon [mailto:[email protected]]

                > Ok, I'll change my comment to "It would be great if the had an
                > 'include', and the actually documented it".

                As many other new functions and features, it _is_ documented in the Release
                Notes :) In Miva v4, reading the Notes is obligatory if you want to use all
                its features. I believe Miva hired a new person who works on new
                documentation, though anyway.


                >> There is no need for even with MvDO. Just declare the functions once in
                each
                >> file (just like in many other programming languages) and then you can
                call
                >> them directly as much as you want. I have common libraries and use this
                >> technique all over all my Miva Script files.


                > You mean copy/paste the functions? Or wrap the MvDO with local functions?

                Of course not, you then do not need any libraries :) As I wrote, simply just
                declare the functions:

                <MvFUNCTION...><MvDO..><MvFUNCRETURN...></MvFUNCTION>
                <MvFUNCTION...><MvDO..><MvFUNCRETURN...></MvFUNCTION>
                ...
                <MvFUNCTION...><MvDO..><MvFUNCRETURN...></MvFUNCTION>

                > I can see that wrapping them makes them appear local, but
                > it's a bit tedious.

                No really. Takes just couple of lines at the top of each file. Fast and
                easily done. Real includes would save the file access in run time, but on
                the other hand they would then bloat the file size unnecessarily - if you
                have libraries with big number of functions, where you usually use just a
                limited part of them, including them in the above way may prove more
                efficient.

                Ivo
                http://mivo.truxoft.com




                Comment


                  #9
                  File include in Miva?



                  I thought MvINCLUDE was implemented in one of the virtual
                  machine/compiler releases? Albeit it was buggy, I remember discussions
                  on it here in the list.

                  Bill Guindon wrote:
                  > On Thu, 3 Mar 2005 21:06:19 +0100, Ivo Truxa <[email protected]> wrote:
                  >
                  >>What's wrong with MvDO? This is exactly the task it is designed for.
                  >>Well, in Miva Script v4 (since v4.11) there is also MvINCLUDE.
                  >
                  >
                  > Ok, I'll change my comment to "It would be great if the had an
                  > 'include', and the actually documented it".
                  >
                  >
                  >>>Right, that's another reason I'd like an 'include', so I
                  >>>could create a 'library' script with common functions,
                  >>>and just 'include' those functions in any script.
                  >>>Saves the trouble of having to do MvDO all over the place.
                  >>
                  >>There is no need for even with MvDO. Just declare the functions once in each
                  >>file (just like in many other programming languages) and then you can call
                  >>them directly as much as you want. I have common libraries and use this
                  >>technique all over all my Miva Script files.
                  >
                  >
                  > You mean copy/paste the functions? Or wrap the MvDO with local functions?
                  >
                  > I can see that wrapping them makes them appear local, but it's a bit
                  > tedious. Does the above MvINCLUDE solve this? Guess I'm off to write
                  > a couple tests.
                  >

                  --
                  ------------

                  "To The States, or any one of them, or any city of The States,
                  Resist much, obey little;
                  Once unquestioning obedience, once fully enslaved;
                  Once fully enslaved, no nation, state, city, of this earth,
                  ever afterward resumes its liberty."

                  ~Walt Whitman

                  Comment


                    #10
                    File include in Miva?



                    On Thu, 3 Mar 2005 21:42:48 +0100, Ivo Truxa <[email protected]> wrote:
                    > From: Bill Guindon [mailto:[email protected]]
                    >
                    > > Ok, I'll change my comment to "It would be great if the had an
                    > > 'include', and the actually documented it".
                    >
                    > As many other new functions and features, it _is_ documented in the Release
                    > Notes :) In Miva v4, reading the Notes is obligatory if you want to use all
                    > its features. I believe Miva hired a new person who works on new
                    > documentation, though anyway.

                    Well, my tests fail. It does work well as a MvCRASHCOMPILER tag tho'.
                    Anybody have examples where this is actually working?

                    > <MvFUNCTION...><MvDO..><MvFUNCRETURN...></MvFUNCTION>
                    > <MvFUNCTION...><MvDO..><MvFUNCRETURN...></MvFUNCTION>
                    > ...
                    > <MvFUNCTION...><MvDO..><MvFUNCRETURN...></MvFUNCTION>
                    >
                    > > I can see that wrapping them makes them appear local, but
                    > > it's a bit tedious.
                    >
                    > No really. Takes just couple of lines at the top of each file. Fast and
                    > easily done. Real includes would save the file access in run time, but on
                    > the other hand they would then bloat the file size unnecessarily - if you
                    > have libraries with big number of functions, where you usually use just a
                    > limited part of them, including them in the above way may prove more
                    > efficient.

                    At that point you make it a library directory, and split the large
                    file into logical chunks... dir.mvc, db.mvc, string.mvc, array.mvc...
                    then include as needed. For the truly lazy, you could even write up a
                    wrapper that does your includes for you. ie: main.mvc with small
                    function with one call... include('db, dir, string').

                    --
                    Bill Guindon (aka aGorilla)

                    Comment


                      #11
                      File include in Miva?



                      Yes, exactly as I wrote - it was introduced in v4.11, there was at least one
                      fix in v4.13.

                      I would advice everybody who is serious about coding in Miva Script to
                      download all the compiler and Empresa release notes, and peek into them at
                      least once a week. I do. It certainly helps to remember what tags and
                      functions one can use most efficiently :)

                      Ivo
                      http://mivo.truxoft.com




                      -----Original Message-----
                      From: Scot Ranney [mailto:[email protected]]


                      I thought MvINCLUDE was implemented in one of the virtual
                      machine/compiler releases? Albeit it was buggy, I remember discussions
                      on it here in the list.

                      Bill Guindon wrote:
                      > On Thu, 3 Mar 2005 21:06:19 +0100, Ivo Truxa <[email protected]> wrote:
                      >
                      >>What's wrong with MvDO? This is exactly the task it is designed for.
                      >>Well, in Miva Script v4 (since v4.11) there is also MvINCLUDE.
                      >
                      >
                      > Ok, I'll change my comment to "It would be great if the had an
                      > 'include', and the actually documented it".
                      >
                      >
                      >>>Right, that's another reason I'd like an 'include', so I
                      >>>could create a 'library' script with common functions,
                      >>>and just 'include' those functions in any script.
                      >>>Saves the trouble of having to do MvDO all over the place.
                      >>
                      >>There is no need for even with MvDO. Just declare the functions once in
                      each
                      >>file (just like in many other programming languages) and then you can call
                      >>them directly as much as you want. I have common libraries and use this
                      >>technique all over all my Miva Script files.
                      >
                      >
                      > You mean copy/paste the functions? Or wrap the MvDO with local functions?
                      >
                      > I can see that wrapping them makes them appear local, but it's a bit
                      > tedious. Does the above MvINCLUDE solve this? Guess I'm off to write
                      > a couple tests.
                      >


                      Comment


                        #12
                        File include in Miva?



                        From: Bill Guindon

                        > Well, my tests fail. It does work well as a MvCRASHCOMPILER tag tho'.
                        > Anybody have examples where this is actually working?

                        Maybe an outdated compiler?

                        >> ...
                        >> limited part of them, including them in the above way may prove more
                        >> efficient.

                        > At that point you make it a library directory, and split the large
                        > file into logical chunks... dir.mvc, db.mvc, string.mvc, array.mvc...
                        > then include as needed.

                        As I see you realize yourself that it is at least as much cumbersome as the
                        other solution, especially if you have a lot of libraries with _many_
                        functions and need to share them with many applications.

                        Using a pro editor capable of file includes is another solution. If I
                        remember well, there were even some plugins or tools offered by some Miva
                        Script community members.

                        I never bothered; I find the solution with libraries in separate files very
                        well matching my needs and use many of their advantages. It is just like
                        dll's in Windows. Of course, it has advantages and disadvantages, but if you
                        learn to use the advantages, you simply love it :)

                        Ivo
                        http://mivo.truxoft.com




                        Comment


                          #13
                          File include in Miva?



                          But, Ivo, what would you do if a global function changes?
                          Now you need to go into several separate scripts and update them each,
                          instead of making the change to one file.

                          Andrew Noce=20
                          Director of Technology
                          Hotel Interactive, Inc.=20
                          Hospitality Industry News and Services=20
                          <A HREF ="http://www.hotelinteractive.com=20">http://www.hotelinteractive.com=20</A>



                          =20



                          > -----Original Message-----
                          > From: Ivo Truxa [mailto:[email protected]]=20
                          > Sent: Thursday, March 03, 2005 3:06 PM
                          > To: 'miva-users'
                          > Subject: RE: [meu] File include in Miva?
                          >=20
                          >=20
                          > What's wrong with MvDO? This is exactly the task it is designed for.=20
                          > Well, in Miva Script v4 (since v4.11) there is also MvINCLUDE.
                          >=20
                          > > Right, that's another reason I'd like an 'include', so I
                          > > could create a 'library' script with common functions,=20
                          > > and just 'include' those functions in any script. =20
                          > > Saves the trouble of having to do MvDO all over the place.
                          >=20
                          > There is no need for even with MvDO. Just declare the=20
                          > functions once in each file (just like in many other=20
                          > programming languages) and then you can call them directly as=20
                          > much as you want. I have common libraries and use this=20
                          > technique all over all my Miva Script files.
                          >=20
                          > Ivo
                          > http://mivo.truxoft.com=20
                          >=20
                          >=20
                          >=20
                          > -----Original Message-----
                          > From: Bill Guindon
                          >=20
                          > On Thu, 3 Mar 2005 13:49:48 -0500, Andrew Noce=20
                          > <[email protected]> wrote:
                          > > Hi Bill,
                          > >=20
                          > > I thought there was MvCall?
                          > >=20
                          > > Forget what it does, though...
                          > >=20
                          > > Different from ?
                          >=20
                          > It has it's limitations, and I'm not so sure it's the most=20
                          > efficient way to do things. It can only access files that=20
                          > are on the web (so you can't hide 'partial' pages in your=20
                          > data dir), and it loops through them parsing for tags as it=20
                          > goes. So yeah, would work, just not as 'clean' a solution as=20
                          > a simple 'include' would be.
                          > =20
                          > > In VBSCRIPT, you can use standard includes, as shown above, or...
                          > >=20
                          > > File_name =3D "filename.ext"
                          > > Server.execute(File_name)
                          > >=20
                          > > ... in case you want to get dynamic about it. Whether a=20
                          > good thing or=20
                          > > bad thing, variables in the executed files are scoped=20
                          > locally for that=20
                          > > files execution and pooled database connections cannot be=20
                          > used. A new=20
                          > > instance of everything must be established.
                          >=20
                          > Right, that's another reason I'd like an 'include', so I=20
                          > could create a 'library' script with common functions, and=20
                          > just 'include' those functions in any script. Saves the=20
                          > trouble of having to do MvDO all over the place.
                          >=20
                          >=20

                          Comment


                            #14
                            File include in Miva?



                            From: Andrew Noce [mailto:[email protected]]

                            > But, Ivo, what would you do if a global function changes?

                            Absolutely nothing :)

                            (unless you change the name or the number of arguments, in which case you
                            have to rewrite the script using the function anyway :)

                            Ivo
                            http://mivo.truxoft.com


                            > Now you need to go into several separate scripts and update them each,
                            > instead of making the change to one file.




                            Comment


                              #15
                              File include in Miva?



                              Hmmmm...

                              So what is the scope of variables and functions for scripts executed
                              with MvDo?
                              You are saying they are global to the parent script, and therefore the
                              MVDo is an equivalent to the include?

                              Sorry for the academic questions, I'm quite a bit rusty and keep getting
                              my VBSCRIPT which I use daily mixed up with my MvScript, which I never
                              use.

                              But it's an interesting subject, anyway. Let me take it a step
                              further... For those of you with extensive programming knowledge, what
                              is it that keeps you working with MivaScript as opposed to moving to
                              some other more sophisticated language? Is it the Merchant market alone,
                              or the nostalgia for the language, or do you really feel it is as
                              sophisticated as perl, asp, .net, php, ruby, etc.?

                              Miva excels in it's simplicity but I would imagine outside the Merchant
                              market it would hold little other value for experienced programmers.


                              Andrew Noce=20



                              > -----Original Message-----
                              > From: Ivo Truxa [mailto:[email protected]]=20
                              > Sent: Thursday, March 03, 2005 4:30 PM
                              > To: 'miva-users'
                              > Subject: RE: [meu] File include in Miva?
                              >=20
                              >=20
                              > From: Andrew Noce [mailto:[email protected]]=20
                              >=20
                              > > But, Ivo, what would you do if a global function changes?
                              >=20
                              > Absolutely nothing :)=20
                              >=20
                              > (unless you change the name or the number of arguments, in=20
                              > which case you have to rewrite the script using the function anyway :)
                              >=20
                              > Ivo
                              > http://mivo.truxoft.com=20
                              >=20
                              >=20
                              > > Now you need to go into several separate scripts and update=20
                              > them each,=20
                              > > instead of making the change to one file.
                              >=20
                              >=20
                              >=20
                              >=20

                              Comment

                              Working...
                              X