pull/11/head
Suvodip 2024-12-21 18:45:58 +05:30
parent cc18143fa9
commit 9999c63d73
6 changed files with 178 additions and 6 deletions

View File

@ -21,11 +21,11 @@
$totalPageContent = $headerContent . $pageContent . $footerContent; $totalPageContent = $headerContent . $pageContent . $footerContent;
$filePath = __DIR__ . '/' . $fileName; $filePath = __DIR__ . '/' . $fileName;
if (file_put_contents($filePath, $totalPageContent)) { // if (file_put_contents($filePath, $totalPageContent)) {
// echo "<p class='text-success'>Page saved successfully at $filePath.</p>"; // // echo "<p class='text-success'>Page saved successfully at $filePath.</p>";
} else { // } else {
// echo "<p class='text-danger'>Failed to save the page.</p>"; // // echo "<p class='text-danger'>Failed to save the page.</p>";
} // }
} }
try { try {

View File

@ -302,7 +302,7 @@
<ul class="submenu dropdown-menu"> <ul class="submenu dropdown-menu">
<li><a class="dropdown-item" href="#">Humanitiess &raquo; </a> <li><a class="dropdown-item" href="#">Humanitiess &raquo; </a>
<ul class="submenu dropdown-menu"> <ul class="submenu dropdown-menu">
<li><a class="dropdown-item" href="/department-of-bengaliug-pg.html">Bengali (UG & PG)</a></li> <li><a class="dropdown-item" href="/department-of-bengaliug-pg.html">Bengali</a></li>
<li><a class="dropdown-item" href="/department-of-english.html">English</a></li> <li><a class="dropdown-item" href="/department-of-english.html">English</a></li>
<li><a class="dropdown-item" href="/department-of-sanskrit.html">Sanskrit</a></li> <li><a class="dropdown-item" href="/department-of-sanskrit.html">Sanskrit</a></li>
<li><a class="dropdown-item" href="/department-of-philosophy.html">Philosophy</a></li> <li><a class="dropdown-item" href="/department-of-philosophy.html">Philosophy</a></li>

15
.hta_slug/faculty.php Normal file
View File

@ -0,0 +1,15 @@
<?php
if(isset($url[2])){
$slug2="";
if (strpos($url[2], "?") !== false) {
$url2 = explode('?', $url[2]);
$slug2=$url2[0];
} else $slug2=$url[2];
if($slug2=="") require_once('faculty/_home.php');
elseif(file_exists(__DIR__."/faculty/".$slug2.".php")) include __DIR__."/faculty/".$slug2.".php";
else require_once('faculty/.hta_404.php');
}
else require_once('faculty/_home.php');
?>

59
faculty/.hta_404.php Normal file
View File

@ -0,0 +1,59 @@
<?php
require('.hta_config/env.php');
require('./.hta_header.php');
// echo 'Notice 404+1';
$headerContent = file_get_contents('./.hta_header.php');
$requestUri = $_SERVER['REQUEST_URI'];
// echo $requestUri;
$urlParts = explode('/', $requestUri);
if($urlParts[1] === 'faculty'){
$slug = $urlParts[2];
} else{
$slug = $urlParts[1];
}
$querySlug = explode('.', $slug)[0];
// echo $querySlug;
$fileName = $slug;
try {
$conn = new PDO("mysql:host=$mariaServer;dbname=$mariaDb", $mariaUser, $mariaPass);
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$stmt = $conn->prepare("SELECT * FROM `scc24` WHERE `slug` = '".$querySlug."'");
$stmt->execute();
$content = $stmt->fetchAll(PDO::FETCH_ASSOC);
if(isset($content[0]['content']) && $content[0]['content'])
$pageContent = '<div class="container mx-auto" style="">
<div class="">'.$content[0]['content'].'</div>
</div>';
else $pageContent = '
<div style="display: flex; flex-direction: column; align-items: center; justify-content: center; margin: 100px 0;"><p style="text-align: center; font-size: 30px; font-weight: bold;">Page not found (404).</p>
<a href="/">Back to home</a>
</div>
';
} catch (PDOException $e) {
$in_page_message = "<p class='text-danger'>Error: " . $e->getMessage() . "</p>";
}
// Render page content here
echo $pageContent;
$footerContent = file_get_contents('./.hta_footer.php');
if($urlParts[1] === 'faculty'){
$filePath = __DIR__ . '/' . $fileName;
// echo $filePath;
$totalPageContent = $headerContent . $pageContent . $footerContent;
} else{
$filePath = __DIR__ . $fileName;
$totalPageContent = $headerContent . $pageContent . $footerContent;
}
file_put_contents($filePath, $totalPageContent);
?>

52
faculty/_home.php Normal file
View File

@ -0,0 +1,52 @@
<?php
require('.hta_config/env.php');
require('./.hta_header.php');
$noticeType = $_GET['type'];
if($noticeType === 'notice'){
$noticeHead = 'General Notice';
} elseif($noticeType === 'tender'){
$noticeHead = 'Tender Notice';
}
?>
<div class="container">
<h2 style="text-align: center; margin: 20px 0px;"><?php echo $noticeHead ?></h2>
<table style="border-collapse: collapse; width: 100%; ">
<thead>
<tr>
<th style="border: 1px solid #6b6245; padding: 8px; text-align: left;">Sl No.</th>
<th style="border: 1px solid #6b6245; padding: 8px; text-align: left;">Title</th>
<th style="border: 1px solid #6b6245; padding: 8px; text-align: left;">Action</th>
</tr>
</thead>
<tbody>
<?php
try {
$conn = new PDO("mysql:host=$mariaServer;dbname=$mariaDb", $mariaUser, $mariaPass);
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$stmt = $conn->prepare("SELECT * FROM `scc24` WHERE `type` = :type ORDER BY (`date_created` = CURDATE()) DESC, `date_created` DESC");
$stmt->bindParam(':type', $noticeType, PDO::PARAM_STR);
$stmt->execute();
$content = $stmt->fetchAll(PDO::FETCH_ASSOC);
$serialNumber = 1;
foreach ($content as $notice) {
echo '<tr>
<td style="border: 1px solid #6b6245; padding: 8px;">' . $serialNumber . '</td>
<td style="border: 1px solid #6b6245; padding: 8px;">' . htmlspecialchars($notice['title']) . '</td>
<td style="border: 1px solid #6b6245; padding: 8px; text-align: center;">
<a href="/notice/'.$notice['slug'].'.html">View</a>
<a href="#"></a>
</td>
</tr>';
$serialNumber++;
}
echo '';
} catch (PDOException $e) {
echo "<p class='text-danger'>Error: " . htmlspecialchars($e->getMessage()) . "</p>";
}
?>
</tbody>
</table>
</div>
<?php
require('./.hta_footer.php');
?>

46
faculty/index.php Normal file
View File

@ -0,0 +1,46 @@
<?php
require('../.hta_config/env.php');
require('../.hta_header.php');
$noticeHead = 'Tender Notice';
?>
<div class="container">
<h2 style="text-align: center; margin: 20px 0px;">Faculty List</h2>
<table style="border-collapse: collapse; width: 100%; ">
<thead>
<tr>
<th style="border: 1px solid #6b6245; padding: 8px; text-align: left;">Sl No.</th>
<th style="border: 1px solid #6b6245; padding: 8px; text-align: left;">Faculty Name</th>
<th style="border: 1px solid #6b6245; padding: 8px; text-align: left;">Action</th>
</tr>
</thead>
<tbody>
<?php
try {
$conn = new PDO("mysql:host=$mariaServer;dbname=$mariaDb", $mariaUser, $mariaPass);
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$stmt = $conn->prepare("SELECT * FROM `scc24` WHERE `type` = 'faculty' ORDER BY (`date_created` = CURDATE()) DESC, `date_created` DESC");
$stmt->execute();
$content = $stmt->fetchAll(PDO::FETCH_ASSOC);
$serialNumber = 1;
foreach ($content as $notice) {
echo '<tr>
<td style="border: 1px solid #6b6245; padding: 8px;">' . $serialNumber . '</td>
<td style="border: 1px solid #6b6245; padding: 8px;">' . htmlspecialchars($notice['title']) . '</td>
<td style="border: 1px solid #6b6245; padding: 8px; text-align: center;">
<a href="/faculty/'.$notice['slug'].'.html">View</a>
<a href="#"></a>
</td>
</tr>';
$serialNumber++;
}
echo '';
} catch (PDOException $e) {
echo "<p class='text-danger'>Error: " . htmlspecialchars($e->getMessage()) . "</p>";
}
?>
</tbody>
</table>
</div>
<?php
require('../.hta_footer.php');
?>