content_type UDT for use in CMSMS 1.12.x and 2.x

  Previous article Next article  

In several of my tips and tricks articles I use the content_type UDT to change the content type of the page. In the upcoming 2.0 release of CMS Made Simple this method is changed and won't work anymore. If you change the UDT like done below it will work in both 1.11 as in the 2.0 series!

  How to use

Change the content_type UDT to:

$content_type = get_parameter_value($params,'type');

if ($content_type != '') {
  if (version_compare(CMS_VERSION, '2.0', '<')) {
    cmsms()->variables['content-type'] = $content_type; // 1.12.x series
  } else {
    cmsms()->set_content_type($content_type); // 2.x series

You already have a website using CMS Made Simple 2.x? That makes life a lot easier, this code is sufficient:

$content_type = get_parameter_value($params,'type');
if ($content_type != '') { cmsms()->set_content_type($content_type); }

  Show related articles:

  Comment Form

Click here to open the form


CMS Made Simple - Tutorials, tips and tricks - CMSMS

content_type UDT for use in CMSMS 1.12.x and 2.x

  Article optimized for CMSMS 2.x

  Last tested in: CMSMS 2.2.7
  Last updated: 22-11-2017
  Comments: 4


Ads help me to help you! Thanks!