mirror of
https://github.com/neosubhamoy/neosubhamoy-portfolio.git
synced 2025-12-19 20:33:06 +05:30
(feat): added fetch quick action link query function and client json dataset
This commit is contained in:
5
htdocs/assets/dataset.json
Normal file
5
htdocs/assets/dataset.json
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
{
|
||||||
|
"email": "mailto:hey@neosubhamoy.com",
|
||||||
|
"chat": "https:\/\/www.t.me\/neo_subhamoy",
|
||||||
|
"sources": "https:\/\/github.com\/neosubhamoy\/neosubhamoy-portfolio"
|
||||||
|
}
|
||||||
@@ -6,13 +6,6 @@ function fetch_all_records($conn, $table_name) {
|
|||||||
return $result;
|
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 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";
|
||||||
@@ -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---
|
//---functions to fetch search results starts here---
|
||||||
//from projects table
|
//from projects table
|
||||||
function fetch_search_results_projects($conn, $keyword) {
|
function fetch_search_results_projects($conn, $keyword) {
|
||||||
|
|||||||
13
htdocs/core/write_dataset.php
Normal file
13
htdocs/core/write_dataset.php
Normal 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);
|
||||||
|
}
|
||||||
|
?>
|
||||||
@@ -6,6 +6,8 @@ $dotenv->load();
|
|||||||
require 'core/connection.php';
|
require 'core/connection.php';
|
||||||
require 'core/host_config.php';
|
require 'core/host_config.php';
|
||||||
require 'core/query_functions.php';
|
require 'core/query_functions.php';
|
||||||
|
require 'core/write_dataset.php';
|
||||||
|
write_dataset($conn);
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
|
|||||||
Reference in New Issue
Block a user