Streamlining search engine

Discussion in 'Web Design and Development' started by Mal, Apr 23, 2007.

  1. Mal macrumors 603

    Mal

    Joined:
    Jan 6, 2002
    Location:
    Orlando
    #1
    I am creating a simple search engine on my site, and I'd like to streamline the display, since it's kinda ugly now. I was working from a template given to me by my instructor, and currently it simply says "Your query is found in File #" with the words "File #" being the link. I'd rather have it say something like "Your query is found in the following files:" then list the files below it.

    Here's the PHP code used right now:
    Code:
    print("<p>Your query is found in <a href=".$all_pages[$i].">"."File ".$i."</a>");
    Basically what I would need to do is use the value of $all_pages[$i] instead of simply using the number $i. How would I recall the value of that element in the array? I'm fairly new to PHP, and I can't find it in any of the searches I've used so far.

    jW
     
  2. Winterfell macrumors regular

    Joined:
    Apr 3, 2007
    Location:
    Tulsa, Oklahoma
    #2
    You'd do it the same way that the link references the file.

    PHP:
    <?php
    print("<p>Your query is found in <a href=\"".$all_pages[$i]."\">"."File ".$all_pages[$i]."</a>");
    ?>
    $all_pages is the array, and $i is the element. So if you want the value in that element of the array, all you need to do is print $all_pages[$i].
     

Share This Page