From 5adfd66d50473f239e271482f64d981875bc5d5e Mon Sep 17 00:00:00 2001 From: danpros Date: Wed, 24 Jan 2024 11:22:54 +0700 Subject: [PATCH] Include functions.php If there is functions.php inside themes root, include it. --- README.md | 6 +++--- config/users/username.ini.example | 2 +- system/includes/dispatch.php | 5 +++++ themes/blog/static.html.php | 4 ++-- 4 files changed, 11 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 2947a7d..f3f7a52 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ Install HTMLy using the source code: 4. Follow the installer to install HTMLy. 5. The installer will try to delete itself. Please delete the installer manually if the `install.php` still exist. -**Note:** If you don't need to log in to the dashboard right away, just rename `config.ini.example` to `config.ini`, delete `install.php`, and your are set. It's always good practice to set the `site.url` +**Note:** If you don't need to log in to the dashboard, just rename `config.ini.example` to `config.ini`, delete `install.php`, and you are set. It's always good practice to set the `site.url` ### Online install @@ -50,14 +50,14 @@ If you use the dashboard to write your posts, the folder structure and filenames The following is an example of a folder and file structure from HTMLy: ```html -content/my-username/blog/my-category/post/2024-01-10-25-35-45_tag1,tag2_my-post-slug.md +content/my-username/blog/my-category/post/2024-01-10-15-35-45_tag1,tag2_my-post-slug.md ``` Here's the explanation: * `my-username` is the username. * `my-category` is the content category. * `post` is the content type. Available content type `post`, `video`, `audio`, `link`, `quote`. -* `2024-01-10-25-35-45` is the published date. The date format is `Y-m-d-H-i-s` +* `2024-01-10-15-35-45` is the published date. The date format is `Y-m-d-H-i-s` * `tag1,tag2` are the tags, separated by commas * `my-post-slug` is the URL diff --git a/config/users/username.ini.example b/config/users/username.ini.example index b2c0fb9..7dd5ec4 100644 --- a/config/users/username.ini.example +++ b/config/users/username.ini.example @@ -1,7 +1,7 @@ ;Password password = yourpassword -; Encryption. Set to clear, and later it will changed to password_hash automatically during login +;Encryption. Set to clear, and later it will changed to password_hash automatically during login encryption = clear ;Role diff --git a/system/includes/dispatch.php b/system/includes/dispatch.php index 4c5a3af..dd989f1 100644 --- a/system/includes/dispatch.php +++ b/system/includes/dispatch.php @@ -380,8 +380,13 @@ function render($view, $locals = null, $layout = null) if (($view_root = config('views.root')) == null) error(500, "[views.root] is not set"); + + $fnc = "{$view_root}/functions.php"; ob_start(); + if (file_exists($fnc)) { + include $fnc; + } include "{$view_root}/{$view}.html.php"; content(trim(ob_get_clean())); diff --git a/themes/blog/static.html.php b/themes/blog/static.html.php index 059affb..7b2013b 100644 --- a/themes/blog/static.html.php +++ b/themes/blog/static.html.php @@ -14,10 +14,10 @@

- + - +