Projects are now able to read from a content dir, posted two projects
This commit is contained in:
@@ -9,6 +9,22 @@ function head($title) {
|
||||
</head>";
|
||||
}
|
||||
|
||||
function head_css($title, $css, $dots) {
|
||||
$css_links = "";
|
||||
foreach($css as $css_item) {
|
||||
$css_links .= "<link rel='stylesheet' href='". "$dots/css/$css_item" ."'";
|
||||
}
|
||||
return "
|
||||
<head>
|
||||
<meta charset='UTF-8' />
|
||||
<meta name='viewport' content='width=device-width, initial-scale=1.0' />
|
||||
<script src='https://cdn.jsdelivr.net/npm/@tailwindcss/browser@4'></script>
|
||||
<title>" . $title . "</title>
|
||||
$css_links
|
||||
</head>";
|
||||
}
|
||||
|
||||
|
||||
function navbar($highlighted_box) {
|
||||
|
||||
$selected = "
|
||||
|
||||
@@ -119,4 +119,40 @@ function image_project_list() {
|
||||
</section>
|
||||
";
|
||||
}
|
||||
|
||||
function get_blog_content($dots, $project_name, $project_content_dir) {
|
||||
$output = "";
|
||||
$fh = fopen("$project_content_dir/content.txt",'r');
|
||||
while ($line = fgets($fh)) {
|
||||
if (str_contains($line, "!image ")) {
|
||||
$image_link = str_replace("!image " , "", $line);
|
||||
$output .= "
|
||||
<div class='pb-10'><div class='relative rounded-3xl overflow-hidden h-80 lg:h-full group'>
|
||||
<img data-motion='image' src='". "$dots/$image_link" ."' class='w-full h-full object-cover group-hover:scale-105 transition-transform duration-700' style='opacity: 1; transform: scale(1); filter: blur(0px);'>
|
||||
</div></div>
|
||||
";
|
||||
} else {
|
||||
$output .= "
|
||||
<p class='text-2xl text-left text-slate-600 dark:text-neutral-400 mb-8' data-animate='text' style='opacity: 1;'>
|
||||
". $line ."
|
||||
</p>";
|
||||
}
|
||||
}
|
||||
fclose($fh);
|
||||
return $output;
|
||||
}
|
||||
|
||||
function make_blog($dots, $project_name, $project_content_dir) {
|
||||
return "
|
||||
<section id='content' class='py-20 sm:py-24 bg-white dark:bg-neutral-950'>
|
||||
<div class='max-w-7xl mx-auto px-4 sm:px-6 lg:px-8'>
|
||||
<!-- Centered Header -->
|
||||
<div class='text-center max-w-3xl mx-auto' data-motion='hero' style='opacity: 1;'>
|
||||
<h1 class='text-3xl sm:text-5xl lg:text-6xl font-bold text-slate-900 dark:text-white leading-tight mb-6'>$project_name</h1>
|
||||
". get_blog_content($dots, $project_name, $project_content_dir) ."
|
||||
</div>
|
||||
</section>
|
||||
";
|
||||
}
|
||||
|
||||
?>
|
||||
Reference in New Issue
Block a user