Siteβ―Builder
Editing:
index.php
writable 0666
<?php /************************************************************************** * BUSINESS PROFILE INDEX β v8.1 (clean spacing, no ghost cards) * © 2025Β BestDealOn β free to modify. **************************************************************************/ declare(strict_types=1); require_once $_SERVER['DOCUMENT_ROOT'].'/pages/lib/helpers.php'; /* βββ profile & helpers (unchanged) βββ */ $profile = get_profile(); function h(string $s):string{return htmlspecialchars($s,ENT_QUOTES,'UTF-8');} function ss(string $st):string{return strtoupper(trim($st));} function cs(string $c):string {return strtolower(str_replace(' ','-',$c));} function fp(string $n):string{$d=preg_replace('/\D/','',$n); return strlen($d)===10?sprintf('(%s) %sβ%s',substr($d,0,3),substr($d,3,3),substr($d,6)):$n;} /* basic fields */ $name=$profile['name']??'Business'; $slogan=$profile['slogan']??''; $desc=$profile['description']??''; $addr=$profile['address']??''; $city=$profile['city']??''; $state=$profile['state']??''; $zip=$profile['zip']??''; $phone=$profile['phone']??''; $site=$profile['website']??''; $country='USA'; $stateslug=ss($state); $cityslug=cs($city); $metaTitle="$name in $city, $state | BestDealOn"; $metaDesc=$desc?:($slogan?:$name); $canonical="https://".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']; /* βββ module registry (same logic as v8.0) βββ */ $root = $_SERVER['DOCUMENT_ROOT']; $modDir = "$root/pages/modules"; $gCfg = "$modDir/modules.json"; $lCfg = __DIR__.'/config.json'; $gMods = is_readable($gCfg)?json_decode(file_get_contents($gCfg),true):[]; $globalByName=$adminActive=[]; foreach($gMods as $r){$globalByName[$r['name']]=$r;$adminActive[$r['name']]=!empty($r['active']);} $localRows=[]; if(is_readable($lCfg)){ $raw=json_decode(file_get_contents($lCfg),true); $rows=$raw['modules']??$raw; foreach($rows as $r)if(isset($r['name']))$localRows[$r['name']]=$r; } $order=array_keys($localRows)?:array_keys($globalByName); foreach($globalByName as $n=>$_)if(!in_array($n,$order,true))$order[]=$n; $modules=[]; foreach($order as $n){ if(!isset($globalByName[$n]))continue; $g=$globalByName[$n];$u=$localRows[$n]??[]; $want=array_key_exists('active',$u)?!empty($u['active']):!empty($g['active']); if(($adminActive[$n]??true)&&$want)$modules[] = array_merge($g,$u); } ?> <!doctype html><html lang="en"><head> <meta charset="utf-8"> <title><?=h($metaTitle)?></title> <meta name="viewport" content="width=device-width,initial-scale=1"> <meta name="description" content="<?=h($metaDesc)?>"> <link rel="canonical" href="<?=h($canonical)?>"> <style> :root{ --bg-edge:#e9edf6;--bg-centre:#fdfdff;--accent:#2463ff;--accent-dark:#153aa8; --text:#1b334a;--muted:#59728c; font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica,Arial,sans-serif; } html,body{margin:0;background: linear-gradient(90deg,var(--bg-edge) 0 160px,var(--bg-centre) 160px calc(100% - 160px),var(--bg-edge) calc(100% - 160px) 100%); color:var(--text);} @media(max-width:900px){html,body{background:var(--bg-centre);}} .top-bar{display:flex;justify-content:space-between;align-items:center;flex-wrap:wrap; gap:.45rem;padding:.55rem 1rem;background:#f0f2f8;font-size:.92rem} .logo{font-weight:900;letter-spacing:-.5px;color:var(--accent-dark);text-decoration:none} .breadcrumb a{color:var(--accent-dark);text-decoration:none}.breadcrumb span{margin:0 .25rem} .card{max-width:680px;margin:2.2rem auto 1.6rem;background:#fff;border-radius:24px; box-shadow:0 8px 24px rgba(31,61,138,.08);padding:2.2rem 2rem;text-align:center} .card h1{margin:.1em 0;font-size:2.1rem;font-weight:900;color:var(--accent-dark)} .card .slogan{margin:.35rem auto 0;font-size:1.15rem;font-weight:600;color:var(--muted)} details.contact{margin-top:1.4rem;font-size:.95rem;text-align:left} details.contact summary{cursor:pointer;list-style:none;font-weight:700;color:var(--accent-dark); display:flex;justify-content:center;gap:.5rem;align-items:center} details.contact summary::after{content:"βΎ";transition:transform .25s} details.contact[open] summary::after{transform:rotate(180deg)} .contact-content{margin-top:.9rem;line-height:1.55;color:var(--text)} .contact-content a{color:var(--accent);text-decoration:none} .modules{max-width:760px;margin:0 auto 2rem;padding:0 1rem;display:flex;flex-direction:column;gap:.5rem} .mod-card{background:transparent;padding:0;border-radius:0;box-shadow:none} /* darkβmode */ @media(prefers-color-scheme:dark){ :root{--bg-edge:#10131a;--bg-centre:#131720;--text:#d5d9e4;--muted:#9aa5bf} .card, .top-bar{background:#1a1f2b;box-shadow:0 6px 18px #0004} } </style> </head><body> <!-- breadcrumb / logo --> <div class="top-bar"> <a class="logo" href="/">BESTΒ DEALΒ ON</a> <nav class="breadcrumb" aria-label="Breadcrumb"> <a href="/">Index</a><span>/</span> <a href="/geo/<?=h($country)?>/<?=h($stateslug)?>/"><?=h($stateslug)?></a><span>/</span> <?php if($city):?><a href="/geo/<?=h($country)?>/<?=h($stateslug)?>/<?=h($cityslug)?>/"><?=h($city)?></a><span>/</span><?php endif;?> <span><?=h($name)?></span> </nav> </div> <!-- business card --> <section class="card"> <h1><?=h($name)?></h1> <?php if($slogan):?><p class="slogan"><?=h($slogan)?></p><?php endif;?> <details class="contact"> <summary>ContactΒ Info</summary> <div class="contact-content"> <?php if($addr||$city||$state||$zip):?> <p><?=h($addr)?><?php if($addr):?><br><?php endif;?> <?=h(trim(($city?$city.', ':'').$state.' '.$zip))?></p> <?php endif;?> <?php if($phone):?><p><strong>Phone:</strong> <a href="tel:<?=preg_replace('/\D/','',$phone)?>"><?=h(fp($phone))?></a></p><?php endif;?> <?php if($site):?><p><strong>Website:</strong> <a href="<?=h($site)?>" target="_blank"><?=h($site)?></a></p><?php endif;?> </div> </details> <?php if($desc):?><p style="margin-top:1.6rem;line-height:1.55"><?=h($desc)?></p><?php endif;?> </section> <!-- module feed --> <main class="modules"> <?php foreach($modules as $m){ if(empty($m['relative_path']))continue; $abs=$modDir.'/'.$m['relative_path']; if(!is_file($abs))continue; /* bufferβcapture so empty modules are skipped */ ob_start(); try{ include $abs; }catch(Throwable $e){ ob_end_clean(); continue; } $html=trim(ob_get_clean()); if($html==='') continue; echo "<section class='mod-card'>$html</section>\n"; } ?> </main> </body></html>
Save changes
Create folder
writable 0777
Create
Cancel