Siteβ―Builder
Editing:
indeggggx.php
writable 0666
<?php /************************************************************************** * BUSINESS PROFILE INDEX β masonry edition β’ v6 (gapβfinal) * © 2025Β BestDealOn β free to modify. **************************************************************************/ ini_set('display_errors', 1); // show errors ini_set('display_startup_errors', 1); error_reporting(E_ALL); 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;} /* fields */ $name=$profile['display_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']; /* modules registry */ $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):[]; $lMods=is_readable($lCfg)?json_decode(file_get_contents($lCfg),true):[]; $ordered=[]; foreach($lMods as $m) $ordered[$m['name']]=$m; foreach($gMods as $g)if(!isset($ordered[$g['name']]))$ordered[$g['name']]=$g; $modules=array_filter($ordered,fn($m)=>($m['active']??false)); ?> <!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{--fg:#1b334a;--link:#2357d7; font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica,Arial,sans-serif;} body{margin:0;background:#f5f8fb;color:var(--fg);} /* header */ .top-bar{display:flex;justify-content:space-between;align-items:center;flex-wrap:wrap; gap:.45rem;padding:.55rem 1rem;background:#eee;text-align:center} .logo{font-weight:900;letter-spacing:-.5px;color:var(--link);text-decoration:none} .breadcrumb a{color:var(--link);text-decoration:none}.breadcrumb span{margin:0 .25rem} /* business card */ .biz-card{max-width:680px;margin:2rem auto;background:#fff;border-radius:20px; box-shadow:0 2px 16px #dde3fa26;padding:2rem 1.4rem; display:grid;gap:1rem;grid-template-columns:1fr 1fr} .biz-card h1{grid-column:1/-1;font-size:1.7rem;color:#2c61d7;margin:.1em 0} .biz-card .slogan{grid-column:1/-1;color:#2e6eb0;font-style:italic;font-size:1.1rem} .field{display:flex;gap:.6rem}.label{font-weight:600;min-width:95px;color:#23487b} .value{color:#364868} @media(max-width:600px){.biz-card{grid-template-columns:1fr}.field{flex-direction:column}} /* masonry columns (tighter gaps) */ .modules{ column-width:340px; column-gap:.8rem; /* horizontal gap */ max-width:960px; margin:0 auto 1.2rem; /* bottom space */ padding:0 1rem; } @media(min-width:1100px){.modules{column-width:440px}} /* wrapper around each module */ .mod-card{ display:inline-block; width:100%; margin:0 0 .8rem; /* vertical gap */ padding:0; background:transparent; /* outer white box removed */ box-shadow:none; break-inside:avoid; } </style> </head><body> <!-- header --> <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 info --> <section class="biz-card"> <h1><?=h($name)?></h1> <?php if($slogan):?><div class="slogan"><?=h($slogan)?></div><?php endif;?> <?php if($addr||$city||$state||$zip):?> <div class="field"><span class="label">Address:</span><span class="value"> <?php if($addr)echo h($addr).'<br>';?> <?=h(trim(($city?$city.', ':'').$state.' '.$zip))?> </span></div> <?php endif;?> <?php if($phone):?> <div class="field"><span class="label">Phone:</span> <span class="value"><b><?=h(fp($phone))?></b></span></div> <?php endif;?> <?php if($site):?> <div class="field"><span class="label">Website:</span> <span class="value"><a href="<?=h($site)?>" target="_blank"><?=h($site)?></a></span></div> <?php endif;?> <?php if($desc):?> <div class="field" style="grid-column:1/-1"> <span class="value" style="line-height:1.4;"><?=h($desc)?></span></div> <?php endif;?> </section> <!-- modules --> <main class="modules"> <?php foreach($modules as $mod){ $abs=$modDir.'/'.$mod['relative_path']; if(!is_file($abs)) continue; echo "<section class='mod-card'>"; try{include $abs;}catch(Throwable $e){ echo '<p style="color:#c00">Module β'.h($mod['name']).'β failed.</p>'; } echo "</section>"; } ?> </main> </body></html>
Save changes
Create folder
writable 0777
Create
Cancel