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

  Previous article Next article  

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.2
  Last updated: 16-07-2017
  Comments: 0

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

A2 Webhosting CMS Made Simple

  Comments

  Click here to leave a comment






This is a captcha-picture. It is used to prevent mass-access by robots. (see: www.captcha.net)
  « Enter the CAPTCHA code (lower case)

Your IP address will be stored on submit. I reserve the right to change or delete your response without notice!
In case of abuse your IP address will be blocked!


Can I have your attention for a moment?

Did this tutorial help you solving a problem at your (clients) website and it saved you many hours of work? Great!!
Consider buying Rolf a cup of coffee in return! [ Click here ]


  0 Comments

No comments yet...

CMS Made Simple 2.2.2 - Tutorials, tips and tricks - CMSMS 2.2.2

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.2
  Last updated: 16-07-2017
  Comments: 0

A2 Webhosting CMS Made Simple