Topic: [Resolved!] Separate Archive page

Hi Zachary,

Is there a way to obtain a separate page with the archives rather than a dropdown menu ? Say, a link on the Index.php that leads to the Archive ? On the Archive page it would be nice to have clickable thumbnails of each comic.

Do you think there's a piece of code that you could spare for  me ?

Many thanks.

Best Regards.
Westend.

Re: [Resolved!] Separate Archive page

You can create a page called "archive.php", and just use the archive function in the functions.php file to populate that page.

Re: [Resolved!] Separate Archive page

Ok Zachary, thanks. Will give it a try.

Re: [Resolved!] Separate Archive page

Zachary,
I'm surely real dumb but I didn't make it work. I created archive.php, copy/pasted the archive function from functions.php (lines 282 thru 303), added <?php at start  of the code and ended with ?> but it didn't work.

Re: [Resolved!] Separate Archive page

Here's a quick solution I created.

Create a new file called archive.php (like you did). The only code you need is:

<?php include("admin/system/engine.php"); ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
  <head>
    <meta http-equiv="content-type" content="text/html; charset=windows-1250" />
    <title><?php echo $website; ?></title>
  </head>
  <body>
    <h1 id="header"><?php echo $website; ?>: Archive</h1>
    <ul>
    <?php archivePage(); ?>
    </ul>
  </body>
</html>

That gives you a bare-bones page with your archive. Now, for the archivePage function to work, you'll need to add the following function in /system/functions.php:

function archivePage($title="---Archive---", $output="<li>%</li>",$type="title",$dtype="d/m/Y")
{
    //Put this in your page to create a list.
    global $total,$arow,$prefix,$p,$settings,$PHP_SELF;
    if ($settings['archive'] != "0") { $limit = " LIMIT ".$settings['archive']; }
    $result = mysql_query("SELECT * FROM ".$prefix."comics WHERE status = '1' ORDER BY id DESC$limit");
    while($row=mysql_fetch_object($result)) {
        $more = "<a href='/?p=".$row->id."&c=1'>".strtolower(debbcode($row->title))."</a>";
        $info=eregi_replace("\%",$more,$output);
        echo $info;
    }
    if (!$result) echo "empty";
}

You can see a working copy here:

http://sctest.mostpopularcomic.com/archive.php

Re: [Resolved!] Separate Archive page

Zachary, many thanks !