MENU

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); }

Buy Me A Coffee


  Show related articles:


  Comment Form

ReviewManager

Click here to open the form

ReviewManager

  4 Comments

Buy Me A Coffee

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

  Author:
  Last tested in: CMSMS 2.2.19
  Last updated: 10-06-2019
  Comments: 4
  http://cms.ms/7SAw


Buy Me A Coffee




Advertisement


Ads help me to help you! Thanks!

Ads help me to help you! Buy products from these advertisers!