From ba2c5c6ea826d918a912c826021b88ebc35551eb Mon Sep 17 00:00:00 2001 From: Yvan Sraka Date: Sun, 20 Aug 2017 16:22:24 +0200 Subject: [PATCH] Fix issue #152 Multilingual URLs do not work on thebookofshaders.com/appendix/ --- appendix/00/index.php | 47 +++++++++++++++++++++++++------------------ appendix/01/index.php | 47 +++++++++++++++++++++++++------------------ appendix/02/index.php | 47 +++++++++++++++++++++++++------------------ appendix/03/index.php | 47 +++++++++++++++++++++++++------------------ appendix/04/index.php | 47 ++++++++++++++++++++++--------------------- appendix/05/index.php | 47 +++++++++++++++++++++++++------------------ appendix/06/index.php | 47 +++++++++++++++++++++++++------------------ appendix/index.php | 26 +++++++++++++++--------- 8 files changed, 202 insertions(+), 153 deletions(-) diff --git a/appendix/00/index.php b/appendix/00/index.php index 041cc63..00f2758 100644 --- a/appendix/00/index.php +++ b/appendix/00/index.php @@ -1,25 +1,32 @@ -

The Book of Shaders by Patricio Gonzalez Vivo

-
-
- '; + $path = "../.."; + $README = "README"; + $language = ""; - $Parsedown = new Parsedown(); - echo $Parsedown->text(file_get_contents ('README.md')); + if ( !empty($_GET['lan']) ) { + if (file_exists($README.'-'.$_GET['lan'].'.md')) { + $language = '-'.$_GET['lan']; + $README .= $language; + } + } - echo ' -
-
- '; + include($path."/header.php"); + include($path."/chap-header.php"); + echo '
'; - include($path."/footer.php"); + include($path."/src/parsedown/Parsedown.php"); + $Parsedown = new Parsedown(); + echo $Parsedown->text(file_get_contents($README.'.md')); + + echo ' +
+
+ '; + + include($path."/footer.php"); ?> diff --git a/appendix/01/index.php b/appendix/01/index.php index 041cc63..00f2758 100644 --- a/appendix/01/index.php +++ b/appendix/01/index.php @@ -1,25 +1,32 @@ -

The Book of Shaders by Patricio Gonzalez Vivo

-
-
- '; + $path = "../.."; + $README = "README"; + $language = ""; - $Parsedown = new Parsedown(); - echo $Parsedown->text(file_get_contents ('README.md')); + if ( !empty($_GET['lan']) ) { + if (file_exists($README.'-'.$_GET['lan'].'.md')) { + $language = '-'.$_GET['lan']; + $README .= $language; + } + } - echo ' -
-
- '; + include($path."/header.php"); + include($path."/chap-header.php"); + echo '
'; - include($path."/footer.php"); + include($path."/src/parsedown/Parsedown.php"); + $Parsedown = new Parsedown(); + echo $Parsedown->text(file_get_contents($README.'.md')); + + echo ' +
+
+ '; + + include($path."/footer.php"); ?> diff --git a/appendix/02/index.php b/appendix/02/index.php index 041cc63..00f2758 100644 --- a/appendix/02/index.php +++ b/appendix/02/index.php @@ -1,25 +1,32 @@ -

The Book of Shaders by Patricio Gonzalez Vivo

-
-
- '; + $path = "../.."; + $README = "README"; + $language = ""; - $Parsedown = new Parsedown(); - echo $Parsedown->text(file_get_contents ('README.md')); + if ( !empty($_GET['lan']) ) { + if (file_exists($README.'-'.$_GET['lan'].'.md')) { + $language = '-'.$_GET['lan']; + $README .= $language; + } + } - echo ' -
-
- '; + include($path."/header.php"); + include($path."/chap-header.php"); + echo '
'; - include($path."/footer.php"); + include($path."/src/parsedown/Parsedown.php"); + $Parsedown = new Parsedown(); + echo $Parsedown->text(file_get_contents($README.'.md')); + + echo ' +
+
+ '; + + include($path."/footer.php"); ?> diff --git a/appendix/03/index.php b/appendix/03/index.php index 041cc63..00f2758 100644 --- a/appendix/03/index.php +++ b/appendix/03/index.php @@ -1,25 +1,32 @@ -

The Book of Shaders by Patricio Gonzalez Vivo

