Skip to content

Commit

Permalink
Added include example
Browse files Browse the repository at this point in the history
  • Loading branch information
steampixel committed Sep 7, 2020
1 parent ce7225c commit 7fbe414
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
10 changes: 10 additions & 0 deletions include-example.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@

<h1>Blog</h1>

<div>
Hey! Read my new blog post with this cool slug: "<?=$slug ?>"
</div>

<p>
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
</p>
8 changes: 8 additions & 0 deletions index.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ function navi() {
<li><a href="'.BASEPATH.'contact-form">contact form</a></li>
<li><a href="'.BASEPATH.'get-post-sample">get+post example</a></li>
<li><a href="'.BASEPATH.'test.html">test.html</a></li>
<li><a href="'.BASEPATH.'blog/how-to-use-include-example">How to push data to included files</a></li>
<li><a href="'.BASEPATH.'phpinfo">PHP Info</a></li>
<li><a href="'.BASEPATH.'aTrailingSlashDoesNotMatter">aTrailingSlashDoesNotMatter</a></li>
<li><a href="'.BASEPATH.'aTrailingSlashDoesNotMatter/">aTrailingSlashDoesNotMatter/</a></li>
Expand All @@ -50,6 +51,13 @@ function navi() {

// Simple test route that simulates static html file
// TODO: Fix this for some web servers
Route::add('/blog/([a-z-0-9-]*)', function($slug) {
navi();
include('include-example.php');
});

// This example shows how to include files and how to push data to them
// TODO: Fix this for some web servers
Route::add('/test.html', function() {
navi();
echo 'Hello from test.html';
Expand Down

0 comments on commit 7fbe414

Please sign in to comment.