echo "データが存在しません。"; return; } $latest = new LatestPages(); $category = new Category(); $archive = new Archive(); foreach (array_reverse($data) as $page) { $main[] = array('title' => $page->title, 'date' => $page->date, 'text' => mb_substr($page->text, 0, mb_strpos($page->text, "<br />")), 'pagenum' => $page->pagenum); } $smarty->assign('title', 'アーカイブ:' . $_GET['archive']); } else { $blog = new ActiveRecord(); $blog->connectPdo('blogdb', 'blog', 'readonly', 'readonly'); $data = $blog->find($blog->size()); if (!isset($data->pagenum)) { echo "データが存在しません。"; return; } $latest = new LatestPages(); $category = new Category(); $archive = new Archive(); $main[] = array('title' => $data->title, 'date' => $data->date, 'text' => $data->text); $smarty->assign('prev', $blog->find($blog->size() - 1)); } } } $smarty->assign('main', $main); $smarty->assign('latest', $latest->getPages()); $smarty->assign('category', $category->getCategory()); $smarty->assign('archive', $archive->getArchive()); $smarty->display('blog.tpl');
* You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ //----INCLUDE FILES---- include '../../digital-logsheets-res/smarty/libs/Smarty.class.php'; include "../../digital-logsheets-res/php/database/connectToDatabase.php"; require_once "../../digital-logsheets-res/php/objects/logsheetClasses.php"; require_once "../../digital-logsheets-res/php/select2-preparation.php"; // create object $smarty = new Smarty(); //database interactions try { //open database connection $db = connectToDatabase(); $archive = new Archive($db); $episodesArchive = $archive->getArchive(); $episodes = array(); foreach ($episodesArchive as $episode) { $playlist = array(); $segments = $episode->getPlaylist()->getSegments(); //create the playlist for each episode foreach ($segments as $segment) { $playlist[$segment->getId()] = $segment->getObjectAsArray(); } //create an array to store each episode's data $episodes[$episode->getId()] = $episode->getObjectAsArray(); } $programs = getSelect2ProgramsList($db); //close database connection $db = NULL; $smarty->assign("episodes", $episodes);