Added include example

This commit is contained in:
SteamPixel 2020-09-07 10:21:29 +02:00
parent ce7225c288
commit 7fbe414965
2 changed files with 18 additions and 0 deletions

10
include-example.php Normal file
View File

@ -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>

View File

@ -25,6 +25,7 @@ function navi() {
<li><a href="'.BASEPATH.'contact-form">contact form</a></li> <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.'get-post-sample">get+post example</a></li>
<li><a href="'.BASEPATH.'test.html">test.html</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.'phpinfo">PHP Info</a></li>
<li><a href="'.BASEPATH.'aTrailingSlashDoesNotMatter">aTrailingSlashDoesNotMatter</a></li> <li><a href="'.BASEPATH.'aTrailingSlashDoesNotMatter">aTrailingSlashDoesNotMatter</a></li>
<li><a href="'.BASEPATH.'aTrailingSlashDoesNotMatter/">aTrailingSlashDoesNotMatter/</a></li> <li><a href="'.BASEPATH.'aTrailingSlashDoesNotMatter/">aTrailingSlashDoesNotMatter/</a></li>
@ -50,6 +51,13 @@ Route::add('/index.php', function() {
// Simple test route that simulates static html file // Simple test route that simulates static html file
// TODO: Fix this for some web servers // 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() { Route::add('/test.html', function() {
navi(); navi();
echo 'Hello from test.html'; echo 'Hello from test.html';