From 95b3eef6eb910b4af1f61c3e262e7824df47bdd6 Mon Sep 17 00:00:00 2001 From: Thomas Lange Date: Tue, 24 Oct 2017 21:02:06 +0200 Subject: You can now access item data in the main.php template (the file which contains the basic HTML framework) for pages, posts and users. This makes it possible to use the optional argument field in the content editor to add additional HTML tags (or something else) for a specific page, post or user if you implement this functionality into your template. The following snippet shows how you can access the item data in the main.php template and which parameters are defined for each type of item (currently, there are three types: PAGE, POST and USER): if(isset($TYPE)) { switch($TYPE) { case 'PAGE': # $PAGE and associated $USER is accessible var_dump($PAGE['ARGV']); break; case 'POST': # $POST and associated $USER is accessible var_dump($POST['ARGV']); break; case 'USER': # $USER is accessible var_dump($USER['ARGV']); break; default: # Nothing } } --- core/include/page/main.php | 5 +++++ core/include/post/main.php | 5 +++++ core/include/user/main.php | 4 ++++ 3 files changed, 14 insertions(+) diff --git a/core/include/page/main.php b/core/include/page/main.php index e50445a..7f1aa02 100644 --- a/core/include/page/main.php +++ b/core/include/page/main.php @@ -52,6 +52,11 @@ try { 'OG_IMAGES' => $page_data['FILE']['LIST'] ]); + # Get access to the current item data from main template + $MainTemplate->set('TYPE', 'PAGE'); + $MainTemplate->set('PAGE', $page_data); + $MainTemplate->set('USER', $user_data); + echo $MainTemplate; } diff --git a/core/include/post/main.php b/core/include/post/main.php index 3cdb792..aa5dc50 100644 --- a/core/include/post/main.php +++ b/core/include/post/main.php @@ -52,6 +52,11 @@ try { 'OG_IMAGES' => $post_data['FILE']['LIST'] ]); + # Get access to the current item data from main template + $MainTemplate->set('TYPE', 'POST'); + $MainTemplate->set('POST', $post_data); + $MainTemplate->set('USER', $user_data); + echo $MainTemplate; } diff --git a/core/include/user/main.php b/core/include/user/main.php index 1028a2e..4f30020 100644 --- a/core/include/user/main.php +++ b/core/include/user/main.php @@ -67,6 +67,10 @@ try { 'OG_IMAGES' => $User->getFiles() ]); + # Get access to the current item data from main template + $MainTemplate->set('TYPE', 'USER'); + $MainTemplate->set('USER', $user_data); + echo $MainTemplate; } -- cgit v1.2.3