- some important changes to our theme API which can be summerized as:

abstract() + article() = story()

  abstract() and article() have been merged into a new function story()
  which looks like:

  function story($story_object, $reply) {
    if (!reply) {
       // full story
    }
    else {
       // main page version / abstract
    }
  }

  This should allow you to "compress" your theme as abstract() and
  article() tended to be 98% identical.

  => I didn't really merge your themes so I leave it up to *you* to
     improved the code!!! Do it ASAP as we release drupal 2.00 in 7
     days.

  In future we'll have similar functions for other content types as
  for example:

     review($review, $reply);
     enquete($enquete, $reply);
     ...
3-00
Dries Buytaert 2001-03-08 08:16:23 +00:00
parent f516626a29
commit 3958a714cd
9 changed files with 127 additions and 125 deletions

View File

@ -59,7 +59,7 @@ function comment_reply($pid, $id) {
$pid = 0;
if ($link == "story") {
$item = db_fetch_object(db_query("SELECT stories.*, users.userid FROM stories LEFT JOIN users ON stories.author = users.id WHERE stories.status != 0 AND stories.id = '$id'"));
$theme->article($item, "");
$theme->story($item, "");
}
}

View File

@ -11,7 +11,7 @@ $result = db_query("SELECT stories.*, users.userid, COUNT(comments.lid) AS comme
// Display stories:
$theme->header();
while ($story = db_fetch_object($result)) $theme->abstract($story);
while ($story = db_fetch_object($result)) $theme->story($story);
$theme->footer();
?>

View File

@ -247,7 +247,7 @@ function documentation() {
$theme->header();
// displays the header of a page
for each $article to be displayed {
$theme->article($article);
$theme->story($story);
// displays a themed article or story
}
$theme->footer();

View File

@ -101,7 +101,7 @@ function submission_display_item($id) {
$output .= "</FORM>\n";
$theme->header();
$theme->article($submission, "[ <A HREF=\"module.php?mod=submission\"><FONT COLOR=\"$theme->link\">back</FONT></A> ]");
$theme->story($submission, "[ <A HREF=\"module.php?mod=submission\"><FONT COLOR=\"$theme->link\">back</FONT></A> ]");
$theme->box(t("Moderate story"), $output);
$theme->footer();
}

View File

@ -9,7 +9,7 @@ function story_render($id, $cid) {
$story = db_fetch_object(db_query("SELECT s.*, u.userid FROM stories s LEFT JOIN users u ON s.author = u.id WHERE s.id = '$id'"));
if (story_visible($story)) {
$theme->article($story, "[ <A HREF=\"story.php?op=reply&id=$id&pid=0\">". t("reply to this story") ."</A> ]");
$theme->story($story, "[ <A HREF=\"story.php?op=reply&id=$id&pid=0\">". t("reply to this story") ."</A> ]");
comment_render($id, $cid);
}
else {

View File

@ -87,7 +87,7 @@ function submit_preview($subject, $abstract, $article, $section) {
$output .= "</FORM>\n";
$theme->header();
$theme->article(new Story($user->userid, $subject, $abstract, $article, $section, time()));
$theme->story(new Story($user->userid, $subject, $abstract, $article, $section, time()));
$theme->box(t("Submit a story"), $output);
$theme->footer();
}

View File

@ -73,7 +73,8 @@
} // close header function
function abstract($story) {
function story($story, $reply = 0) {
if (!$reply) {
$timestamp = format_date($story->timestamp);
?>
@ -147,10 +148,9 @@
<BR>
<?PHP
}
else {
} // close abstract function
function article($story, $reply) {
$timestamp = format_date($story->timestamp);
?>
@ -237,8 +237,8 @@
<BR>
<?PHP
} // close article function
}
} // close story function
function controls() {
echo comment_controls();

View File

@ -36,7 +36,8 @@
<?
}
function abstract($story) {
function story($story, $reply = 0) {
if (!$reply) {
print "\n<!-- story: \"$story->subject\" -->\n";
print "<TABLE BORDER=\"0\" CELLPADDING=\"0\" CELLSPACING=\"2\" WIDTH=\"100%\">\n";
print " <TR><TD COLSPAN=\"2\"><IMG SRC=\"themes/marvin/images/drop.gif\" ALT=\"\"> &nbsp; <B>". check_output($story->subject) ."</B></TD></TR>\n";
@ -58,8 +59,7 @@
print "</TABLE>\n";
print "<BR><BR>\n\n";
}
function article($story, $reply = "") {
else {
print "\n<!-- story: \"$story->subject\" -->\n";
print "<TABLE BORDER=\"0\" CELLPADDING=\"0\" CELLSPACING=\"2\" WIDTH=\"100%\">\n";
print " <TR><TD COLSPAN=\"2\"><IMG SRC=\"themes/marvin/images/drop.gif\" ALT=\"\"> &nbsp; <B>". check_output($story->subject) ."</B></TD></TR>\n";
@ -78,6 +78,7 @@
print "</TABLE>\n";
print "<BR><BR>\n\n";
}
}
function controls() {
print "<TABLE BORDER=\"0\" CELLPADDING=\"0\" CELLSPACING=\"0\">\n";

View File

@ -69,7 +69,8 @@
<?
}
function abstract($story) {
function story($story, $reply = 0) {
if (!$reply) {
$timestamp = format_date($story->timestamp);
print "\n<!-- story: \"$story->subject\" -->\n";
@ -104,8 +105,7 @@
</TABLE></TD></TR></TABLE><BR>
<?
}
function article($story, $reply = "") {
else {
$timestamp = format_date($story->timestamp);
?>
@ -138,6 +138,7 @@
</TABLE></TD></TR></TABLE><BR>
<?
}
}
function controls() {
print "<HR>";