We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 8895
    • 76 Posts
    hi everyone!

    i want to implement some php code into modx - i got a nice little image gallery that ive done in the past...

    so ive tried including some simple php code (print ’hello world’) - yet it wont display on the page =/

    can any1 give me a quick strters guide? - ive looked at the modx wiki about creating snippets but it seems to me like a php introduction -> i cant really tell how and what...

    thanks!
      • 25663 MODX Staff
      • 12,272 Posts
      Try this:

      $out = "Hello World";
      
      return $out;
        Ryan Thrash, MODX Co-Founder
        Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
        • 8895
        • 76 Posts

        ive tried return ...

        what i basicaly need to know is...
        how do i include a file to a snippet best?
        how can i transfer variables from modx to a snippet or even from snippet to snippet and the other way arround?
        for db access, do i need to make a new db-connect?

        and how does the logic’s work?
        is the snippet basicly a php file, into which an other php file is included? and do they behave the same/or are there differences?
          • 696
          • 46 Posts
          take a look at http://modxcms.com/forums/index.php/topic,3061.msg21617.html

          you may need to change any include variables in the image gallery you use so that other includes then match...

          alternativly consider resising i-frame which would be the easiest option (wrapper)
            • 8895
            • 76 Posts
            thnx aikdo!
            i will try that - i doubt that iframe is a solution (well it may work, but its an unclean solution - better make it the good way tongue)