PHP Classes

File: updatesite-simple-preview.i.php

Recommend this page to a friend!
  Classes of Barton Phillips   Update Site   updatesite-simple-preview.i.php   Download  
File: updatesite-simple-preview.i.php
Role: Example script
Content type: text/plain
Description: Example script
Class: Update Site
Create Web site pages from database content
Author: By
Last change:
Date: 7 years ago
Size: 2,384 bytes


Class file image Download
// This is included by the program instantiating the UpdateSite class via updatesite.class.php
// This is simple preview without any AJAX. It does not pull in the target page at all.

// This file is included in the site specific updatesite2.php (or whatever it is called -- the second part of the site specific
// pair of files).
// This function is then called from updatesite.class.php (UpdateSite class) 'previewpage' function. 'previewpage' check to see
// that the function exists. If it does not exist then a message is presented and the user is given the option to proceed to the
// post page without a preview option.
// If this function does exist it is passed the "$this" of the UpdateSite class, the id of the item, the page name, itemname, and
// the title and bodytext text.
// This simple version just displayes the title and the bodytext in HTML.

function updatesite_preview($classthis, $id, $page, $itemname, $title, $bodytext) {
$title = str_replace("\\", "", $title);
$bodytext = str_replace("\\", "", $bodytext);
$u_title = urlencode($title);
$u_bodytext = urlencode($bodytext);
$self = $classthis->self;
  echo <<<EOF
<div style="border: 1px solid black; padding: 5px;">
<h2>Body Text</h2>
<div style="border: 1px solid black; padding: 5px;">
<form action="
$self" method="post">
<input type="hidden" name="title" value="
<input type="hidden" name="bodytext" value="
<input type="hidden" name="id" value="
{$id}" />
<input type="hidden" name="page" value="Post"/>
<input type="hidden" name="pagename" value="
<input type="hidden" name="itemname" value="
<button id="subButton">Create Article</button>
&nbsp;<button id="reset">Discard and return to editor panel</button>

<script type="text/javascript">
jQuery(document).ready(function($) {
  $("#reset").click(function() {
    $("form input[name=page]").val("reedit");

  $("#subButton").click(function() {

<style type="text/css">
#subButton {
  font-size: 1.5em;
  background-color: green;
  color: white;
  padding: 20px;
#reset {
  font-size: 1.5em;
  background-color: red;
  color: white;
  padding: 20px;