Skip to content
General Revolution Evolution Add-ons International
Login | Register | MODX.com
MODX Open Source Content Management System, Framework, Platform and More.
Find a Partner | Hosts + SaaS | Jobs | Donate
  • RegisterSign Up with the MODX Community
  • LoginUse Your MODX.com Account
  • MODX Community Forums
  • Add-ons
  • Creating & Repurposing Content
  •  
  • Ditto extender for custom placeholder (Evolution)#

  • 7155
    160

    designetic Reply #1, 11 months, 2 weeks ago

    Reply
    • Link to this post#1
    Hi,

    I am using the latest Evolution Release and have phX installed.

    My challenge is that I have a TV that is a date variable(Unixtime) used in a Ditto call.

    It formats nicely using &dateFormat parameter without any problems

    I now want to further work on the [+date+] placeholder that is created by Ditto.

    Instead of outputting it as it is, I would like to split it so that I have a Month separated from Day. I use the format string `%b %d`. So intended to split it using the space as a delimiter(straightforward in PHP)

    Here are some of the things I tried that have failed me:

    - I tried creating a snippet that calls and returns the [+date+] placeholder using $modx->getPlaceholder('date') and also tried $modx->placeholders['date']

    - I tried and failed to understand how to create a custom extender, which I assume is what I need so I can split the [+date+] placeholder as I require using PHP. I have gone through the specific example in the example.extender.inc.php file but I have failed to make sense of it.

    Here are some search results I went through but havent really helped me understand:

    http://modxcms.com/forums/index.php/topic,27564.msg168495.html
    http://modxcms.com/forums/index.php?topic=16013.0
    http://modxcms.com/forums/index.php?topic=35848.0
    http://modxcms.com/forums/index.php?topic=26641.0

    From the WIKI
    http://wiki.modxcms.com/index.php/Ditto_Custom_Placeholders

    Perhaps I am slow (shrug), but I did try.

    Hope someone can help.

    Thanks for the great tool!!!





  • 28042
    15,111
    How MODx Evo Works

    Log in to an Evo Manager username guest, password guestuser.

    sottwell Reply #2, 11 months, 2 weeks ago

    Reply
    • Link to this post#2
    You could try using the [+date+] placeholder twice:
    No, of course not! The date placeholder is already converted from the raw timestamp, so applying date formatters to it won't work!

    Try using the raw [+createdon:date=%b+] and [+createdon:date=%d+] instead.

    And you don't need to install the phx plugin for this; Ditto has its own phx internally.


  • 7155
    160

    designetic Reply #3, 11 months, 2 weeks ago

    Reply
    • Link to this post#3
    Thanks Susan,

    My original intention had been to work on the already formatted value. e.g, the date format string I used was `%b %d`( the Ditto call would have the parameters: &dateFormat=`%b %d` &dateSource=`MyDateTV` ). Since Ditto outputs the result in the placeholder called [+date+], all I wanted to do was work on that output value.

    BUT, as always , I think you've provided me with an elegant solution. I didnt know Ditto had its internal phx. Thanks again, Susan!

    P.S.
    I think I would still like to understand how the Ditto extenders work. May come in handy


  • 7155
    160

    designetic Reply #4, 11 months, 2 weeks ago

    Reply
    • Link to this post#4
    That did it! Thanks, Susan. You may have forgotten to put backticks.





Actions

Login to Post

Other Support Options

To file a bug or make a feature request visit our issue tracker, or you can also purchase commercial support.

Love MODX?

If you build sites for a living with MODX or just love using it, why not give back?

Information

Posted in this thread:
designetic, sottwell

 
Back to Top

MODX Global HQ

1333 N Stemmons Fwy, Ste 110
Dallas, TX 75207
United States

+1 (469) 777-MODX (6639)

The MODX Company

  • Contact
  • Media Center
  • Careers at MODX
  • Wall of Fame
  • The MODX Blog

Sponsors

SoftLayer Firehost: Secure Cloud Hosting

Stay Connected

Read our previous email newsletters.

Twitter Facebook Google+ LinkedIn github Feeds

Privacy Policy | Terms of Service | Pixels by AKTA Web Studio© 2005-2012 MODX. All rights reserved. Trademark Policy