We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 29955
    • 9 Posts
    Quote from: slush at Apr 01, 2011, 07:48 PM

    that’s a good idea, just be aware that times generated by php are going to be based on whatever the server time is. if most of your users are within the same timezone, or within a couple zones this really won’t matter. just be aware that if people are on the opposite side of the world it’ll be backwards to them.

    Thanks for the feedback! I did a bit of research on this. I don’t really want to use a client side script for this, so it seems I will have to get registered users to enter their timezone on registration/as a field in their profile, and greet them based on that.

    Is it worth the extra effort? I think so. It’s the personal touches that distinguish your site from others!
      • Studying MODX in the desert - http://sottwell.com
        Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
        Join the Slack Community - http://modx.org
        • 29955
        • 9 Posts
        Great stuff thanks!

        After some more research, I’ve managed to put together a PHP only solution from different sources. It requires the user to enter their timezone on registration and uses that info when they log-in. I have attached a text file with a PHP example (uses a form instead of database info). I hope this will be of use to someone.
          • 3749
          • 24,544 Posts
          Thanks for the contribution! cool

          It’s people like you that make this such a great community.
            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
            • 29955
            • 9 Posts
            Thanks for the compliment @BobRay. I just wanted to give something back to the community. In future, I’d like to be more detailed and helpful to newbies like myself, so that it’s just a matter of 1-2-3 or copy and paste. I’m still struggling with some of the basics myself smiley
              • 3749
              • 24,544 Posts
              Quote from: Tiger at Apr 05, 2011, 12:15 AM

              Thanks for the compliment @BobRay. I just wanted to give something back to the community. In future, I’d like to be more detailed and helpful to newbies like myself, so that it’s just a matter of 1-2-3 or copy and paste. I’m still struggling with some of the basics myself smiley
              We all were at some point (and we all still are on some issues). wink
                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
                • 40024
                • 72 Posts
                @Tiger
                if ($current_time >= 12 && $current_time < 18) {$output = $greeting[1];} // Display greeting (afternoon)

                I think that 8 ) is appearing as emoticon with glasses. Awesome work by the way!
                  • 42035
                  • 90 Posts
                  Hello Tiger !

                  Nice sharing about Time interval..
                  I am not so good in Time functionality in php but you put nice quote. I just want to put code if any date match with any festival than it display the info about festival and wish all about festival..

                  Also it is nice when we compare the birthdate and it automatically wish user for their birthday.
                    Arkalp.com
                    • 38705
                    • 101 Posts
                    When I started with MODX (about 8 months ago) I used the IF-extra for processing some code.
                    After I while I discovered the "Output Modifiers" which basically does exactly the same, but without the use of an extra.

                    OLD:
                     [[*id:is=`6`:or:is=`10`:then=`[[!ProcessSnippet]]`:else=`[[$DoThisChunk]]`]] 


                    but after reading this blog post by the great opengeek I realised that this formatting is better:

                    NEW:
                     [[[[*id:is=`6`:or:is=`10`:then=`!ProcessSnippet`:else=`$DoThisChunk`]]]] 

                    Now the conditional is applied and for example if ID = 6 is true the result will be [[!ProcessSnippet]]... hey a snippet tag! Great, let parse that!
                    In the first example the ProcessSnippet & $DoThisChunk are parsed, after that the conditional is applied. So takes more time and resources...

                    Nowadays if I use a condtional or Output Modifier I always use this method, even if there is only one result
                    OLD:
                     [[*id:is=`6`:then=`[[!ProcessSnippet]]`]] 


                    NEW:
                     [[[[*id:is=`6`:then=`!ProcessSnippet`:else=`-NothingToProcess`]]]] 


                    So if the conditional does not apply the result will be a remark/code comment, not processed by modx: [[-NothingToProcess]]
                    If it does apply the result will be a snippet that gets processed.

                    Read Jason's blog-post if this still doesn't make sense to you....


                    Cheers
                    Michiel [ed. note: mintnl last edited this post 11 years, 5 months ago.]
                      Addict since 2012....
                      • 44258
                      • 33 Posts
                      thanks for sharing you secrets... to get success in modx.