我目前正在創建一個小應用程序,它具有很多內容,我想讓這些內容以有組織的方式顯示,並且我可以看到這是使用分頁的最佳方式。我已經瀏覽了bootstrap文檔,但是我無法解決這個問題,因爲我之前從未使用過它。如何使用Netbeans使用引導3分頁與PHP MVC?
型號:
public function showFilms($UserID){
//declare new film array
$film = array();
//SQL Query Selecting equivalent information to be displayed
$sqlQuery = 'SELECT FilmID, Title, Director,YearofRelease, Genre, Image, MainActor, MainActor1, MainActor2, Synopsis FROM films WHERE User ="' . $UserID . '" ORDER BY Title DESC';
// prepare a PDO statement
$statement = $this->_dbHandle->prepare($sqlQuery);
// Execute PDO statement
$statement->execute();
// While loop fetches each row matching query
while ($row = $statement->fetch()) {
$film[] = array('FilmID' => $row['FilmID'],
'Title' => $row['Title'],
'User' => $UserID,
'Director' => $row['Director'],
'YearofRelease' => $row['YearofRelease'],
'Genre' => $row['Genre'],
'Image' => $row['Image'],
'MainActor' => $row['MainActor'],
'MainActor1' => $row['MainActor1'],
'MainActor2' => $row['MainActor2'],
'Synopsis'=> $row['Synopsis']
);
}
//returning film array
return $film;
}
查看:
<div id="FilmArea">
<!-- Count for Films -->
<?php
if (count($film)) {
?>
<br>
<!-- Displaying each entry using count of hidden list value of id of entry -->
<?php foreach ($film as $list): ?>
<!-- Panel Start -->
<div class="panel panel-info">
<!-- Panel Header -->
<div class="panel-heading">
<h3 class="panel-title" style="font-family: sans-serif; font-size: 20px; color: black; ">
<?= ($list['Title']) ?> <small> Directed By : <?= ($list['Director']) ?></small>
</h3>
</div>
<!-- Panel Body -->
<div class="panel-body">
<div id='dvdHolder'>
<?= ($list['Image'] <> "" ? "<img style='max-width:200px; max-height:200px;' src='Images/{$list['Image']}'/>" : "") ?>
</div>
<div id='dvdInfo'>
<p style='font-weight: bold;'> Year Released : <?= ($list['YearofRelease']) ?></p>
<p style='font-weight: bold;'> Film Genre : <?= ($list['Genre']) ?></p>
<p style="font-weight: bold;"> Starring : <?= ($list['MainActor']) ?> , <?= ($list['MainActor1']) ?> , <?= ($list['MainActor2']) ?> </p>
<p style='font-weight: bold;'> Synopsis : <?= ($list['Synopsis']) ?></p>
</div>
</div>
</div>
<!-- End of Foreach Statement for Entry -->
<?php endforeach; ?>
<!-- Else show this message if user has no entries -->
<?php
}else {
?>
<p><b>No Films Added yet!</b></p>
<?php } ?>
</div>
控制器:
<?php
session_start();
require_once('Model/UserDataSet.php');
require_once('Model/FilmDataSet.php');
$view = new stdClass();
$view->pageTitle = 'My Vault';
$aa = new FilmDataSet();
$film = array();
$film = $aa->showFilms($_SESSION['Email']);
require_once('View/home.phtml');
我如何能實現分頁任何幫助或信息進入我的應用程序將是偉大的。
您使用的是什麼數據庫引擎? –
您好我正在使用phpMyAdmin – MrWeiser