Forum
Tipps
News
Menu-Icon

Ask and Answer Script

Hallo

Ich habe mir von dieser Seitehier mir ein Ask and Answer Script gezogen. Man hat mir dies empfollen weil man es Theoretisch nur einfügen müsse und noch ein bischen das Design ändern.  ;Dalso so etwa meinem Wissen entsprechen.

Auf meinem server hier funktioniert es allerdings nicht ganz. Die Dateiask.php zeigt eine Fehlermeldung, worauf ich nicht weis, was zu tun ist.

Wäre cool wenn Ihr mir helfen würdet, sodass ich dieses eignelti sooooooooo coole Script doch verwenden kann.

Melinda


Antworten zu Ask and Answer Script:

Hat dir diese Antwort geholfen?

Danke ButtonHilfreiche Antwort Button

Hi |

Call to undefined function: gettotalanswered()

...das sagt's ja eigentlich schon: der findet die Funktion nicht. Also entweder ist eine andere Datei nicht richtig inkludiert, oder aber die Methode existiert wirklich nicht. Könnte natürlich auch auf einen simplen Syntax-Error zurückzuführen sein. Also poste mal den Code der Datei ask.php.

greez 8)
JoSsiF

Hier der Code von Ask.php:

 <?php
///////////////////////////////////////////////////////////////////////////////////
//   Wak's Ask&Answer/FAQs Script
//
//   Script by Katie http://luved.org
//
//   This script is linkware and can be used or modified as long as all credit is
//   left attached to this file and a link is placed on your website to
//   http://www.luved.org
//   You are forbidden to sell or distribute this script without permission by
//   it's creator and if a bug is found, report to [email protected]
///////////////////////////////////////////////////////////////////////////////////

// -----------------------------------------------------------------
//   PROCESS QUESTIONS
// -----------------------------------------------------------------
// Below, you can change what response is given when the ASK button is
// pressed
//   Question was successful:
$qSuccess = "<p><b>Your question will be answered as soon as possible.</b></p>";
// Question failed due to double posting:
$qFailed_DoublePost = "<p><b>You can only post a question every $sec seconds.</b></p>";
// Question failed due to a blank post
$qFailed_BlankPost = "<p><b>You can not submit a blank question.</b></p>";

// process questions when button is pressed
if (isSet($_POST['ask'])) {
   $question = $_POST['question'];
   addQuestion($question);
}


// -----------------------------------------------------------------
//   DISPLAYS QUESTIONS AND ANSWERS X Entries Per Page
//
//   Try to read through my comments (any line with a leading //)
//   To customize the script to your liking
// -----------------------------------------------------------------
// Number of all answered questions
$totalAnswered = count(getTotalAnswered());
// Number of all entries in the database (answered and unanswered)
$total = total(DBFILE);
// Number of all unanswered questions
$totalUnAnswered = count(getTotalUnanswered());
// grab data from config.txt file
list($id, $key, $url, $email, $notify, $entryPerPage, $dtFormat, $display) = getFileRow(CONFIGFILE);
// if $entryPerPage is less than 1, set to the default number of entries per page
if ($entryPerPage < 1)
   $entryPerPage = $defaultEntryPerPage;
// --> Status
// display how many answered questions out of total questions asked, how many
// entries per page and the number of unanswered questions in database
echo "<b>$totalAnswered</b> answered questions out of <b>$total</b> asked.<br />";
echo "Now displaying <b>$entryPerPage</b> question/s per page.<br />";
echo "There are currently <b>$totalUnAnswered</b> unanswered question/s.";
?>
<!-- Ask text box:
NOTE: You can copy and paste the following line to a different page eg index.php if you just want to
display the form and not the actual question and answers.
if you place askform.php in its own directory, change the location of askform.php, for example
include('path/to/askform.php')
-->
<?php include('askform.php')?>
<!-- End Ask text box-->

