green()) {
$result = $db->query('select `testimonials`.`Comments`, `testimonials`.`Signed`,
`testimonials`.`MetaDescription`, `testimonials`.`TestimonialID`,
testimonialpics.FileName as Picture,
testimonialpics.Width,
testimonialpics.Height,
testimonialpics.AltText
from cookies.testimonials
left join cookies.testimonialpics on testimonialpics.TestimonialID = testimonials.TestimonialID
where testimonials.Approved=1 and testimonials.TestimonialID =
' . $id . ' limit 1;');
$row = $result->fetch_assoc();
//$signed = $testimonials->FormatSigned($row["Signed"]);
if (!$row) {
redirect(\Site\Links::Testimonials, 302);
}
}
else die('System Error');
$site = Packages::system('site');
$pkg = new Package(new Directory(FS::makePath(\Diyl\DocRoot, 'testimonials')));
$pkg->load();
$resources = $pkg->Resources;
$shortName = strtok($testimonials->FormatSigned($row["Signed"]),",");
$titleName = ($shortName != 'Anonymous' && $shortName != '') ? 'by ' . $shortName . ' ' : '';
$metaDescription = ($row["MetaDescription"]) ? htmlspecialchars($row["MetaDescription"]) : '';
$pageTitle = 'Vinyl Lettering Testimonial #' . $id . ' ' . $titleName;
if (strlen($pageTitle) > 60) {
$testimonialPos = strpos($pageTitle, 'Testimonial');
$letteringPos = strpos($pageTitle, 'Lettering');
if (strlen($pageTitle) - $letteringPos < 61) {
$pageTitle = substr($pageTitle, $letteringPos, 60);
} else {
$pageTitle = substr($pageTitle, $testimonialPos, 61);
if (strlen($pageTitle) > 60) {
$titleWords = explode(" ", $pageTitle);
array_pop($titleWords);
$pageTitle = implode(" ", $titleWords);
}
}
}
if ($idx = $site['resources']['html']['index.html']) {
echo $idx->import([
'title' => $pageTitle
, 'preload' => '
'
, 'canonical' => $_SERVER['DIYL_ADDR'] . $pageName
, 'content' => $pkg['resources']['pages']['testimonial.html']->import([
'id' => $id
])
, 'resources' => $resources
, 'meta' => '
'
]);
}
else {
\http_response_code(404);
}