test
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • mehrdad noori Friend
    #872638

    hi
    i want to change template for each component by php code
    i found this joomla api:
    JFactory::getApplication()->setTemplate(‘MyTemplateName’,null)
    this api work on simple templates but do Not work on T3-framework templates becuase on this framework all template have same name (for example: t3_bs3_blank)
    what is solution ?

    Ninja Lead Moderator
    #873168

    Hi,

    I am afraid you have to change from plugins/system/t3/t3.php file

    Regards

    mehrdad noori Friend
    #873432

    i found a solution:

      $style_id=MY Style ID;
      $client_id=0;
      $app= JFactory::getApplication();       
      // Load styles
      $db = JFactory::getDbo();
      $query = $db->getQuery(true);
      $query->select('template, params');
      $query->from('#__template_styles');
      $query->where('client_id = ' . (int)$client_id);
      $query->where('id = ' . (int)$style_id);
      $db->setQuery($query);
      $style = $db->loadObject();
      if ($style != null) {
          $app->setTemplate( $style->template, $style->params );
      }
      $t = $app->getTemplate(true);
      $t->id = $style_id;
Viewing 3 posts - 1 through 3 (of 3 total)

This topic contains 2 replies, has 2 voices, and was last updated by  mehrdad noori 8 years, 10 months ago.

We moved to new unified forum. Please post all new support queries in our New Forum