I would like to alter the archive function of the SomeryC webcomic script (http://someryc.jackofallblades.com/) but simply don't know enough about php to do so.

All I want is for the archive function to populate an unordered list of consecutively numbered entries, each linking back to my comic.php page and displaying the relevant comic jpg on there. As it stands, the function creates a javascript drop down menu. Here's the code:

function dropArchive($title="Archive", $output="%",$type="title",$dtype="d/m/Y") {
	global $total,$arow,$prefix,$p,$settings,$PHP_SELF;
	if ($settings['archive'] != "0") { $limit = " LIMIT ".$settings['archive']; }
	echo "<script language='JavaScript'>
		<!--
	   	function gotoSite(obj) {
			var s;
          		s=obj.options[obj.selectedIndex].value
         		location.href=s;
		}
		// -->
		</script>
		<select name='Archive' size='1' language='JavaScript' onchange='gotoSite(this)'><option value='comic.php'>".$title."</option><option></option>";
		$result = mysql_query("SELECT * FROM ".$prefix."comics WHERE status = '1' ORDER BY id DESC$limit");
		while($row=mysql_fetch_object($result)) {
			echo "<option value='".$PHP_SELF."?p=".$row->id."'>".debbcode($row->title)."</option>";
			$info=eregi_replace("\%",$more,$output);
			echo $info;
		}
	echo "</select>";
}

The reason I want to make this change is because I've opted for an archive.php page which is going to house all my comic page links, grouped into the related chapters. Preferably, I would be able to just include the new archive function into my chapter boxes, and watch them fill up as more comic pages are uploaded.

Any help at all would be great. Thanks.

    How's about:

    function dropArchive($title='Archive', $output='%', $type='title', $dtype='d/m/Y') {
      global $total, $arow, $p, $settings, $PHP_SELF;
    
      if($settings['archive'] != '0') { $limit = " LIMIT ".$settings['archive']; }
    
      echo '<ul>';
    
      $result = mysql_query("SELECT * FROM ".$prefix."comics WHERE status='1' ORDER BY id ASC".$limit);
      while($row = mysql_fetch_assoc($result)) {
        echo '<li><a href="'.$PHP_SELF.'?p='.$row['id'].'">'.$debbcode($row['title']).'</a></li>';
        // $info = eregi_replace("\%", $more, $output);
        // echo $info;
      }
      echo '</ul>';
    }

      Hrm. I tried adding that function to my archive page and then calling it in one of my chapter boxes, and go the following error message:

      Warning: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) in withershins/archives.php on line 40

      Warning: MySQL Connection Failed: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) in /usr/www/users/jmb/phozon/withershins/archives.php on line 40

      Warning: MySQL: A link to the server could not be established in /archives.php on line 40

      Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in /withershins/archives.php on line 41

        Seems like you're having issues connecting to mySQL. That's a seperate issue. For whatever reason, the socket you're using isn't working. Try googling for a solution to the mySQL issue.

          Right, I'll look into that. Thank you very much for your help here, I really appreciate it.

            Write a Reply...