We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 3749
    • 24,544 Posts
    Quote from: sottwell at Jul 26, 2008, 01:28 AM

    Couldn’t a snippet do a check on the version, and execute different functions depending on the version? Even break the functions out into two separate include files, and include the appropriate one?

    That’s basically what I’ve done with SPForm and extMemberCheck although the code differences were so small, I just used if() statements rather than breaking things out into include files. EzFAQ seems to work as is.

    $v = $modx->getVersionData();
    $version = $v['version'];
    
    if ($version < 2) {
    
    } else {
    
    }
      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
      • 28042 ☆ A M B ☆
      • 24,524 Posts
      Well, I was thinking separate include files to make life easier if there needed to be changes to the version-specific code. Especially with Revolution, since it’s pretty much still a moving target at this point.
        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
        • 22303 MODX Staff
        • 10,725 Posts
        Quote from: sottwell at Jul 27, 2008, 01:18 AM

        Well, I was thinking separate include files to make life easier if there needed to be changes to the version-specific code. Especially with Revolution, since it’s pretty much still a moving target at this point.
        :’( The core framework code in Revolution is not a moving target any more than 0.9.6.x and hasn’t been for at least a year...if anything changes it is from feedback from developers.

        Regardless, I don’t see why you can’t just maintain two source branches, one for Revolution and one for legacy. Then you can optimize and tailor those versions to the platform in whatever ways work best for that component. That’s what Subversion is made for IMHO, and that’s how I would prefer the "reference" components be maintained by the team.

        Version checking is for upgrade or other utility scripts, not production code, but again, these are my opinions...
          • 28042 ☆ A M B ☆
          • 24,524 Posts
          Well, just goes to show how much I know about it. Hard to teach old dogs new tricks. wink
            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
            • 3749
            • 24,544 Posts
            Quote from: OpenGeek at Jul 27, 2008, 09:45 AM


            Regardless, I don’t see why you can’t just maintain two source branches, one for Revolution and one for legacy. Then you can optimize and tailor those versions to the platform in whatever ways work best for that component. That’s what Subversion is made for IMHO, and that’s how I would prefer the "reference" components be maintained by the team.

            Version checking is for upgrade or other utility scripts, not production code, but again, these are my opinions...

            Your opinions carry a whole lot of weight with all of us.

            I can certainly maintain seperate versions in SVN, but there’s a price for that, especially when dealing with several different snippets. It means that when someone suggests a good improvement, I have to change two separate files, test them separately, put two new versions in the repository, and explain the changes twice on the respective repository pages.

            When the only difference between the two versions is a few lines of code in one spot and the performance hit is the time it takes to load those few lines and execute one if statement, I’m having a hard time with the cost-benefit analysis for maintaining the two separate versions. (I’m definitely planning to have the Revolution code section optimized for Revolution.)

            As for Susan’s idea, I’d rather maintain one file than three. wink

            I’m still willing to be convinced that separate files are the way to go and there are probably issues I’m not thinking of.
              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