mirror of
https://github.com/neosubhamoy/neosubhamoy-portfolio.git
synced 2025-12-19 22:53:03 +05:30
(refactor): using fetch_all_reacords() function + (feature): implemented dynamic currently working on section
This commit is contained in:
@@ -17,7 +17,7 @@
|
|||||||
<h6 class="font-bold mb-8">Featured</h6>
|
<h6 class="font-bold mb-8">Featured</h6>
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
$featured_projects_footer = fetch_featured_projects($conn);
|
$featured_projects_footer = fetch_all_records($conn, "featured_projects");
|
||||||
|
|
||||||
if($featured_projects_footer -> num_rows > 0) {
|
if($featured_projects_footer -> num_rows > 0) {
|
||||||
while($featured_footer_item = $featured_projects_footer -> fetch_assoc()) {
|
while($featured_footer_item = $featured_projects_footer -> fetch_assoc()) {
|
||||||
|
|||||||
@@ -809,10 +809,18 @@ video {
|
|||||||
margin-top: 2.2rem;
|
margin-top: 2.2rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.mb-24 {
|
||||||
|
margin-bottom: 6rem;
|
||||||
|
}
|
||||||
|
|
||||||
.flex {
|
.flex {
|
||||||
display: flex;
|
display: flex;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.table {
|
||||||
|
display: table;
|
||||||
|
}
|
||||||
|
|
||||||
.hidden {
|
.hidden {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,11 @@
|
|||||||
<?php
|
<?php
|
||||||
|
//function to fetch all records of the given table
|
||||||
|
function fetch_all_records($conn, $table_name) {
|
||||||
|
$sql = "SELECT * FROM $table_name";
|
||||||
|
$result = $conn -> query($sql);
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
|
||||||
//function to create an array of all unique project years
|
//function to create an array of all unique project years
|
||||||
function create_project_years_array($conn) {
|
function create_project_years_array($conn) {
|
||||||
$sql = "SELECT DISTINCT year FROM projects ORDER BY year DESC";
|
$sql = "SELECT DISTINCT year FROM projects ORDER BY year DESC";
|
||||||
@@ -20,11 +27,4 @@ function fetch_projects_by_year($conn, $year) {
|
|||||||
$result = $conn -> query($sql);
|
$result = $conn -> query($sql);
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
//function to fetch all featured projects
|
|
||||||
function fetch_featured_projects($conn) {
|
|
||||||
$sql = "SELECT * FROM featured_projects";
|
|
||||||
$result = $conn -> query($sql);
|
|
||||||
return $result;
|
|
||||||
}
|
|
||||||
?>
|
?>
|
||||||
@@ -123,7 +123,7 @@ $years = create_project_years_array($conn);
|
|||||||
<div class="w-full flex flex-col justify-center items-center mb-12">
|
<div class="w-full flex flex-col justify-center items-center mb-12">
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
$featured_projects = fetch_featured_projects($conn);
|
$featured_projects = fetch_all_records($conn,"featured_projects");
|
||||||
|
|
||||||
if($featured_projects -> num_rows > 0){
|
if($featured_projects -> num_rows > 0){
|
||||||
//show top 2 featured projects for sidebar
|
//show top 2 featured projects for sidebar
|
||||||
@@ -152,12 +152,21 @@ $years = create_project_years_array($conn);
|
|||||||
?>
|
?>
|
||||||
</div>
|
</div>
|
||||||
<h5 class="text-xl font-bold mb-5">Currently Working On</h5>
|
<h5 class="text-xl font-bold mb-5">Currently Working On</h5>
|
||||||
<div class="w-full flex flex-col justify-center flex-wrap mb-12">
|
<div class="w-full flex flex-col justify-center flex-wrap mb-24">
|
||||||
<div class="w-fit my-[0.30rem] text-sm font-bold bg-bg_secondary px-3 py-1 rounded-full"><i class="fa-brands fa-react text-base mr-1 text-[#38BDF8]"></i> React Web Development</div>
|
<?php
|
||||||
<div class="w-fit my-[0.30rem] text-sm font-bold bg-bg_secondary px-3 py-1 rounded-full"><i class="fa-brands fa-android text-base mr-1 text-[#3FF989]"></i> Android OS & Apps</div>
|
|
||||||
<div class="w-fit my-[0.30rem] text-sm font-bold bg-bg_secondary px-3 py-1 rounded-full"><i class="fa-brands fa-python text-base mr-1 text-[#CD6CFB]"></i> Automation & Python</div>
|
$working_on = fetch_all_records($conn, "working_on");
|
||||||
<div class="w-fit my-[0.30rem] text-sm font-bold bg-bg_secondary px-3 py-1 rounded-full"><i class="fa-brands fa-js text-base mr-1 text-[#DCDF3F]"></i> Javascript Library</div>
|
|
||||||
<div class="w-fit my-[0.30rem] text-sm font-bold bg-bg_secondary px-3 py-1 rounded-full"><i class="fa-solid fa-robot text-base mr-1 text-[#EC4B4B]"></i> AI & ML</div>
|
if($working_on -> num_rows > 0) {
|
||||||
|
//show all currently working on topics
|
||||||
|
while($working_on_topic = $working_on -> fetch_assoc()) {
|
||||||
|
echo"
|
||||||
|
<div class='w-fit my-[0.30rem] text-sm font-bold bg-bg_secondary px-3 py-1 rounded-full'><i class='".$working_on_topic['icon']."'></i> ".$working_on_topic['title']."</div>
|
||||||
|
";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user