We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 4385
    • 372 Posts
    I want to pre-fill a template variable with the pagetitle and the page url.

    I have a feeling the solution is a plugin. With a pseudo placeholder?
    Have the default value for my template variable contain "My page name is [pagetitle]" then have a plugin search for "[pagetitle]" and replace it with $modx->getOption(’pagetitle’);

    Would this be the best way to handle this?



      DropboxUploader -- Upload files to a Dropbox account.
      DIG -- Dynamic Image Generator
      gus -- Google URL Shortener
      makeQR -- Uses google chart api to make QR codes.
      MODxTweeter -- Update your twitter status on publish.
      • 3749
      • 24,544 Posts
      I think that might work connected to OnDocFormPrerender, but why not just put [[*pagetitle]] in the TV’s default value (or [[+pagetitle]], if it’s going to be rendered by getResources()).
        Did I help you? Buy me a beer
        Get my Book: MODX:The Official Guide
        MODX info for everyone: http://bobsguides.com/modx.html
        My MODX Extras
        Bob's Guides is now hosted at A2 MODX Hosting
        • 4385
        • 372 Posts
        BobRay you are answering questions 24/7 !!!

        I want to use it in a plugin. The editor would have the option to customize, but also to use a placeholder for pagetitle, date, and url etc..
          DropboxUploader -- Upload files to a Dropbox account.
          DIG -- Dynamic Image Generator
          gus -- Google URL Shortener
          makeQR -- Uses google chart api to make QR codes.
          MODxTweeter -- Update your twitter status on publish.
          • 3749
          • 24,544 Posts
          Quote from: bwente at Jan 09, 2011, 06:34 PM

          BobRay you are answering questions 24/7 !!!

          I want to use it in a plugin. The editor would have the option to customize, but also to use a placeholder for pagetitle, date, and url etc..

          What can I say -- I like giving advice and it’s nice to have found a place where I can do that without (hopefully) annoying people.. wink

          What I mean is, why not let the Editor enter standard MODx placeholders, leave them alone, and let MODx replace them when the page is rendered in the front end (assuming that there’s ultimately a front-end page involved)?
            Did I help you? Buy me a beer
            Get my Book: MODX:The Official Guide
            MODX info for everyone: http://bobsguides.com/modx.html
            My MODX Extras
            Bob's Guides is now hosted at A2 MODX Hosting