We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 36788
    • 75 Posts
    Hi BobRay,

    This is a bit wrong way to work with $modx->getObject in my case, I dont need to work with particular modx resource at all.

    I just need to read the property set by user in the modx configuration under "system -> types of content ->html/text ->file extentions". This property is set not for all resorces with html/text extension.
      • 4172
      • 5,888 Posts
          <object class="modContentType" table="content_type" extends="xPDOSimpleObject">
              <field key="name" dbtype="varchar" precision="255" phptype="string" null="false" index="unique" />
              <field key="description" dbtype="tinytext" phptype="string" null="true" />
              <field key="mime_type" dbtype="tinytext" phptype="string" />
              <field key="file_extensions" dbtype="tinytext" phptype="string" />
              <field key="headers" dbtype="mediumtext" phptype="array" />
              <field key="binary" dbtype="tinyint" precision="1" attributes="unsigned" phptype="boolean" null="false" default="0" />
      
              <index alias="name" name="name" primary="false" unique="true" type="BTREE">
                  <column key="name" length="" collation="A" null="false" />
              </index>
      
              <aggregate alias="Resources" class="modResource" local="id" foreign="content_type" owner="local" cardinality="many" />
              <validation>
                  <rule field="name" name="name" type="xPDOValidationRule" rule="xPDOMinLengthValidationRule" value="1" message="content_type_err_ns_name" />
              </validation>
          </object>


      reading the schema of modContentType, something like this should work:

      if ($object = $modx->getObject('modContentType',array('name'=>'HTML'))){
          $extension = $object->get('file_extensions');
      }

        -------------------------------

        you can buy me a beer, if you like MIGX

        http://webcmsolutions.de/migx.html

        Thanks!
        • 36788
        • 75 Posts
        Quote from: Bruno17 at Nov 05, 2013, 04:19 AM


        reading the schema of modContentType, something like this should work:

        if ($object = $modx->getObject('modContentType',array('name'=>'HTML'))){
            $extension = $object->get('file_extensions');
        }


        Thank you, thank you and thank you!!! Thats exactly what I need! [ed. note: sladdals last edited this post 12 years, 10 months ago.]