Hello.
I'm looking to build a simple search routine, which will display results from a keyword. (ie a very basic search engine), for my site.
As simulated data for now I've created an array, with 50 basic entries which works fine:-
Now, this is where I'm having difficulty. I'm using DataTables or DataTable, to display 10 entries at a time, however all I'm getting is the php been displayed instead of the array. The method I used to use, no longer works. And I don't know to to resolve this. My DataTable code reads:-
Could anyone, please advise me where I'm going wrong. The file is a html file, but I've also tried tpl, which has the same effect, it displays the php code.
Or how would I display results from an array in a DataTable please?
Thank You.
I'm looking to build a simple search routine, which will display results from a keyword. (ie a very basic search engine), for my site.
As simulated data for now I've created an array, with 50 basic entries which works fine:-
<?php
//Temp array
for ($arrcount=0; $arrcount <= 50; $arrcount++) {
$result_title[$arrcount] = "Header Title:- ".$arrcount;
$result_description[$arrcount] = "Description Line:- ".$arrcount;
} include($_SERVER['DOCUMENT_ROOT'].'/public/pubdsply.html');
?>
Now, this is where I'm having difficulty. I'm using DataTables or DataTable, to display 10 entries at a time, however all I'm getting is the php been displayed instead of the array. The method I used to use, no longer works. And I don't know to to resolve this. My DataTable code reads:-
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="description" content="">
<meta name="author" content="">
<title>Landing Page - Start Bootstrap Theme</title>
<!-- Bootstrap core CSS -->
<link href="layout/public/vendor/bootstrap/css/bootstrap.min.css" rel="stylesheet">
<!-- Custom fonts for this template -->
<link href="layout/public/vendor/fontawesome-free/css/all.min.css" rel="stylesheet">
<link href="layout/public/vendor/simple-line-icons/css/simple-line-icons.css" rel="stylesheet" type="text/css">
<link href="https://fonts.googleapis.com/css?family=Lato:300,400,700,300italic,400italic,700italic" rel="stylesheet" type="text/css">
<!-- Custom styles for this template -->
<link href="layout/public/css/landing-page.min.css" rel="stylesheet">
<!-- Data Table-->
<link href="https://cdn.jsdelivr.net/npm/simple-datatables@7.1.2/dist/style.min.css" rel="stylesheet" />
<link href="/layout/publictable/css/styles.css" rel="stylesheet" />
<script src="https://use.fontawesome.com/releases/v6.3.0/js/all.js" crossorigin="anonymous"></script>
</head>
<body>
<!---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------->
<div id="layoutSidenav_content">
<main>
<div class="container-fluid px-4">
<h1 class="mt-4">Tables</h1>
<ol class="breadcrumb mb-4">
<li class="breadcrumb-item"><a href="index.html">Dashboard</a></li>
<li class="breadcrumb-item active">Tables</li>
</ol>
<div class="card mb-4">
<div class="card-body">
DataTables is a third party plugin that is used to generate the demo table below. For more information about DataTables, please visit the
<a target="_blank" href="https://datatables.net/">official DataTables documentation</a>
.
</div>
</div>
<div class="card mb-4">
<div class="card-header">
<i class="fas fa-table me-1"></i>
DataTable Example
</div>
<div class="card-body">
<table id="datatablesSimple">
<thead>
<tr>
<th>Name</th>
<th>Position</th>
<th>Office</th>
<th>Age</th>
<th>Start date</th>
<th>Salary</th>
</tr>
</thead>
<tfoot>
<tr>
<th>Name</th>
<th>Position</th>
<th>Office</th>
<th>Age</th>
<th>Start date</th>
<th>Salary</th>
</tr>
</tfoot>
<tbody>
<!--<?php
for ($arrcount=0; $arrcount <= 50; $arrcount++) {
echo "<tr>";
echo "<td>";
echo $result_title[$arrcount] . "<br>";
echo $result_description[$arrcount] . "<br>";
echo "</td>";
echo "</tr>";
}
?>-->
<tr>
<td>Tiger Nixon</td>
<td>System Architect</td>
<td>Edinburgh</td>
<td>61</td>
<td>2011/04/25</td>
<td>$320,800</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</main>
</div>
<!---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------->
<!-- Bootstrap core JavaScript -->
<script src="layout/public/vendor/jquery/jquery.min.js"></script>
<script src="layout/public/vendor/bootstrap/js/bootstrap.bundle.min.js"></script>
<!-- DataTable -->
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/js/bootstrap.bundle.min.js" crossorigin="anonymous"></script>
<script src="/layout/publictable/js/scripts.js"></script>
<script src="https://cdn.jsdelivr.net/npm/simple-datatables@7.1.2/dist/umd/simple-datatables.min.js" crossorigin="anonymous"></script>
<script src="/layout/publictable/js/datatables-simple-demo.js"></script>
</body>
</html>
Could anyone, please advise me where I'm going wrong. The file is a html file, but I've also tried tpl, which has the same effect, it displays the php code.
Or how would I display results from an array in a DataTable please?
Thank You.