<meta name="viewport" content="width=device-width, initial-scale=1"> <title>A List Apart Pattern Library</title> <link rel="stylesheet" href="css/pattern-lib.css" /> <link rel="icon" type="image/x-icon" href="/favicon.ico" /> </head> <body class="xx xx-patchwork"> <?php if (isset($_GET["url"]) && sanipath($patternsPath . $_GET["url"])) { ?> <?php include_pattern(sanipath($patternsPath . $_GET["url"]), "Pattern not found."); ?> <?php } else { ?> <section class="main-content"> <h1 class="xx-title">A Pattern Apart</h1> <p class="xx-subtitle">A List Apart's pattern library</p> <p class="xx-subtitle">This is the patchwork view which doesn't include the markup preview and usage examples. This view is particularly useful for device testing because it shows elements at full-width, presented on the page as they would appear on the site.</p> <div class="global-nav deluxe xx-nav"> <ul class="inline-items">
function include_pattern($path, $error) { try { $exists = realpath(sanipath($path)); if (!$exists) { throw new Exception($error); } include $exists; } catch (Exception $e) { echo $e->getMessage(); } }