SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Addict
    Join Date
    Mar 2003
    Location
    Greenville, SC
    Posts
    388
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    changing from PHP_SELF to another file.

    I have the following code:

    PHP Code:
    // SHOW ARCHIVE LINK
     
    if ($usearchives == AND !isset($page)) {
      
    $archivelink "$PHP_SELF?page=archives";
      eval(
    "\$outputarchive = \"$archive\";");
      echo(
    "$outputarchive"); }
    }
    // -------------- DISPLAY ARCHIVE LIST --------------
    if($page == "archives") {
     echo(
    "<div align='left'><img src="../images/new_archives2.gif"></div><P>"); 
     echo(
    "<h5>$text_archives</h5>");
     
    $sql "SELECT UNIX_TIMESTAMP(date) as formatted_date FROM ashnews_news WHERE $catlist GROUP BY YEAR(date), MONTH(date) ORDER BY date DESC";
     
    $sql_result mysql_query($sql$connection) or die ("$text_noquery - 7"); 
     while (
    $row mysql_fetch_array($sql_result)) {
      
    $temp $row['formatted_date'];
      
    $m date("m"$temp); 
      
    $month date("F"$temp);
      
    $year date("Y"$temp);
      
    $archivelink "$PHP_SELF?page=showmonth&m=$m&y=$year";
      eval(
    "\$outputarchivelist = \"$archivelist\";");
      echo(
    "$outputarchivelist"); 

    now I want to be able to use the archives list in a different template other than self. So I created a new php file called archives1.php and changed the following on this code:

    PHP Code:
    $archivelink "archive1.php?page=archives"
    and
    PHP Code:
    $archivelink "archive1.php?page=showmonth&m=$m&y=$year"
    but that doesn't seem to work. I get an internal error message. can somebody help? what code do I use in the archive.php file to grab the variables and display the data?

  2. #2
    The short answer is yes... Herbster's Avatar
    Join Date
    Oct 2001
    Location
    Bay City, Oregon
    Posts
    715
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by jive
    ...now I want to be able to use the archives list in a different template other than self. So I created a new php file called archives1.php and changed the following on this code:
    PHP Code:
    $archivelink "[color=black]archive1.php[/color]?page=archives"
    and
    PHP Code:
    $archivelink "[color=black]archive1.php[/color]?page=showmonth&m=$m&y=$year"
    but that doesn't seem to work. I get an internal error message. can somebody help? what code do I use in the archive.php file to grab the variables and display the data?
    Spelling?
    What is the exact error message?
    PHP Code:
    reset ($HTTP_GET_VARS);
    $page $HTTP_GET_VARS["page"];
    $m$HTTP_GET_VARS["m"];
    $year$HTTP_GET_VARS["y"]; 
    Last edited by Herbster; May 22, 2003 at 21:36.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •