{"action":"created","issue":{"url":"https://api.github.com/repos/GibbonEdu/core/issues/608","repository_url":"https://api.github.com/repos/GibbonEdu/core","labels_url":"https://api.github.com/repos/GibbonEdu/core/issues/608/labels{/name}","comments_url":"https://api.github.com/repos/GibbonEdu/core/issues/608/comments","events_url":"https://api.github.com/repos/GibbonEdu/core/issues/608/events","html_url":"https://github.com/GibbonEdu/core/issues/608","id":356551718,"node_id":"MDU6SXNzdWUzNTY1NTE3MTg=","number":608,"title":"Code style: Separating display logic from business logic","user":{"login":"yookoala","id":91274,"node_id":"MDQ6VXNlcjkxMjc0","avatar_url":"https://avatars2.githubusercontent.com/u/91274?v=4","gravatar_id":"","url":"https://api.github.com/users/yookoala","html_url":"https://github.com/yookoala","followers_url":"https://api.github.com/users/yookoala/followers","following_url":"https://api.github.com/users/yookoala/following{/other_user}","gists_url":"https://api.github.com/users/yookoala/gists{/gist_id}","starred_url":"https://api.github.com/users/yookoala/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yookoala/subscriptions","organizations_url":"https://api.github.com/users/yookoala/orgs","repos_url":"https://api.github.com/users/yookoala/repos","events_url":"https://api.github.com/users/yookoala/events{/privacy}","received_events_url":"https://api.github.com/users/yookoala/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-09-03T15:51:54Z","updated_at":"2018-09-03T23:49:04Z","closed_at":null,"author_association":"NONE","body":"To put it simply, separate \"what to display\" from \"how to display them\" into different code chunks.\r\n\r\nTo truly fix #208, the framework need to have enough flexibility to easily do theming code without messing up the core programming logic. Then applying existing responsive framework (e.g. [Bootstrap](https://getbootstrap.com/)) should be easy. This will also give more flexibility for theming in the future.\r\n\r\nMost existing files, especially `index.php` suffers from mixing business logic with display logic. Like,\r\n\r\n```php\r\n<html>\r\n<title>\r\n<?php\r\n                echo $_SESSION[$guid]['organisationNameShort'].' - '.$_SESSION[$guid]['systemName'];\r\n                if ($_SESSION[$guid]['address'] != '') {\r\n                    if (strstr($_SESSION[$guid]['address'], '..') == false) {\r\n                        if (getModuleName($_SESSION[$guid]['address']) != '') {\r\n                            echo ' - '.__($guid, getModuleName($_SESSION[$guid]['address']));\r\n                        }\r\n                    }\r\n                }\r\n?>\r\n</title>\r\n```\r\n\r\nIt can be broken down into 2 chunks:\r\n```php\r\n$title = $_SESSION[$guid]['organisationNameShort'].' - '.$_SESSION[$guid]['systemName'];\r\nif ($_SESSION[$guid]['address'] != '') {\r\n    if (strstr($_SESSION[$guid]['address'], '..') == false) {\r\n        if (getModuleName($_SESSION[$guid]['address']) != '') {\r\n            $title .= ' - '.__($guid, getModuleName($_SESSION[$guid]['address']));\r\n        }\r\n    }\r\n}\r\n\r\n```\r\n\r\n```php\r\n<title><?php echo $title; ?></title>\r\n```\r\n\r\nThe 2 chunks can exists on different script files for that specific purpose. The 2nd chunk can later be easily re-written with modern theme engines. There is CPU and memory cost, but the difference, when running on modern computers, is acceptable. "},"comment":{"url":"https://api.github.com/repos/GibbonEdu/core/issues/comments/418206427","html_url":"https://github.com/GibbonEdu/core/issues/608#issuecomment-418206427","issue_url":"https://api.github.com/repos/GibbonEdu/core/issues/608","id":418206427,"node_id":"MDEyOklzc3VlQ29tbWVudDQxODIwNjQyNw==","user":{"login":"crayner","id":918953,"node_id":"MDQ6VXNlcjkxODk1Mw==","avatar_url":"https://avatars3.githubusercontent.com/u/918953?v=4","gravatar_id":"","url":"https://api.github.com/users/crayner","html_url":"https://github.com/crayner","followers_url":"https://api.github.com/users/crayner/followers","following_url":"https://api.github.com/users/crayner/following{/other_user}","gists_url":"https://api.github.com/users/crayner/gists{/gist_id}","starred_url":"https://api.github.com/users/crayner/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/crayner/subscriptions","organizations_url":"https://api.github.com/users/crayner/orgs","repos_url":"https://api.github.com/users/crayner/repos","events_url":"https://api.github.com/users/crayner/events{/privacy}","received_events_url":"https://api.github.com/users/crayner/received_events","type":"User","site_admin":false},"created_at":"2018-09-03T23:49:04Z","updated_at":"2018-09-03T23:49:04Z","author_association":"CONTRIBUTOR","body":"hear hear"}}
{"actor":{"display_login":"crayner"}}