Veedoo
 added a discussion 

Hello,
I've come to a situation when I need to display additional content in header of site. I would like to add a placeholder like and replace it with some content when template is rendered.
However, the only place for rendering such placeholders I found is BxDolTemplate->parseSystemKey(), which is a core class.
So, my question is how do I add processing of custom placeholders without modifying core classes? Is this possible?

Secondly, I am slightly confused with injections. I was able to add an injection in database (by copying and modifying head injection) and display it on the site, but had no success in displaying it in Studio->Designer->Injections. How do I add my custom injections there?

Thank you.

  • 383
Comments
  • Hello Veedoo !

    If you write your own application then custom keys can be added via redeclaration of this method in the child of Template class. For example, for Persons app, it would be written in BxPersonsTemplate.php file.

    About your second question - this isn't clear why you added your own injections via database but not via Studio. It's correct to do it only there.

    0 0 0 0 0 0
    • Thank you for the response, LeonidS !
      As far as I understand, I can add custom placeholders for app related views when writing an app.
      But how do I change _sub_header.html processing, if it is processed by core class?
      I tried experimenting with child theme, but had no success yet.

      Regarding injections, could you please describe where can I add them in Studio?
      Thank you

      0 0 0 0 0 0
      • If you will write your own template app (or if you agree to upgrade some of the available templates manually you may do it there) then you may have the own variant of _sub_header.html.

        About injections - the way which you described (Studio->Designer->Injections) is the right for the HEAD and BODY injections. Other added will not be shown there.

        0 0 0 0 0 0
        • If you need to add own system replacement marker to the template you need to add it in your BxTemplFunctions.php file the following method:

              function TemplPageAddComponent($sKey)
              {
                  switch( $sKey ) {
                      case 'test':
                          return false; // return here additional components
                      default:
                          return false; // if you have not such component, return false!
                  }
              }

          after adding it you can use __test__ in _sub_header.html file.

          0 0 0 0 0 0
          • Also you can read here on how to create your own template module:

            https://github.com/unaio/una-vendor-template

            0 0 0 0 0 0
            • Or work in between Una and browser.

              0 0 0 0 0 0
              • Thank you, Alex T⚜️ !

                I cannot find anything like BxTemplFunction.php in the sample template module. Where can I get an example of this class?

                Also, I would like to clarify the use of injections: say, we have before_main_logo injection (if I'm not mistaken - this is default for UNA templates), which doesn't exist. If I create an injection with such a name in the database, it will be shown on the website.
                However, I don't see it under Designer->Injections, meaning that user cannot modify an injection.
                How can I display injections under Designer->Injections?

                Thank you

                0 0 0 0 0 0
                Not logged in users can't 'Comments Post'.
                Info

                UNA - Social Media Software Framework

                Close