<?php
// -----------------------------------------------------------------
//   DISPLAYS QUESTIONS AND ANSWERS X Entries Per Page
//
//   Try to read through my comments (any line with a leading //)
//   To customize the script to your liking
// -----------------------------------------------------------------
// grabs answered questions into an array
$answeredRows = getTotalAnswered();
if (is_array($answeredRows)) {
   // if user set entries to be displayed in descending order, reverse rows in array
   if ($display == 2) {
      $answeredRows = array_reverse($answeredRows);
   }
   // page number
   $pagenum = $_GET['page'];
   // figures out from entries per page, and how many answered entries in database
   // as to how many pages there should be to display all entries
   $answeredRows = perPage($answeredRows, $entryPerPage, $pagenum);
   $numPages = $answeredRows['numpages'];
   // display 'jump to page' if contains more than one page of entries
   ?>
   <table class="qapost" border="0" width="400" align="center">
      <tr><td align="right"><?php printJumpToPage("$phpSelf?page=", $numPages, $pagenum); ?></td></tr>
   </table>
   <?php
   if (is_array($answeredRows['entries'])) {
      foreach ($answeredRows['entries'] as $ans) {
      // grabs data from each row
      list($id, $q, $a, $ip, $dateAsked, $dateAnswered) = get($ans);?>
      <table class="qapost" border="0" width="400" align="center">
         <tr>
            <td class="td" colspan="2">
            <?php // display Questions?>
            <b>Q.</b> <b title="IP: <?php echo $ip?>"><?php echo convertLinks($q)?></b></td></tr>
         <tr>
            <td colspan="2">
            <?php // display Answers?>
            <b>A.</b> <?php echo convertLinks(fixBrkForHTML($a))?></td></tr>
         <tr>
            <td align="right">
            <?php // date when asked and answered?>
               <small><b>asked:</b> <?php echo dateFormatAdv($dateAsked, $dtFormat)?> <b>answered:</b> <?php echo dateFormatAdv($dateAnswered, $dtFormat)?></small></td></tr>
            </table><br /><br />
   <?php }
   }
   // display 'jump to page' if contains more than one page of entries ?>
   <table class="qapost" border="0" width="400" align="center">
      <tr><td align="right"><?php printJumpToPage("$phpSelf?page=", $numPages, $pagenum); ?></td></tr>
   </table>
   <?php
}
?>
<center>
   <small><a href="http://luved.org" target="_blank">Powered by WakScripts</a></small>
</center>


Hier der Code von Ask.php

<?php
///////////////////////////////////////////////////////////////////////////////////
//   Wak's Ask&Answer/FAQs Script
//
//   Script by Katie http://luved.org
//
//   This script is linkware and can be used or modified as long as all credit is
//   left attached to this file and a link is placed on your website to
//   http://www.luved.org
//   You are forbidden to sell or distribute this script without permission by
//   it's creator and if a bug is found, report to [email protected]
///////////////////////////////////////////////////////////////////////////////////

// -----------------------------------------------------------------
//   PROCESS QUESTIONS
// -----------------------------------------------------------------
// Below, you can change what response is given when the ASK button is
// pressed
//   Question was successful:
$qSuccess = "<p><b>Your question will be answered as soon as possible.</b></p>";
// Question failed due to double posting:
$qFailed_DoublePost = "<p><b>You can only post a question every $sec seconds.</b></p>";
// Question failed due to a blank post
$qFailed_BlankPost = "<p><b>You can not submit a blank question.</b></p>";

// process questions when button is pressed
if (isSet($_POST['ask'])) {
   $question = $_POST['question'];
   addQuestion($question);
}


// -----------------------------------------------------------------
//   DISPLAYS QUESTIONS AND ANSWERS X Entries Per Page
//
//   Try to read through my comments (any line with a leading //)
//   To customize the script to your liking
// -----------------------------------------------------------------
// Number of all answered questions
$totalAnswered = count(getTotalAnswered());
// Number of all entries in the database (answered and unanswered)
$total = total(DBFILE);
// Number of all unanswered questions
$totalUnAnswered = count(getTotalUnanswered());
// grab data from config.txt file
list($id, $key, $url, $email, $notify, $entryPerPage, $dtFormat, $display) = getFileRow(CONFIGFILE);
// if $entryPerPage is less than 1, set to the default number of entries per page
if ($entryPerPage < 1)
   $entryPerPage = $defaultEntryPerPage;
