PTM Logo Version 0.5.1 Beta
Home    SVN    Downloads    Documentation    Forum    Contact
This Site is 100%
Powered by PTM

SourceForge.net Logo
Documentation
I   Index
II   GNU GPL
III   Description
IV   Installation
V   Language Overview
VI   Tags
VII   Variables
  $_BASE
  $_CGI
  %_COOKIES
  $_DEFAULT_PTM_FILE
  $_DOCUMENT_ROOT
  %_GET
  $_HEADER
  @_KEYWORDS
  $_PATH
  %_POST
  @_PTM
  $_PTM_POS
  $_PTM_PREPROCESS
  @_REQUIRE
  $_SCRIPT
  %_SERVER
  %_SESSION
  %_SET_COOKIES
  $_SYNTAX_...
  $_URL
  $_USE_SECURE_SCRIPT_PASSING
  $_VERSION
VIII   Functions
IX   Modules
Documentation
View / Download this file.
------------------
%_COOKIES VARIABLE
------------------

  -----------
  DESCRIPTION
  -----------

    %_COOKIES is a hash/associative array which stores user cookies and their
    associated values. Cookies are stored in the following format:

      %_COOKIES = (
        cookie1 => 'value1',
        cookie2 => 'value2',
        cookie3 => 'value3'
      );

    The %_COOKIES keys (cookie names) can be accessed as a list (array) with
    Perl's "keys" command like so:

      @cookie_names = keys %_COOKIES;

    The cookie values can be accessed by referencing the specific name of the
    requested cookie:

      $cookie_value = $_COOKIES{'cookie1'};

    Notice that, when referencing a specific cookie value, the '%' is changed to
    a '$' when referencing the hash, as you are referencing a specific value and
    not the entire hash.

  --------------
  USAGE EXAMPLES
  --------------

    --------------------------------------------------------------
    Example 1: Showing the Value of a Cookie using the DISPLAY Tag
    --------------------------------------------------------------

      The value of the Color cookie is <?= $_COOKIES{'Color'} ?>.

    ---------------------------------------------------------------------------
    Example 2: Showing All the Cookies using the DO and DISPLAY Tags and a Loop
    ---------------------------------------------------------------------------

      <? foreach $cookie (keys %_COOKIES) { ?>
        The value of the <?= $cookie ?> cookie is <?= $_COOKIES{$cookie} ?>.<br>
      <? } ?>

  --------
  SEE ALSO
  --------

    TAGS

      DO, DISPLAY

    VARIABLES

      %_SET_COOKIES

    FUNCTIONS

      delete_cookie(), set_cookie()
Home    SVN    Downloads    Documentation    Forum    Contact