-
-
- '; + $path = "../.."; + $README = "README"; + $language = ""; - $Parsedown = new Parsedown(); - echo $Parsedown->text(file_get_contents ('README.md')); + if ( !empty($_GET['lan']) ) { + if (file_exists($README.'-'.$_GET['lan'].'.md')) { + $language = '-'.$_GET['lan']; + $README .= $language; + } + } - echo ' -
-
- '; + include($path."/header.php"); + include($path."/chap-header.php"); + echo '
'; - include($path."/footer.php"); + include($path."/src/parsedown/Parsedown.php"); + $Parsedown = new Parsedown(); + echo $Parsedown->text(file_get_contents($README.'.md')); + + echo ' +
+
+ '; + + include($path."/footer.php"); ?> diff --git a/appendix/04/index.php b/appendix/04/index.php index 9ab9c01..00f2758 100644 --- a/appendix/04/index.php +++ b/appendix/04/index.php @@ -1,31 +1,32 @@

The Book of Shaders by Patricio Gonzalez Vivo

-
-
- '; + include($path."/header.php"); + include($path."/chap-header.php"); + echo '
'; - $Parsedown = new Parsedown(); - echo $Parsedown->text(file_get_contents ('README.md')); - /* - echo ' -
-
- '; - //*/ + include($path."/src/parsedown/Parsedown.php"); + $Parsedown = new Parsedown(); + echo $Parsedown->text(file_get_contents($README.'.md')); - include($path."/footer.php"); + echo ' +
+
+ '; + + include($path."/footer.php"); ?> diff --git a/appendix/05/index.php b/appendix/05/index.php index 041cc63..00f2758 100644 --- a/appendix/05/index.php +++ b/appendix/05/index.php @@ -1,25 +1,32 @@ -

The Book of Shaders by Patricio Gonzalez Vivo

-
-
- '; + $path = "../.."; + $README = "README"; + $language = ""; - $Parsedown = new Parsedown(); - echo $Parsedown->text(file_get_contents ('README.md')); + if ( !empty($_GET['lan']) ) { + if (file_exists($README.'-'.$_GET['lan'].'.md')) { + $language = '-'.$_GET['lan']; + $README .= $language; + } + } - echo ' -
-
- '; + include($path."/header.php"); + include($path."/chap-header.php"); + echo '
'; - include($path."/footer.php"); + include($path."/src/parsedown/Parsedown.php"); + $Parsedown = new Parsedown(); + echo $Parsedown->text(file_get_contents($README.'.md')); + + echo ' +
+
+ '; + + include($path."/footer.php"); ?> diff --git a/appendix/06/index.php b/appendix/06/index.php index 041cc63..00f2758 100644 --- a/appendix/06/index.php +++ b/appendix/06/index.php @@ -1,25 +1,32 @@ -

The Book of Shaders by Patricio Gonzalez Vivo

-
-
- '; + $path = "../.."; + $README = "README"; + $language = ""; - $Parsedown = new Parsedown(); - echo $Parsedown->text(file_get_contents ('README.md')); + if ( !empty($_GET['lan']) ) { + if (file_exists($README.'-'.$_GET['lan'].'.md')) { + $language = '-'.$_GET['lan']; + $README .= $language; + } + } - echo ' -
-
- '; + include($path."/header.php"); + include($path."/chap-header.php"); + echo '
'; - include($path."/footer.php"); + include($path."/src/parsedown/Parsedown.php"); + $Parsedown = new Parsedown(); + echo $Parsedown->text(file_get_contents($README.'.md')); + + echo ' +
+
+ '; + + include($path."/footer.php"); ?> diff --git a/appendix/index.php b/appendix/index.php index e8d7d64..3ee01f6 100644 --- a/appendix/index.php +++ b/appendix/index.php @@ -1,17 +1,23 @@ -

The Book of Shaders by Patricio Gonzalez Vivo

-
-
- '; + if ( !empty($_GET['lan']) ) { + if (file_exists($README.'-'.$_GET['lan'].'.md')) { + $language = '-'.$_GET['lan']; + $README .= $language; + } + } + include($path."/header.php"); + include($path."/chap-header.php"); + echo '
'; + + include($path."/src/parsedown/Parsedown.php"); $Parsedown = new Parsedown(); - echo $Parsedown->text(file_get_contents ('README.md')); + echo $Parsedown->text(file_get_contents($README.'.md')); echo '
@@ -22,5 +28,5 @@ '; - include($path."/footer.php"); + include($path."/footer.php"); ?>