Is UNA really limiting code inserts? No it isn't. Just read this ;)

What I observe here is a frequent complain "how to put code in our pages?!" "it is not possible!"
The method below is a super easy way to insert any code to your pages.
1. Create a raw block, position it where ever you like your code to appear in your UNA page. In that block only write a unique and strong place holder for instance *my?cod!e123*.

2. Go to page.php have a backup copy. replace these lines as described:

if ($oPage) {
$oTemplate->setPageNameIndex (BX_PAGE_DEFAULT);
$oTemplate->setPageType ($oPage->getType());
$oTemplate->setPageContent ('page_main_code', $oPage->getCode());
} else {

change to:

if ($oPage) {
$oTemplate->setPageNameIndex (BX_PAGE_DEFAULT);
$oTemplate->setPageType ($oPage->getType());
$oTemplate->setPageContent ('page_main_code', $oPage->getCode());}
else {
$currentpage = ob_get_clean();
now you have the html in your hand at $currentpage which is about to send to the browsers. Just replace your placeholder with your code, and echo the current page :) that's all.

$currentpage= str_replace ('*my?cod!e123*','ANY CODE',$currentpage);
echo $currentpage;

with this simple method you will open a big free area and use UNA's abilities with less restriction. Codes are from UNA 9.0, but there will not be so much change in the mechanism.

Advantages are:

 you don't touch Una code and dont mix the page.

You can insert any code of yours

You may use the parameters like user id etc from Una functions as they are already loaded at the beginning of the page.

You may use the same block on different positions and pages.

Safety is measured by how safe your own code is.

Heading title padding background can be set by Una block settings

  • 1471
  • More
Replies (4)
    Login or Join to comment.