From: Roland Häder Date: Tue, 12 Aug 2008 22:20:57 +0000 (+0000) Subject: Final fixes for helper sub/groups X-Git-Url: https://git.mxchange.org/?p=shipsimu.git;a=commitdiff_plain;h=c390121efdddeee592c953878000ff0f37770aa1 Final fixes for helper sub/groups --- diff --git a/inc/classes/main/helper/class_BaseHelper.php b/inc/classes/main/helper/class_BaseHelper.php index 0e21d88..3993e98 100644 --- a/inc/classes/main/helper/class_BaseHelper.php +++ b/inc/classes/main/helper/class_BaseHelper.php @@ -89,7 +89,29 @@ class BaseHelper extends BaseFrameworkSystem { * @return void */ protected final function addContent ($newContent) { - $this->content .= (string) trim($newContent) . "\r\n"; + $this->content .= (string) trim($newContent)."\n"; + } + + /** + * Add header content to the helper + * + * @param $content Content to to the base + * @return void + */ + protected function addHeaderContent ($content) { + // Add the header content + $this->groups['header']['content'] = (string) trim($content); + } + + /** + * Add footer content to the helper + * + * @param $content Content to to the base + * @return void + */ + protected function addFooterContent ($content) { + // Add the footer content + $this->groups['footer']['content'] = (string) trim($content); } /** @@ -317,8 +339,17 @@ class BaseHelper extends BaseFrameworkSystem { * @return $content Rendered HTML content */ public function renderContent () { + // Initialize content + $content = ""; + + // Is header content there? + if (isset($this->groups['header'])) { + // Then add it + $content .= $this->groups['header']['content']."\n"; + } // END - if + // Initiate content - $content = $this->getContent(); + $content .= $this->getContent(); // Now "walk" through all groups and sub-groups for ($idx = 1; $idx <= $this->totalCounter; $idx++) { @@ -340,6 +371,12 @@ class BaseHelper extends BaseFrameworkSystem { } // END - for + // Is footer content there? + if (isset($this->groups['footer'])) { + // Then add it + $content .= $this->groups['footer']['content']."\n"; + } // END - if + // Return it //* DEBUG: */ echo "content=
".htmlentities($content)."
(".strlen($content).")
\n"; return $content; diff --git a/inc/classes/main/helper/web/forms/class_WebFormHelper.php b/inc/classes/main/helper/web/forms/class_WebFormHelper.php index 1267520..20693f9 100644 --- a/inc/classes/main/helper/web/forms/class_WebFormHelper.php +++ b/inc/classes/main/helper/web/forms/class_WebFormHelper.php @@ -132,6 +132,9 @@ class WebFormHelper extends BaseWebHelper implements HelpableTemplate { // Open the form and remeber the form name $this->formOpened = true; + + // Add it to the content + $this->addHeaderContent($formContent); } else { // Add the hidden field required to identify safely this form $this->addInputHiddenField('form', $this->getFormName()); @@ -144,10 +147,10 @@ class WebFormHelper extends BaseWebHelper implements HelpableTemplate { // Simply close it $this->formOpened = false; - } - // Add it to the content - $this->addContent($formContent); + // Add it to the content + $this->addFooterContent($formContent); + } } /**