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

    I am new to modx and not sure how to do this? I able to post to my facebook account via JavaScript from my site. I would like to know if I can embed the JavaScript code to do this into modx. Specifically I would like to add this when you are on a page that you are editing, I would like to know if there is a way I can just add some code (like a TV, I guess?) to have it show up in pages. Then the user would click this button and it would then post to their facebook account?

    I am aware I could make a plugin and then have it post through onpublish feature but I am wondering if there is a way I can add a button directly into the page.

    Any suggestions?

    Thanks,
    Bart
      • 22303 MODX Staff
      • 10,725 Posts
      Quote from: digitalbart at Jan 07, 2010, 10:29 AM

      I am aware I could make a plugin and then have it post through onpublish feature but I am wondering if there is a way I can add a button directly into the page.
      You can use a plugin with the events OnDocFormPrerender and/or OnDocFormRender to inject HTML into the manager UI for creating/editing a Resource, then add processing to OnBeforeDocFormSave and/or OnDocFormSave.
        • 36723
        • 94 Posts
        Ok thank you for the response. I will give that a try and let you know how it goes?
          • 36723
          • 94 Posts
          I am not quite sure where to start on injecting html into the manager. Any tips, examples or pointers where I can look would be greatly appreciated.

          Thanks you,
          Bart
            • 8779
            • 93 Posts
            You can use a chunk to write a code
            and call that chunk in your template

            In my site, I use code from http://addthis.com, to share on facebook wall
            there’s a lot of widget code for social network such as facebook, twitter and they have code for share on digg, etc