Web Analytics Made Easy -
StatCounter php NOVICE - Wanna change my link names - CodingForum

Announcement

Collapse
No announcement yet.

php NOVICE - Wanna change my link names

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • php NOVICE - Wanna change my link names

    Hi all,

    I have implemented a rather cool flash mp3 player on a page of my site that generates playlists from php code I embedded in my HTML.

    It's my personal test server which has a SLOW upload speed, so don't even bother playing anything as it would take a month...

    Here's the page.

    At any rate... See the playlist links? They're fine and everything, but I would like to know how to change their names so that instead of basically linking the filenames, could I have them say "Hard Rock Playlist", etc? It's just gotta be possible, but damned if I know how to do it.

    Here's the relevant code (I think this is all you'll need at least)
    PHP Code:
    // insert your playlists into this array ! 
    $playlists = array("hardrockplaylist.php","lightrockplaylist.php","classicrockplaylist.php","pophiphopplaylist.php","bluesjazzplaylist.php");

    // getting current list from the post data 
    if($_GET) { extract($_GETEXTR_PREFIX_SAME"post_"); }

    // setting $file if none is found 
    if(!$list) { $list 0; }

    ?> 
    and later in the HTML file...
    PHP Code:
                    <?php
    // inserting the links for the various files 
    for ($i=0$i<sizeof($playlists); $i++) {   
        echo 
    " &raquo; <a href=\"".$PHP_SELF."?list=$i\">".$playlists[$i]."</a><br/>"
    }
    ?>
    Can what I want be done, and if so, how?

    Thanks a million!

    Chris
    My Site | My Blog

  • #2
    Solved with a new array
    PHP Code:
    // insert your playlists into this array ! 
    $playlists = array("hardrockplaylist.php","lightrockplaylist.php","classicrockplaylist.php","pophiphopplaylist.php","bluesjazzplaylist.php");
    $playlistnames = array("Hard Rock","Light Rock","Classic Rock","Pop/Hip-hop","Blues/Jazz"); 

    // getting current list from the post data 
    if($_GET) { extract($_GETEXTR_PREFIX_SAME"post_"); } 

    // setting $file if none is found 
    if(!$list) { $list 0; } 

    ?> 
    And later...
    PHP Code:
    <?php 
    // inserting the links for the various files 
    for ($i=0$i<sizeof($playlists); $i++) {    
        echo 
    " &raquo; <a href=\"".$PHP_SELF."?list=$i\">".$playlistnames[$i]."</a><br/>"

    ?>
    My Site | My Blog

    Comment


    • #3
      $_GET is always set. It may be an empty array but it's always set. This also applies to other superglobals.
      I'm not sure if this was any help, but I hope it didn't make you stupider.

      Experience is something you get just after you really need it.
      PHP Installation Guide Feedback welcome.

      Comment

      Working...
      X