1
1
mirror of https://github.com/neosubhamoy/neosubhamoy-portfolio.git synced 2025-12-19 18:13:01 +05:30

(feat): added fetch quick action link query function and client json dataset

This commit is contained in:
2024-02-01 22:22:26 +05:30
parent 51b3dc4fd8
commit 2416cfae1f
4 changed files with 30 additions and 7 deletions

View File

@@ -0,0 +1,5 @@
{
"email": "mailto:hey@neosubhamoy.com",
"chat": "https:\/\/www.t.me\/neo_subhamoy",
"sources": "https:\/\/github.com\/neosubhamoy\/neosubhamoy-portfolio"
}

View File

@@ -6,13 +6,6 @@ function fetch_all_records($conn, $table_name) {
return $result;
}
//function to fetch a single record of the given table, cloumn and it's value
function fetch_a_record($conn, $table_name, $column_name, $column_value) {
$sql = "SELECT * FROM $table_name WHERE $column_name = '$column_value'";
$result = $conn -> query($sql);
return $result;
}
//function to create an array of all unique project years
function create_project_years_array($conn) {
$sql = "SELECT DISTINCT year FROM projects ORDER BY year DESC";
@@ -68,6 +61,16 @@ function fetch_page_title($conn, $page_name) {
}
}
//function to fetch page title
function fetch_quick_action_link($conn, $action_name) {
$sql = "SELECT link FROM quick_actions WHERE name = '$action_name'";
$result = $conn -> query($sql);
if($result -> num_rows > 0){
$row = $result -> fetch_assoc();
return $row['link'];
}
}
//---functions to fetch search results starts here---
//from projects table
function fetch_search_results_projects($conn, $keyword) {

View File

@@ -0,0 +1,13 @@
<?php
function write_dataset($conn) {
$data = array(
'email' => fetch_quick_action_link($conn, "Send Email"),
'chat' => fetch_quick_action_link($conn, "Chat Online"),
'sources' => fetch_quick_action_link($conn, "Source Code"),
);
$json_data = json_encode($data, JSON_PRETTY_PRINT);
$json_file_path = 'assets/dataset.json';
file_put_contents($json_file_path, $json_data);
}
?>

View File

@@ -6,6 +6,8 @@ $dotenv->load();
require 'core/connection.php';
require 'core/host_config.php';
require 'core/query_functions.php';
require 'core/write_dataset.php';
write_dataset($conn);
?>
<!DOCTYPE html>