6 Replies Latest reply on Apr 26, 2006 2:37 PM by Newsgroup_User

    PHP Increase Font

    Level 7
      Okay -

      I recieved a reply from Osgood yesterday and he referenced an article that
      taught a quick, short and clean method of using PHP as a 'style switcher.' I
      tested out the code, and it works great - however, it switches style sheets
      and rather doesn't just increase the font-size by a certain amount of
      pixels, which I've seen a great article using JavaScript do.

      Does anyone know if there is a solution to using PHP to increase the
      font-size up and up (until a *max* point) and also down and down (until a
      *min* point)?

      Again - I've seen JavaScript with the capabilities of this, but I want to
      use a server-side approach with PHP. Here is the article that accomplishes
      what I want in JavaScript:

      http://www.dyn-web.com/dhtml/sizefont/sizerdx.php .

      --
      Shane H
      shane@NOSPAMavenuedesigners.com
      http://www.avenuedesigners.com


        • 1. Re: PHP Increase Font
          Level 7
          Hi Shane,

          I do it... just not with a max/min.

          > Does anyone know if there is a solution to using PHP to increase the
          > font-size up and up (until a *max* point) and also down and down (until a
          > *min* point)?
          >

          --

          kim
          --------------------------
          http://geekministry.com
          • 2. Re: PHP Increase Font
            Level 7
            Kim -

            Do you have a script that you'd be able to share? And if not - do you have a
            reference that has one?

            --
            Shane H
            shane@NOSPAMavenuedesigners.com
            http://www.avenuedesigners.com


            "Kim" <not@this.com> wrote in message
            news:e2o68e$smv$1@forums.macromedia.com...
            > Hi Shane,
            >
            > I do it... just not with a max/min.
            >
            >> Does anyone know if there is a solution to using PHP to increase the
            >> font-size up and up (until a *max* point) and also down and down (until a
            >> *min* point)?
            >>
            >
            > --
            >
            > kim
            > --------------------------
            > http://geekministry.com


            • 3. Re: PHP Increase Font
              Level 7
              My rudimentary knowledge of PHP would do it this way. I'm sure there is a
              better way.

              The link to increase or decrease the font size is in a form that submits to
              the same page, e.g.,

              <form action="<?php $_SERVER['PHP_SELF'] ?>"....

              The field being submitted has a name like 'fontsize'.

              Above the head of the page is a test to block further PHP unless the form
              has been submitted, e.g.,

              <?php

              $multiplier=1; // initialize the value

              if (array_key_exists('submit',$_POST)) {

              $multiplier=($_POST['fontsize']=='Larger'?1.5:0.75);
              // this sets $multiplier to either 1.5 or .75 depending on whether the user
              has selected larger or smaller from a list/menu

              }
              ?>

              Then just above </head>, you have -

              <style type="text/css">
              <!--
              html,body { font-size:<?php echo($multiplier * 100); ?>%; }
              -->
              </style>

              Sorta like this -

              <?php

              $multiplier=1; // initialize the value

              if (array_key_exists('submit',$_POST)) {

              $multiplier=($_POST['fontsize']=='Larger'?1.5:0.75);
              // this sets $multiplier to either 1.5 or .75 depending on whether the user
              has selected larger or smaller from a list/menu

              }
              ?>
              <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
              " http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
              <html xmlns=" http://www.w3.org/1999/xhtml">
              <head>
              <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
              <title>Untitled Document</title>
              <style type="text/css">
              <!--
              html,body { font-size:<?php echo($multiplier * 100); ?>%; }
              -->
              </style>
              </head>

              <body>
              <p>Testing Testing</p>
              <form id="form1" name="form1" method="post" action="<?php
              $_SERVER['PHP_SELF'] ?>">
              <label for="fontsize">Font Size</label>
              <select name="fontsize" id="select">
              <option>Choose Size</option>
              <option>Larger</option>
              <option>Smaller</option>
              </select>
              <input type="submit" name="submit" id="submit" value="Submit" />
              </form>
              <p> </p>
              </body>
              </html>

              --
              Murray --- ICQ 71997575
              Adobe Community Expert
              (If you *MUST* email me, don't LAUGH when you do so!)
              ==================
              http://www.dreamweavermx-templates.com - Template Triage!
              http://www.projectseven.com/go - DW FAQs, Tutorials & Resources
              http://www.dwfaq.com - DW FAQs, Tutorials & Resources
              http://www.macromedia.com/support/search/ - Macromedia (MM) Technotes
              ==================


              "Shane H" <shane@NOSPAMavenuedesigners.com> wrote in message
              news:e2o953$395$1@forums.macromedia.com...
              > Kim -
              >
              > Do you have a script that you'd be able to share? And if not - do you have
              > a reference that has one?
              >
              > --
              > Shane H
              > shane@NOSPAMavenuedesigners.com
              > http://www.avenuedesigners.com
              >
              >
              > "Kim" <not@this.com> wrote in message
              > news:e2o68e$smv$1@forums.macromedia.com...
              >> Hi Shane,
              >>
              >> I do it... just not with a max/min.
              >>
              >>> Does anyone know if there is a solution to using PHP to increase the
              >>> font-size up and up (until a *max* point) and also down and down (until
              >>> a *min* point)?
              >>>
              >>
              >> --
              >>
              >> kim
              >> --------------------------
              >> http://geekministry.com
              >
              >


              • 4. Re: PHP Increase Font
                Level 7
                On reflection, you could simply do something like this -

                html,body { font-size:<?php
                echo(isset($_POST['fontsize'])?$_POST['fontsize']:100); ?>%; }

                and make your select like this -

                <select name="fontsize" id="select">
                <option>Choose Size</option>
                <option value="150">Larger</option>
                <option value="75">Smaller</option>
                </select>

                No need for any of the rest of the PHP stuff.

                --
                Murray --- ICQ 71997575
                Adobe Community Expert
                (If you *MUST* email me, don't LAUGH when you do so!)
                ==================
                http://www.dreamweavermx-templates.com - Template Triage!
                http://www.projectseven.com/go - DW FAQs, Tutorials & Resources
                http://www.dwfaq.com - DW FAQs, Tutorials & Resources
                http://www.macromedia.com/support/search/ - Macromedia (MM) Technotes
                ==================


                "Murray *ACE*" <forums@HAHAgreat-web-sights.com> wrote in message
                news:e2oahs$534$1@forums.macromedia.com...
                > My rudimentary knowledge of PHP would do it this way. I'm sure there is a
                > better way.
                >
                > The link to increase or decrease the font size is in a form that submits
                > to the same page, e.g.,
                >
                > <form action="<?php $_SERVER['PHP_SELF'] ?>"....
                >
                > The field being submitted has a name like 'fontsize'.
                >
                > Above the head of the page is a test to block further PHP unless the form
                > has been submitted, e.g.,
                >


                • 5. Re: PHP Increase Font
                  Level 7
                  Thanks Murray - I would like to do this will <a> links, so the user can
                  click an image and it will increase.

                  --
                  Shane H
                  shane@NOSPAMavenuedesigners.com
                  http://www.avenuedesigners.com


                  "Murray *ACE*" <forums@HAHAgreat-web-sights.com> wrote in message
                  news:e2ocqu$84f$1@forums.macromedia.com...
                  > On reflection, you could simply do something like this -
                  >
                  > html,body { font-size:<?php
                  > echo(isset($_POST['fontsize'])?$_POST['fontsize']:100); ?>%; }
                  >
                  > and make your select like this -
                  >
                  > <select name="fontsize" id="select">
                  > <option>Choose Size</option>
                  > <option value="150">Larger</option>
                  > <option value="75">Smaller</option>
                  > </select>
                  >
                  > No need for any of the rest of the PHP stuff.
                  >
                  > --
                  > Murray --- ICQ 71997575
                  > Adobe Community Expert
                  > (If you *MUST* email me, don't LAUGH when you do so!)
                  > ==================
                  > http://www.dreamweavermx-templates.com - Template Triage!
                  > http://www.projectseven.com/go - DW FAQs, Tutorials & Resources
                  > http://www.dwfaq.com - DW FAQs, Tutorials & Resources
                  > http://www.macromedia.com/support/search/ - Macromedia (MM) Technotes
                  > ==================
                  >
                  >
                  > "Murray *ACE*" <forums@HAHAgreat-web-sights.com> wrote in message
                  > news:e2oahs$534$1@forums.macromedia.com...
                  >> My rudimentary knowledge of PHP would do it this way. I'm sure there is
                  >> a better way.
                  >>
                  >> The link to increase or decrease the font size is in a form that submits
                  >> to the same page, e.g.,
                  >>
                  >> <form action="<?php $_SERVER['PHP_SELF'] ?>"....
                  >>
                  >> The field being submitted has a name like 'fontsize'.
                  >>
                  >> Above the head of the page is a test to block further PHP unless the
                  >> form has been submitted, e.g.,
                  >>
                  >
                  >


                  • 6. Re: PHP Increase Font
                    Level 7
                    html,body { font-size:<?php
                    echo(isset($_GET['fontsize'])?$_GET['fontsize']:100); ?>%; }

                    ...

                    <a href="pagename.php?fontsize=150"><img alt="larger" src="larger.gif"></a>
                    <a href="pagename.php?fontsize=75"><img alt="smaller" src="smaller.gif"></a>


                    --
                    Murray --- ICQ 71997575
                    Adobe Community Expert
                    (If you *MUST* email me, don't LAUGH when you do so!)
                    ==================
                    http://www.dreamweavermx-templates.com - Template Triage!
                    http://www.projectseven.com/go - DW FAQs, Tutorials & Resources
                    http://www.dwfaq.com - DW FAQs, Tutorials & Resources
                    http://www.macromedia.com/support/search/ - Macromedia (MM) Technotes
                    ==================


                    "Shane H" <shane@NOSPAMavenuedesigners.com> wrote in message
                    news:e2ojia$gp5$1@forums.macromedia.com...
                    > Thanks Murray - I would like to do this will <a> links, so the user can
                    > click an image and it will increase.
                    >
                    > --
                    > Shane H
                    > shane@NOSPAMavenuedesigners.com
                    > http://www.avenuedesigners.com
                    >
                    >
                    > "Murray *ACE*" <forums@HAHAgreat-web-sights.com> wrote in message
                    > news:e2ocqu$84f$1@forums.macromedia.com...
                    >> On reflection, you could simply do something like this -
                    >>
                    >> html,body { font-size:<?php
                    >> echo(isset($_POST['fontsize'])?$_POST['fontsize']:100); ?>%; }
                    >>
                    >> and make your select like this -
                    >>
                    >> <select name="fontsize" id="select">
                    >> <option>Choose Size</option>
                    >> <option value="150">Larger</option>
                    >> <option value="75">Smaller</option>
                    >> </select>
                    >>
                    >> No need for any of the rest of the PHP stuff.
                    >>
                    >> --
                    >> Murray --- ICQ 71997575
                    >> Adobe Community Expert
                    >> (If you *MUST* email me, don't LAUGH when you do so!)
                    >> ==================
                    >> http://www.dreamweavermx-templates.com - Template Triage!
                    >> http://www.projectseven.com/go - DW FAQs, Tutorials & Resources
                    >> http://www.dwfaq.com - DW FAQs, Tutorials & Resources
                    >> http://www.macromedia.com/support/search/ - Macromedia (MM) Technotes
                    >> ==================
                    >>
                    >>
                    >> "Murray *ACE*" <forums@HAHAgreat-web-sights.com> wrote in message
                    >> news:e2oahs$534$1@forums.macromedia.com...
                    >>> My rudimentary knowledge of PHP would do it this way. I'm sure there is
                    >>> a better way.
                    >>>
                    >>> The link to increase or decrease the font size is in a form that submits
                    >>> to the same page, e.g.,
                    >>>
                    >>> <form action="<?php $_SERVER['PHP_SELF'] ?>"....
                    >>>
                    >>> The field being submitted has a name like 'fontsize'.
                    >>>
                    >>> Above the head of the page is a test to block further PHP unless the
                    >>> form has been submitted, e.g.,
                    >>>
                    >>
                    >>
                    >
                    >