// --> Status
// display how many answered questions out of total questions asked, how many
// entries per page and the number of unanswered questions in database
echo "<b>$totalAnswered</b> answered questions out of <b>$total</b> asked.<br />";
echo "Now displaying <b>$entryPerPage</b> question/s per page.<br />";
echo "There are currently <b>$totalUnAnswered</b> unanswered question/s.";
?>
<!-- Ask text box:
NOTE: You can copy and paste the following line to a different page eg index.php if you just want to
display the form and not the actual question and answers.
if you place askform.php in its own directory, change the location of askform.php, for example
include('path/to/askform.php')
-->
<?php include('askform.php')?>
<!-- End Ask text box-->

<?php
// -----------------------------------------------------------------
//   DISPLAYS QUESTIONS AND ANSWERS X Entries Per Page
//
//   Try to read through my comments (any line with a leading //)
//   To customize the script to your liking
// -----------------------------------------------------------------
// grabs answered questions into an array
$answeredRows = getTotalAnswered();
if (is_array($answeredRows)) {
   // if user set entries to be displayed in descending order, reverse rows in array
   if ($display == 2) {
      $answeredRows = array_reverse($answeredRows);
   }
   // page number
   $pagenum = $_GET['page'];
   // figures out from entries per page, and how many answered entries in database
   // as to how many pages there should be to display all entries
   $answeredRows = perPage($answeredRows, $entryPerPage, $pagenum);
   $numPages = $answeredRows['numpages'];
   // display 'jump to page' if contains more than one page of entries
   ?>
   <table class="qapost" border="0" width="400" align="center">
      <tr><td align="right"><?php printJumpToPage("$phpSelf?page=", $numPages, $pagenum); ?></td></tr>
   </table>
   <?php
   if (is_array($answeredRows['entries'])) {
      foreach ($answeredRows['entries'] as $ans) {
      // grabs data from each row
      list($id, $q, $a, $ip, $dateAsked, $dateAnswered) = get($ans);?>
      <table class="qapost" border="0" width="400" align="center">
         <tr>
            <td class="td" colspan="2">
            <?php // display Questions?>
            <b>Q.</b> <b title="IP: <?php echo $ip?>"><?php echo convertLinks($q)?></b></td></tr>
         <tr>
            <td colspan="2">
            <?php // display Answers?>
            <b>A.</b> <?php echo convertLinks(fixBrkForHTML($a))?></td></tr>
         <tr>
            <td align="right">
            <?php // date when asked and answered?>
               <small><b>asked:</b> <?php echo dateFormatAdv($dateAsked, $dtFormat)?> <b>answered:</b> <?php echo dateFormatAdv($dateAnswered, $dtFormat)?></small></td></tr>
            </table><br /><br />
   <?php }
   }
   // display 'jump to page' if contains more than one page of entries ?>
   <table class="qapost" border="0" width="400" align="center">
      <tr><td align="right"><?php printJumpToPage("$phpSelf?page=", $numPages, $pagenum); ?></td></tr>
   </table>
   <?php
}
?>
<center>
   <small><a href="http://luved.org" target="_blank">Powered by WakScripts</a></small>
</center>




sry mir ist ein kleiner Fehler beim ersten Posten unterlofen.

Hat dir diese Antwort geholfen?

Danke ButtonHilfreiche Antwort Button

Tja was soll man sagen... die Funktion gettotalanswered() ist schlicht und ergreifend nicht vorhanden. Das Skript asform.php scheint richtig inkludiert zu werden, also wird die Funktion da nicht drinstehen.

Vielleicht nochmal genau dort nachgucken, wo du das Skript gezogen hast :)

greez 8)
JoSsiF


« Weiterleitung wenn Java nicht installiert/erlaubt ist?Suche Projektmanager »
 

Schnelle Hilfe: Hier nach ähnlichen Fragen und passenden Tipps suchen!

Fremdwörter? Erklärungen im Lexikon!
AppleScript
AppleScript ist eine Programmiersprache von Apple für Skripte und Programme auf Systemebene. Im Gegensatz zu den Unix-Shellscripts, die seit OS X ebenfalls mögl...

Javascript
JavaScript ist eine weit verbreitete Skriptsprache, die ursprünglich von Netscape für das DOM-Scripting für Webseiten entwickelt wurde. Sie hat sich seitde...

PostScript
PostScript ist eine Programmiersprache zur Beschreibung von grafischen Objekten und Schriftzeichen zur Übertragung vom Computer zum Drucker oder Laserbelichter. Gene...