We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 26435
    • 1,193 Posts
    Quote from: yentsun at Mar 28, 2006, 07:24 PM

    Couldn’t get this to work...

    First try - the parser gave me an error message like
    somethingttfbox function expected parameter 1 to be double, but sting was given
    - I removed fontsize from the parameters

    Second try - parser gave this
    Couldn't open font

    I looked throught the code of this snippet and didn’t find any absolute filepaths (which as I know are required for this php-ttf functions to locate the tff-file, smth. like "/home/prsound/public_html/assets/files/fonts/font.ttf""). I wonder how the snippet should work in this part... yeah, I’ve put the ttf file into assets/files/fonts/ - didn’t help. So I currenly use Etomite snippet (MakeImage) for this, hope to use yours though.

    call it like this:
    [[gtext? &font=`myfont.ttf` &fontsize=`10` &color=`#ffffff` &bgcolor=`#000000` &text=`My Text`]]
    


    I tried this on my site inside a [*TV*] by calling it like this:
    <img alt="My Text" src="[[gtext? &font=`myfont.ttf` &fontsize=`10` &color=`#ffffff` &bgcolor=`#000000` &text=`My Text`]]" />


    Thanks for this snippet paladin. It works great!

    -sD-
    scotty Delicious
      Husband, Father, Brother, Son, Programmer, Atheist, Nurse, Friend, Lover, Fighter.
      All of the above... in no specific order.


      I send pointless little messages
      • 33114
      • 518 Posts
      Oh well! That worked okay!! BTW... what is the difference giving parameters with or without "`"? Thanks
        http://modx.ru - российская поддержка MODx
        http://newscup.ru - экспериментальный проект
        http://yentsun.com - персональный сайт
        • 25663 MODX Staff
        • 12,272 Posts
        Without the question-mark it theoretically should not work.
          Ryan Thrash, MODX Co-Founder
          Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
          • 26435
          • 1,193 Posts
          Sorry to interject Ryan,
          but I think the question mark above was punctuation to his question.
          As to the question, AFAIK the tick (` above the tab key) is used in snippets to visually separate variable strings specified in the snippet call to be passed to the snippet. However, I have had successful execution of snippets with and without the ticks.

          -sD-
            Husband, Father, Brother, Son, Programmer, Atheist, Nurse, Friend, Lover, Fighter.
            All of the above... in no specific order.


            I send pointless little messages
            • 25663 MODX Staff
            • 12,272 Posts
            LOL ... (note to self... slow down on occasion)
              Ryan Thrash, MODX Co-Founder
              Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
              • 27
              • 117 Posts
              Hi all

              Putting this snippet inside a chunk made it break, I’m wondering it thats usual for snippets or is it just this one (i tried removing whitespace as outlined in http://modxcms.com/forums/index.php/topic,1519.msg10192.html - but no luck

              any guidance would be much appreciated

              btw, the snippet does work for me when its not in a chunk... hmmm

              cheers

              0
                • 22303 MODX Staff
                • 10,725 Posts
                If you’re page is cacheable, then the full content of the chunk would be cached and the snippet would most likely only work if called with the non-cacheable snippet tags:

                [!gtext!]
                  • 27
                  • 117 Posts
                  ahhhh

                  so thats what the difference between [[snippet]] and [!snippet!] is!

                  fixed! thanks a million!

                  0ad
                    • 12110
                    • 122 Posts
                    gtext (thanks paladin!) is a charm and MODx is continuing to surprise me very positively ...

                    I managed to generate dynamic graphical text from a document TV with the following code in my template - may be it’s a motivation to use this great snippet for others as well (my MODx path is not root but /modx):

                    <img alt="[*longtitle*]" src="/modx[!gText?font=`frutige1.ttf`&fontsize=`18`&color=`#13c247`&bgcolor=`#000000`&text=`[*longtitle*]`!]" />


                    (BTW: had to strip all empty spaces between within the snippet call.)

                    cool Question: Is this the best way to call my gText snippet oder could / should this even better be done with a chunk or an other method?
                      • 12110
                      • 122 Posts
                      Having said above I just encountered a little problem ...

                      I’m getting this (see attachment) - very strange ? There aren’t so much spaces in the longtitle ...

                      The [*longtitle*] rendering in the alt-attribute (see post and code from my post before this) is ok:

                      alt="IZB Soft GmbH"


                      Any Ideas huh