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