We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 36434
    • 33 Posts
    Hi,

    I was looking for an solution to edit the babellinks tpl into country flags instead of text.

    Maybe some already use a code like this?

    Thanks

    This question has been answered by Wanze. See the first response.

      • 31946
      • 116 Posts
      The way I would do it:
      Name the Country-Flag images the same as your cultureKeys (en.gif, de.gif, fr.gif etc.). Then the Template for the BabelLinks Snippet could look like this:
      <a href="[[+url]]" class="[[+cultureKey]][[+active:notempty=` [[+active]]`]]"><img src="pathToTheFlags/[[+cultureKey]].gif" alt="[[+cultureKey]]" class="flag" /></a>

      Styling like padding etc. via the flag class smiley
        • 36434
        • 33 Posts
        But i can't just create snippet, because it will put
        <?php
        before my code when i save it

        btw

        #flag {
        position:fixed;
        top:30px;
        right:30px;
        }


        i've put this in my style.css it has to float on the right top corner of my screen
        • discuss.answer
          • 31946
          • 116 Posts
          Hi deTuinman,

          You don't have to write a Snippet. Just put the TemplateCode in a Chunk, let's say "MyBabelTpl".
          Then call the BabelLinks Snippet with this template:
          [[BabelLinks? &tpl=`MyBabelTpl`]]


          This Tpl will be used for every language you have set up. To place them all on the right top corner you can use a container and call the Snippet inside:
          <div id="flag">[[BabelLinks? &tpl=`MyBabelTpl`]]</div>

          To style a class in css, you must use a dot in front of the nam, the "#" Symbol is to reference ID's.

            • 36434
            • 33 Posts
            thanks learnfull and the perfect solution!
              • 43864
              • 151 Posts
              I have a familiair problem: http://forums.modx.com/thread/77294/babel-translation#dis-post-426758

              Thx in advance for the help.