Inserting hyperlinks

### Index Up << >>

## Inserting hyperlinks

named: [area href=``dir/page'' secure=1* arg=``argument''* form=``form string''*]

positional: [area pg arg*]

Produces the URL to call a MiniVend page, without the surrounding A HREF notation. This can be used to get control of your HREF items, perhaps to place an ALT string or a Javascript construct. It was originally named area because it also can be used in a client-side image map.

       <A HREF="[area catalog]" ALT="Main catalog page">

The optional arg is used just as in the page tag.

The optional `form` argument allows you to encode a form in the link.

            <A HREF="[area form="
                    mv_order_item=99-102
                    mv_order_size=L
                    mv_order_quantity=1
                    mv_separate_items=1
                    mv_todo=refresh"
            ]"> Order t-shirt in Large size </A>

See above for more information.

[/page], [/order]
  Expands into </a>. Used with the page element, such as:

        [page shirts]Our shirt collection[/page].

  TIP: A small efficiency boost in large pages is to just use the </A> tag.

[page ...]
  named: [page href=``dir/page'' arg=``argument'' secure=1* form=``form string'']

  positional: [page dir/page arg*] (only two positional parameters)

  Insert a hyperlink to the specified catalog page pg. For example, [page shirts] will expand into < a href=``http://machine.company.com/cgi-bin/vlink/shirts?id=WehUkATn&pc=33''>. The catalog page displayed will come from ``shirts.html'' in the pages directory.

  If the user has sent a cookie to MiniVend (meaning the second page they access), and you set the scratch value `mv_no_session_id` in their session, the session ID will not be appended to the URL. If you set the scratch value `mv_no_count`, then the page count will not be appended; this is not dependent on cookies. So if you put in your initial page

          [set mv_no_session_id]1[/set]
          [set mv_no_count]1[/set]
          [set mv_add_dot_html]1[/set]

  or put in `catalog.cfg`:

          ScratchDefault  mv_no_session_id  1
          ScratchDefault  mv_no_count       1
          ScratchDefault  mv_add_dot_html   1

  no session ID or count will be shown. That makes the URL shown above be http://machine.company.com/cgi-bin/vlink/shirts.html -- once again, that is on the second page the user accesses if they are taking and sending cookies. If the user has a pre-existing MV_SESSION_ID or MV_USERNAME cookie from a prior session, the effect will be immediate.

  The `argument` will be passed to MiniVend and placed in the mv_arg session parameter. This allows programming of a conditional page display based on where the link came from. The argument is then available with the tag [data session arg], or the embedded Perl session variable $Session->{arg}. If you set the catalog configuration option NewEscape, which is the default, then spaces and some other characters will be escaped with the `%NN` HTTP-style notation and unescaped when the argument is read back into the session.

  A bit of magic occurs if MiniVend has built a static plain HTML page for the target page. Instead of generating a normal MiniVend-parsed page reference, a static page reference will be inserted if the user has accepted and sent back a cookie with the session ID.

  The optional `form` argument allows you to encode a form in the link.

              [page form="
                      mv_order_item=99-102
                      mv_order_size=L
                      mv_order_quantity=1
                      mv_separate_items=1
                      mv_todo=refresh"] Order t-shirt in Large size </A>

  The two form values mv_session_id and mv_arg are automatically added when appropriate. (mv_arg is the `arg` parameter for the tag.)

  If the parameter `href` is not supplied, process is used, causing normal MiniVend form processing. If the `href` points to an http:// link no MiniVend URL processing will be done, but the mv_session_id

  This would generate a form that ordered item number 99-102 on a separate line (`mv_separate_items` being set), with size `L`, in quantity 2. Since the page is not set, you will go to the default shopping cart page -- equally you could set `mv_orderpage=yourpage` to go to `yourpage`.

  All normal MiniVend form caveats apply -- you must have an action, you must supply a page if you don't want to go to the default, etc.

  You can theoretically submit any form with this, though none of the included values can have newlines or trailing whitespace. If you want to do something like that you will have to write a UserTag.

  You can also use it for submitting foreign forms if you like; it will not touch the href if it begins with http:, ftp:, or the like.

[/page], [/order]
  Expands into </a>. Used with the page element, such as:

        [page shirts]Our shirt collection[/page].

  TIP: A small efficiency boost in large pages is to just use the </A> tag.

### Index Up << >>