aboutsummaryrefslogtreecommitdiffstats
path: root/core/include/page/main.php
AgeCommit message (Collapse)AuthorFilesLines
2021-06-22Implement new Repository and Entity classesThomas Lange1-60/+53
This commit adds new Repository and Entity classes which are better abstracted from the rest of the application. They dont know anymore about configuration options or how to parse to HTML because this is not the job for the ORM but for other parts of the application. The previous commits were a preparation for this big change. An entity now represents just a single record from a specific table of the database – nothing more. The repositories job is it to fetch or update records of the database and instantiate the entities. Another problem that was solved is the high amount of database queries that was needed before. For example, on the blogs home page first were all 10 latest post IDs fetched from the database and then another query was executed with "WHERE id = :id" for *each* single post?! ... This problem is solved with the new repository classes; they now use a single query to fetch and build the entities of the 10 latest posts. This change also solves the problem with database queries spread across the application and limits the exzessive use of try/catch blocks which were used before. The new classes make the whole code much cleaner. :)
2021-06-21Rename "attr" method of Item class to "get"Thomas Lange1-1/+1
2021-06-21Use getEntityURL method of Application classThomas Lange1-1/+1
This commit replaces all calls to "$Item->getURL()" with calls to the previously added "getEntityURL" method of the "Application" class.
2021-06-14Remove more redundant try/catch blocksThomas Lange1-34/+18
Remove all try/catch blocks where the exception handling did not differ from the exception handler already defined by "set_exception_handler".
2019-10-29Remove PHP closing tags and add LF to text filesThomas Lange1-1/+0
Remove the unnecessary PHP closing tags and ensure that *all* text files ending with a LF character.
2017-10-24You can now access item data in the main.php template (the file which ↵Thomas Lange1-0/+5
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 <meta> 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 } }
2017-10-24Some comments have been updated, unnecessary whitespace at the end of some ↵Thomas Lange1-1/+2
files was removed and some missing PHP closing tags were added.
2017-05-30 Several changes have been made in this commit, which together with the ↵v2.2Thomas Lange1-4/+4
previous commits result in version 2.2 [changed template parameters]: + Implemented [core]: A new method called "getAll" has been added to the "Attribute" class which now returns all attributes as key->value array. The first parameter can be an array with attribute names which shall be excluded from returning. + Optimization [core]: The function "generateItemData" has been renamed to "generateItemTemplateData" and has been restructured to use the new implemented method "getAll" from the "Attribute" class. + Optimization [core]: The function "generateNaviTemplate" has been added and the functions "generatePageNaviTemplate", "generatePostNaviTemplate" and "generateUserNaviTemplate" have been restructured to make use of the new "generateNaviTemplate" function to reduce duplicate code. + Optimization [core]: Several files within the admin directory has been optimized to use the new "getAll" method of the "Attribute" class. + Optimization [core]: Several code optimizations have been made to the "HTTP" class. + Optimization [admin template]: All occurences of $PAGE['ID'], $POST['ID'] and $USER['ID'] have been replaced with $PAGE['ATTR']['ID'], $POST['ATTR']['ID'] and $USER['ATTR']['ID'] to make it more consistent. You now have to use ['ATTR']['ID'] instead of ['ID'] in your templates to get the ID of an item! Template upgrade to version 2.2 (only for customized templates): SEARCH: ['ID'] REPLACE: ['ATTR']['ID']
2017-05-05A significant increase in the response time has been achieved, since the ↵v2.1Thomas Lange1-1/+1
template parameters "$ITEM['BODY']['TEXT']" and "$ITEM['BODY']['HTML']" are now no longer strings but closures (anonymous functions). This means that the underlying logic, which parses the content or converts it into Markdown, is not executed until one of these parameters is really needed and called in the template (which maybe significantly increases the response time on a long list of items which not use one of those two parameters). This means that within templates you now have to call these parameters in the following way (note the brackets at the end, which represent a function call): <?=$ITEM['BODY']['TEXT']()?> <?=$ITEM['BODY']['HTML']()?> In the background, the anonymous functions are called and executes $Item->getBody() and $Item->getHTML() only when needed. Previously, $Item->getBody() and $Item->getHTML() were basically executed and the parsed content was passed to the template, regardless of whether these parameters are required in the template or not!
2017-04-24Nested function calls for generating the meta description are removed and a ↵Thomas Lange1-1/+1
function was added to perform this task.
2017-04-11The system directory has been moved to a non-public directory. After the ↵v1.2Thomas Lange1-0/+90
commit e33c245d910e55b8cab407a03e669470509a705d, it is no longer necessary that the directory is publicly accessible via HTTP because all requests are running through the router.