Seiten in Forum einfügen
Verfasst: 02.04.2010 11:42
Hallo,
Ich habe mir mit dem Tool PHPMaker eine Formularseite erstellt. Jetzt will ich diese in das Forum intigrieren.
Diesen Link kenne ich schon: http://wiki.phpbb.com/Deutsch:Vorlage_f ... ene_Seiten
Mein Problem ist aber das die von PHPMaker erstellten Dateien alle .php sind und so aussehen.
Ich will aber mit z.b. <!-- IF not S_USER_LOGGED_IN or S_IS_BOT --> einige Dinge ausgrenzen, es soll dabei stehen welcher User den Datensatz erstellt hat und es soll automatisch ein Beitrag im Forum erstellt werden wenn ein neuer Datensatz erstellt wurde.
Ist das mit solchen Dateien möglich? Oder muß es .html Dateien im Template Ordner geben?
Gruss
Steffen
Ich habe mir mit dem Tool PHPMaker eine Formularseite erstellt. Jetzt will ich diese in das Forum intigrieren.
Diesen Link kenne ich schon: http://wiki.phpbb.com/Deutsch:Vorlage_f ... ene_Seiten
Mein Problem ist aber das die von PHPMaker erstellten Dateien alle .php sind und so aussehen.
Code: Alles auswählen
<?php
session_start(); // Initialize Session data
ob_start(); // Turn on output buffering
?>
<?php include "ewcfg7.php" ?>
<?php include "ewmysql7.php" ?>
<?php include "phpfn7.php" ?>
<?php include "dropnationinfo.php" ?>
<?php include "userfn7.php" ?>
<?php
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); // Always modified
header("Cache-Control: private, no-store, no-cache, must-revalidate"); // HTTP/1.1
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache"); // HTTP/1.0
?>
<?php
// Create page object
$dropnation_addopt = new cdropnation_addopt();
$Page =& $dropnation_addopt;
// Page init
$dropnation_addopt->Page_Init();
// Page main
$dropnation_addopt->Page_Main();
?>
<script type="text/javascript">
<!--
var dropnation_addopt = new ew_Page("dropnation_addopt");
// page properties
dropnation_addopt.PageID = "addopt"; // page ID
dropnation_addopt.FormID = "fdropnationaddopt"; // form ID
var EW_PAGE_ID = dropnation_addopt.PageID; // for backward compatibility
// extend page with ValidateForm function
dropnation_addopt.ValidateForm = function(fobj) {
return true; // ignore validation
}
//-->
</script>
<?php
if (EW_DEBUG_ENABLED)
echo ew_DebugMsg();
$dropnation_addopt->ShowMessage();
?>
<form name="fdropnationaddopt" id="fdropnationaddopt" action="dropnationaddopt.php" method="post" onsubmit="return dropnation_addopt.ValidateForm(this);">
<p>
<input type="hidden" name="t" id="t" value="dropnation">
<input type="hidden" name="a_addopt" id="a_addopt" value="A">
<table class="ewTableAddOpt">
<tr>
<td><?php echo $dropnation->nation->FldCaption() ?></td>
<td><span id="el_nation">
<input type="text" name="x_nation" id="x_nation" title="<?php echo $dropnation->nation->FldTitle() ?>" size="30" maxlength="50" value="<?php echo $dropnation->nation->EditValue ?>"<?php echo $dropnation->nation->EditAttributes() ?>>
</span></td>
</tr>
</table>
<p>
</form>
<?php
$dropnation_addopt->Page_Terminate();
?>
<?php
//
// Page class
//
class cdropnation_addopt {
// Page ID
var $PageID = 'addopt';
// Table name
var $TableName = 'dropnation';
// Page object name
var $PageObjName = 'dropnation_addopt';
// Page name
function PageName() {
return ew_CurrentPage();
}
// Page URL
function PageUrl() {
$PageUrl = ew_CurrentPage() . "?";
global $dropnation;
if ($dropnation->UseTokenInUrl) $PageUrl .= "t=" . $dropnation->TableVar . "&"; // Add page token
return $PageUrl;
}
// Page URLs
var $AddUrl;
var $EditUrl;
var $CopyUrl;
var $DeleteUrl;
var $ViewUrl;
var $ListUrl;
// Export URLs
var $ExportPrintUrl;
var $ExportHtmlUrl;
var $ExportExcelUrl;
var $ExportWordUrl;
var $ExportXmlUrl;
var $ExportCsvUrl;
// Update URLs
var $InlineAddUrl;
var $InlineCopyUrl;
var $InlineEditUrl;
var $GridAddUrl;
var $GridEditUrl;
var $MultiDeleteUrl;
var $MultiUpdateUrl;
// Message
function getMessage() {
return @$_SESSION[EW_SESSION_MESSAGE];
}
function setMessage($v) {
if (@$_SESSION[EW_SESSION_MESSAGE] <> "") { // Append
$_SESSION[EW_SESSION_MESSAGE] .= "<br>" . $v;
} else {
$_SESSION[EW_SESSION_MESSAGE] = $v;
}
}
// Show message
function ShowMessage() {
$sMessage = $this->getMessage();
$this->Message_Showing($sMessage);
if ($sMessage <> "") { // Message in Session, display
echo "<p><span class=\"ewMessage\">" . $sMessage . "</span></p>";
$_SESSION[EW_SESSION_MESSAGE] = ""; // Clear message in Session
}
}
// Validate page request
function IsPageRequest() {
global $objForm, $dropnation;
if ($dropnation->UseTokenInUrl) {
if ($objForm)
return ($dropnation->TableVar == $objForm->GetValue("t"));
if (@$_GET["t"] <> "")
return ($dropnation->TableVar == $_GET["t"]);
} else {
return TRUE;
}
}
//
// Page class constructor
//
function cdropnation_addopt() {
global $conn, $Language;
// Language object
$Language = new cLanguage();
// Table object (dropnation)
$GLOBALS["dropnation"] = new cdropnation();
// Page ID
if (!defined("EW_PAGE_ID"))
define("EW_PAGE_ID", 'addopt', TRUE);
// Table name (for backward compatibility)
if (!defined("EW_TABLE_NAME"))
define("EW_TABLE_NAME", 'dropnation', TRUE);
// Start timer
$GLOBALS["gsTimer"] = new cTimer();
// Open connection
$conn = ew_Connect();
}
//
// Page_Init
//
function Page_Init() {
global $gsExport, $gsExportFile, $UserProfile, $Language, $Security, $objForm;
global $dropnation;
// Create form object
$objForm = new cFormObj();
// Global Page Loading event (in userfn*.php)
Page_Loading();
// Page Load event
$this->Page_Load();
}
//
// Page_Terminate
//
function Page_Terminate($url = "") {
global $conn;
// Page Unload event
$this->Page_Unload();
// Global Page Unloaded event (in userfn*.php)
Page_Unloaded();
// Close connection
$conn->Close();
// Go to URL if specified
$this->Page_Redirecting($url);
if ($url <> "") {
if (!EW_DEBUG_ENABLED && ob_get_length())
ob_end_clean();
header("Location: " . $url);
}
exit();
}
//
// Page main
//
function Page_Main() {
global $objForm, $Language, $gsFormError, $dropnation;
// Process form if post back
if ($objForm->GetValue("a_addopt") <> "") {
$dropnation->CurrentAction = $objForm->GetValue("a_addopt"); // Get form action
$this->LoadFormValues(); // Load form values
// Validate form
if (!$this->ValidateForm()) {
$dropnation->CurrentAction = "I"; // Form error, reset action
$this->setMessage($gsFormError);
}
} else { // Not post back
$dropnation->CurrentAction = "I"; // Display blank record
$this->LoadDefaultValues(); // Load default values
}
// Perform action based on action code
switch ($dropnation->CurrentAction) {
case "I": // Blank record, no action required
break;
case "A": // Add new record
$dropnation->SendEmail = TRUE; // Send email on add success
if ($this->AddRow()) { // Add successful
$XMLDoc = new cXMLDocument("utf-8");
$XMLDoc->AddRoot("root");
$XMLDoc->AddRow("result");
$XMLDoc->AddField("x_id", strval($dropnation->id->DbValue));
$XMLDoc->AddField("x_nation", strval($dropnation->nation->FormValue));
header("Content-Type: text/xml");
echo $XMLDoc->XML();
$this->Page_Terminate();
exit();
} else {
$this->RestoreFormValues(); // Add failed, restore form values
}
}
// Render row
$dropnation->RowType = EW_ROWTYPE_ADD; // Render add type
$this->RenderRow();
}
// Get upload files
function GetUploadFiles() {
global $objForm, $dropnation;
// Get upload data
}
// Load default values
function LoadDefaultValues() {
global $dropnation;
}
// Load form values
function LoadFormValues() {
// Load from form
global $objForm, $dropnation;
$dropnation->nation->setFormValue(ew_ConvertFromUtf8($objForm->GetValue("x_nation")));
$dropnation->id->setFormValue(ew_ConvertFromUtf8($objForm->GetValue("x_id")));
}
// Restore form values
function RestoreFormValues() {
global $objForm, $dropnation;
$dropnation->id->CurrentValue = ew_ConvertToUtf8($dropnation->id->FormValue);
$dropnation->nation->CurrentValue = ew_ConvertToUtf8($dropnation->nation->FormValue);
}
// Load row based on key values
function LoadRow() {
global $conn, $Security, $dropnation;
$sFilter = $dropnation->KeyFilter();
// Call Row Selecting event
$dropnation->Row_Selecting($sFilter);
// Load SQL based on filter
$dropnation->CurrentFilter = $sFilter;
$sSql = $dropnation->SQL();
$res = FALSE;
$rs = ew_LoadRecordset($sSql);
if ($rs && !$rs->EOF) {
$res = TRUE;
$this->LoadRowValues($rs); // Load row values
// Call Row Selected event
$dropnation->Row_Selected($rs);
$rs->Close();
}
return $res;
}
// Load row values from recordset
function LoadRowValues(&$rs) {
global $conn, $dropnation;
$dropnation->id->setDbValue($rs->fields('id'));
$dropnation->nation->setDbValue($rs->fields('nation'));
}
// Render row values based on field settings
function RenderRow() {
global $conn, $Security, $Language, $dropnation;
// Initialize URLs
// Call Row_Rendering event
$dropnation->Row_Rendering();
// Common render codes for all row types
// nation
$dropnation->nation->CellCssStyle = ""; $dropnation->nation->CellCssClass = "";
$dropnation->nation->CellAttrs = array(); $dropnation->nation->ViewAttrs = array(); $dropnation->nation->EditAttrs = array();
if ($dropnation->RowType == EW_ROWTYPE_VIEW) { // View row
// id
$dropnation->id->ViewValue = $dropnation->id->CurrentValue;
$dropnation->id->CssStyle = "";
$dropnation->id->CssClass = "";
$dropnation->id->ViewCustomAttributes = "";
// nation
$dropnation->nation->ViewValue = $dropnation->nation->CurrentValue;
$dropnation->nation->CssStyle = "";
$dropnation->nation->CssClass = "";
$dropnation->nation->ViewCustomAttributes = "";
// nation
$dropnation->nation->HrefValue = "";
$dropnation->nation->TooltipValue = "";
} elseif ($dropnation->RowType == EW_ROWTYPE_ADD) { // Add row
// nation
$dropnation->nation->EditCustomAttributes = "";
$dropnation->nation->EditValue = ew_HtmlEncode($dropnation->nation->CurrentValue);
}
// Call Row Rendered event
if ($dropnation->RowType <> EW_ROWTYPE_AGGREGATEINIT)
$dropnation->Row_Rendered();
}
// Validate form
function ValidateForm() {
global $Language, $gsFormError, $dropnation;
// Initialize form error message
$gsFormError = "";
// Return validate result
$ValidateForm = ($gsFormError == "");
// Call Form_CustomValidate event
$sFormCustomError = "";
$ValidateForm = $ValidateForm && $this->Form_CustomValidate($sFormCustomError);
if ($sFormCustomError <> "") {
$gsFormError .= ($gsFormError <> "") ? "<br>" : "";
$gsFormError .= $sFormCustomError;
}
return $ValidateForm;
}
// Add record
function AddRow() {
global $conn, $Language, $Security, $dropnation;
$rsnew = array();
// nation
$dropnation->nation->SetDbValueDef($rsnew, $dropnation->nation->CurrentValue, NULL, FALSE);
// Call Row Inserting event
$bInsertRow = $dropnation->Row_Inserting($rsnew);
if ($bInsertRow) {
$conn->raiseErrorFn = 'ew_ErrorFn';
$AddRow = $conn->Execute($dropnation->InsertSQL($rsnew));
$conn->raiseErrorFn = '';
} else {
if ($dropnation->CancelMessage <> "") {
$this->setMessage($dropnation->CancelMessage);
$dropnation->CancelMessage = "";
} else {
$this->setMessage($Language->Phrase("InsertCancelled"));
}
$AddRow = FALSE;
}
if ($AddRow) {
$dropnation->id->setDbValue($conn->Insert_ID());
$rsnew['id'] = $dropnation->id->DbValue;
// Call Row Inserted event
$dropnation->Row_Inserted($rsnew);
}
return $AddRow;
}
// Page Load event
function Page_Load() {
//echo "Page Load";
}
// Page Unload event
function Page_Unload() {
//echo "Page Unload";
}
// Page Redirecting event
function Page_Redirecting(&$url) {
// Example:
//$url = "your URL";
}
// Message Showing event
function Message_Showing(&$msg) {
// Example:
//$msg = "your new message";
}
// Custom validate event
// Form Custom Validate event
function Form_CustomValidate(&$CustomError) {
// Return error message in CustomError
return TRUE;
}
}
?>
Ich will aber mit z.b. <!-- IF not S_USER_LOGGED_IN or S_IS_BOT --> einige Dinge ausgrenzen, es soll dabei stehen welcher User den Datensatz erstellt hat und es soll automatisch ein Beitrag im Forum erstellt werden wenn ein neuer Datensatz erstellt wurde.
Ist das mit solchen Dateien möglich? Oder muß es .html Dateien im Template Ordner geben?
Gruss
Steffen