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: splittingred at Feb 19, 2010, 05:18 PM

    Quote from: BobRay at Feb 19, 2010, 04:52 PM

    It might be worth defining some constants for that.

    Nope; since they’re dynamic, based on whatever ones you create in System -> Content Types. Try:

    $contentType = $modx->getObject('modContentType',array('mime_type' => 'text/html'));
    if ($contentType) {
        $resource->set('content_type',$contentType->get('id'));
    }
    


    Got it. Although I think a case could be made for having some default ones with constants that don’t change.
      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
      • 28215
      • 4,149 Posts
      Quote from: BobRay at Feb 19, 2010, 05:25 PM

      Got it. Although I think a case could be made for having some default ones with constants that don’t change.

      Well you wont necessarily know for sure what their primary keys are, so really, you can’t. tongue
        shaun mccormick | bigcommerce mgr of software engineering, former modx co-architect | github | splittingred.com
        • 3749
        • 24,544 Posts
        Quote from: splittingred at Feb 19, 2010, 05:59 PM

        Quote from: BobRay at Feb 19, 2010, 05:25 PM

        Got it. Although I think a case could be made for having some default ones with constants that don’t change.

        Well you wont necessarily know for sure what their primary keys are, so really, you can’t. tongue

        I was thinking of reserving the first n keys for common mime types, but it’s not a big issue.
          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