Site Builder
Editing:
modules-about1.php
writable 0666
<?php /************************************************************************** * ABOUT MODULE * ---------------------------------------------------------------------- * • Reads display name + description from profile.json * • Outputs an “About {Name}” section when description is present * • Safe to include multiple times (will not redeclare CSS) **************************************************************************/ /* ----------------------------------------------------------- * 1) Load profile.json only if parent page hasn’t already * supplied $profile. * --------------------------------------------------------- */ if (!isset($profile) || !is_array($profile)) { $profilePath = dirname(__DIR__, 2) . '/profile.json'; // ../../profile.json $profile = is_readable($profilePath) ? json_decode(file_get_contents($profilePath), true) : []; } /* ----------------------------------------------------------- * 2) Extract the bits we need * --------------------------------------------------------- */ $name = $profile['display_name'] ?? $profile['handle'] ?? 'Profile'; $descr = trim($profile['description'] ?? ''); /* nothing to show? bail early */ if ($descr === '') { return; } ?> <!-- ======== ABOUT SECTION ======== --> <section class="bd-about"> <h2>About <?= htmlspecialchars($name) ?></h2> <p><?= nl2br(htmlspecialchars($descr)) ?></p> </section> <style> /* Scoped styles – loaded once even if module is included twice */ .bd-about{ padding:1.4rem 0; border-bottom:1px solid #e4e9f3; font-family:system-ui,Arial,sans-serif; } .bd-about h2{ margin:.1em 0 .7em; font-size:1.35rem; font-weight:700; color:#102a66; } .bd-about p{ margin:0; line-height:1.55; font-size:1.05rem; color:#333; } </style>
Save changes
Create folder
writable 0777
Create
Cancel