Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

Pockets Panel Position Index

2»

Comments

  • vrijvlindervrijvlinder Papillon-Sauvage MVP

    It would be great to have settings where one can add the modules to the array via the dashboard.

  • @r_j Good morning, I know that it is possible to insert the module in the head, simply placing:

    return 'Head';

    Now I would like to know how to place it before or after the head, which function would be used and again

    Regards,

  • R_JR_J Ex-Fanboy Munich Admin

    A module is nothing more than a small class with some conventions. One of the conventions is that it has to have a method called toString. If you add the module to an asset, that function is called automatically when this asset is rendered.

    But you do not need to add the module anywhere. You can simply use its toString method anywhere else. Look at how @AjansKartal has done it in his question.

    When you do not use the addModule method, it will not be automatically rendered anywhere.

  • @r_j ok, perfect, I understand, but I do not understand how to call the module in (before head, head, after head),

    Regards,

  • R_JR_J Ex-Fanboy Munich Admin

    There is a plugin called "eventi" which is helpful when trying to find the event you need to hook.

    As far as I understand, the "Head" asset is rendered in the html <head> tag. If you want to add anything in the head tag, a module is the wrong way.

    The head is rendered by module on its own and that module provides some useful functionalities, like adding css files, or adding any tag you like. Maybe you should start a new discussion since this seems to be a complete new topic and describe what you want to add the head.

  • vrijvlindervrijvlinder Papillon-Sauvage MVP
    edited September 2017

    No @R_J he does not want to add modules or anything to the document head, he is referring to the asset #Head .

    You can't add it between the #Head and the #Content because that would be the #Body and as far as I know the #Body is not an asset it's a container.

    What I have done to add something there, I used jQuery to append to the #Head
    or use prepend to go before.

    If you target #Body , it will show before the #Head I believe, it was a while ago that I dealt with that.

  • R_JR_J Ex-Fanboy Munich Admin

    It sounds reasonable what you say, @vrijvlinder, but when I look at the template I see this:

    <head>
        {asset name="Head"}
    </head>
    

    So the "Head" asset is in between the head tags.

    You are refering to the html structure and the div IDs

    <body id="{$BodyID}" class="{$BodyClass}">
    <div id="Frame">
        <div class="Head" id="Head">
    ...
        </div>
        <div id="Body">
            <div class="Row">
    ...
                <div class="Column PanelColumn" id="Panel">
                    {module name="MeModule"}
                    {asset name="Panel"}
                </div>
                <div class="Column ContentColumn" id="Content">{asset name="Content"}</div>
            </div>
        </div>
    

    But you are correct with "You can't add it between the #Head and the #Content". I agree that JavaScript would be the only option, if it couldn't be solved with CSS.

    Just one last thought: a custom theme would be a solution, but it isn't always an option. With a custom theme you could insert a {asset name="MyTarget"} which you can address.

  • vrijvlindervrijvlinder Papillon-Sauvage MVP
    edited September 2017

    Yes, even though the names are the same they are two different things. asset head is the head of the document .

    The page structure #Head is an asset too but in another context within html structure. I know it's confusing... Head should be called #Top but people would be angry because Headers... :angry:

    <body id="<?php echo $BodyIdentifier; ?>" class="<?php echo $this->CssClass;?>">
       <div id="Frame">
          <div id="Head"><div class="Row">
    
        <div class="Menu">
    

    To do it you could
    a.create a whole new asset called #BetweenHead
    b.add a new div to the template containing that asset
    c.use jQuery to append or prepend sections

    I suffered this truth myself as I wanted to add a module between the Menu and the Body.

    Targeting the #Body , puts it before the body above everything.

Sign In or Register to comment.