ModifyHomepage with CMSB 3+

6 posts by 2 authors in: Forums > CMS Builder: Plugins & Add-ons
Last Post: March 1, 2016   (RSS)

I use the add-on ModifyHomepage - it's a pretty simple add-on, but it's getting "hosed" in CMSB 3.  If I just use plain text for the header, there is no problem.  But I use an image at the top of the page with my logo.  The HTML for the image is somehow getting clobbered by the new setup - for example, the <img is being turned into &lt;img which is causing the literal <img to be placed in my heading instead of the image it's supposed to be.

What is the way to solve this in CMSB V3+

Thanks in advance.

Gary.

In order to get this working the way it should, I had to make a change to the base software - I have not worked with InteractiveTools yet to find out what, if any, problems will occur because of this:

function _adminUI_inputArraysToHTML($args) {
 
  // caller must supply PAGE_TITLE as an array
  if (is_array(@$args['PAGE_TITLE'])) {
    $pageTitleHtml = '';
    foreach ($args['PAGE_TITLE'] as $label => $url) {
      if (is_int($label)) { $label = $url; $url = null; } // allow [ 'foo' ] to be a shortcut for [ 'foo' => null ] (instead of [ 0 => 'foo' ])
      if ($pageTitleHtml) { $pageTitleHtml .= ' &gt; '; } // separate breadcrumbs with " > "
      // append $label (and optionally link it to $url)
      if ($url)           { $pageTitleHtml .= '<a href="' . htmlencode($url) . '">' . htmlencode($label) . '</a>'; }
      else                { $pageTitleHtml .= $label; /*htmlencode($label); */                                                 }
    }
    $args['PAGE_TITLE'] = $pageTitleHtml;
  }
  elseif (@$args['PAGE_TITLE']) { die(__FUNCTION__ . ": PAGE_TITLE must be an array"); }

Effectively, I had to remove the htmlencode for page titles that were not label->url combos.

Again, please note, this has not been an accepted solution by InteractiveTools, so only use if you are absolutely sure you need to tweak this base code module for your needs.

By Damon - March 1, 2016

Hi Gary,

I just tested the Modify Homepage v1.00 with CMS Builder 3.02 and it worked for me without changing any library files.

Attached is a screenshot that shows the Modify Homepage working with links, image and text.

What version of CMS Builder are you using?

Cheers,
Damon Edis - interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/
Attachments:

modify_homepage_example.png 105K

Hi Damon,

The problem is HTML markup in the TITLE portion of the page, not the content portion.

Thanks,

Gary.

By Damon - March 1, 2016

Hi Gary,

OK, I see what you are referring to. In the Modify Homepage plugin, the title area was only suppose to be used for text. This is why everything was output inside H2 tags. It was never designed for adding HTML and doing so usually caused formating and other issues.

Make note of your custom code change in a log with CMS Builder as a future upgrade will overwrite it and you will need to make that change again.

Another option is to leave the title area empty, which will create a narrow grey title bar. Then all the content could be just added to the main content area.

Cheers,
Damon Edis - interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/