Quick way to generate links?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • laredotornado@zipmail.com

    Quick way to generate links?

    Hi,

    Using PHP 4.4.4, do any of you have a quick way to generate a list of
    alphabetical links that link to <a name=""sections on my page? The
    desired HTML would look like

    <a href="A">A</a>&nbsp;
    <a href="B">B</a>&nbsp;
    ....
    <a href="#Z">Z</a>

    Figured someone out there had a slick way to generate these.

    Thanks, - Dave

  • Mateusz Markowski

    #2
    Re: Quick way to generate links?


    laredotornado@z ipmail.com napisal(a):
    Hi,
    >
    Using PHP 4.4.4, do any of you have a quick way to generate a list of
    alphabetical links that link to <a name=""sections on my page? The
    desired HTML would look like
    >
    <a href="A">A</a>&nbsp;
    <a href="B">B</a>&nbsp;
    ...
    <a href="#Z">Z</a>
    >
    Figured someone out there had a slick way to generate these.
    for ($i=65;$i<=90;$ i++)
    echo "<a href=\"".chr($i )."\">".chr($i) ."</a>&nbsp;";

    Comment

    • Kim André Akerø

      #3
      Re: Quick way to generate links?

      laredotornado@z ipmail.com wrote:
      Hi,
      >
      Using PHP 4.4.4, do any of you have a quick way to generate a list of
      alphabetical links that link to <a name=""sections on my page? The
      desired HTML would look like
      >
      <a href="A">A</a>&nbsp;
      <a href="B">B</a>&nbsp;
      ...
      <a href="#Z">Z</a>
      >
      Figured someone out there had a slick way to generate these.
      Here's a way to do it:

      foreach(range(" A","Z") as $i)
      echo "<a href=\"#".$i."\ ">".$i."</a>&nbsp;";

      --
      Kim André Akerø
      - kimandre@NOSPAM betadome.com
      (remove NOSPAM to contact me directly)

      Comment

      Working...