コード例 #1
0
ファイル: blog.php プロジェクト: smithnikki/blog_project
<?php

include_once "models/Blog_Entry_Table.class.php";
$entryTable = new Blog_Entry_Table($db);
$isEntryClicked = isset($_GET['id']);
if ($isEntryClicked) {
    $entryId = $_GET['id'];
    $entryData = $entryTable->getEntry($entryId);
    $blogOutput = (include_once "views/entry-html.php");
    $blogOutput .= (include_once "controllers/comments.php");
} else {
    $entries = $entryTable->getAllEntries();
    $blogOutput = (include_once "views/list-entries-html.php");
}
//$entries = $entryTable->getAllEntries();
//$blogOutput = include_once "views/list-entries-html.php";
return $blogOutput;
コード例 #2
0
ファイル: editor.php プロジェクト: normdus/blog
<?php

/*
**
**	controllers/admin/editor.php
**	models/Blog_Entry_Table.class.php
**  views/admin/editor-html.php
**
**	9/13/15 - PG 152 - XXXXXXX
**
**	$entryTable is an [Instance Object] of Blog_Entry_Table [Class]  
**  $object->method or ->property
*/
include_once "models/Blog_Entry_Table.class.php";
$entryTable = new Blog_Entry_Table($db);
// process admin editor form - TWO buttons
$editorSubmitted = isset($_POST['action']);
if ($editorSubmitted) {
    $buttonClicked = $_POST['action'];
    $save = $buttonClicked === 'save';
    $id = $_POST['id'];
    $insertNewEntry = ($save and $id === '0');
    $deleteEntry = $buttonClicked === 'delete';
    $updateEntry = ($save and $insertNewEntry === false);
    $title = $_POST['title'];
    $entry = $_POST['entry'];
    if ($insertNewEntry) {
        // This gets the last entry_id of the saved entry
        $saveEntryId = $entryTable->saveEntry($title, $entry);
    } else {
        if ($updateEntry) {
コード例 #3
0
ファイル: search.php プロジェクト: normdus/blog
<?php

/*
**  Index.php Front controller processes submit button
**	button clicked for search reguest - any search text for testing
**	search.php search controller
**	failed to create search-result-html.php view (dah)
**  die
*/
include_once "models/Blog_Entry_Table.class.php";
/*
**	instantiates an object from the Blog_Entry_Table class.
*/
$blogTable = new Blog_Entry_Table($db);
$searchOutput = "";
//  check if submit button was clicked - search requested
if (isset($_POST['search-term'])) {
    $searchTerm = $_POST['search-term'];
    // search-term from search-form-html.php
    /*
    **	Calls $blogTable object's searchEntry method to search 
    **	the table passing a $searchTerm
    */
    $searchData = $blogTable->searchEntry($searchTerm);
    $searchOutput = (include_once "views/search-results-html.php");
}
return $searchOutput;
コード例 #4
0
ファイル: entries.php プロジェクト: jasonliu0704/blogsystem
<?php

include_once "models/Blog_Entry_Table.class.php";
$entryTable = new Blog_Entry_Table($db);
$allEntries = $entryTable->getAllEntries();
$oneEntry = $allEntries->fetchObject();
$entriesFromHtml = (include_once "views/admin/entries-html.php");
return $entriesFromHtml;