Новости Joomla

0 Пользователей и 1 Гость просматривают эту тему.
  • 14 Ответов
  • 849 Просмотров
*

ALEXRAW

  • Захожу иногда
  • 148
  • 0 / 0
Здравствуйте уважаемые формучане. В чём может быть ошибка?

При вставке модулей в следующие позиции шаблона пишет :

Warning: A non-numeric value encountered in W:\domains\mysite.ru\plugins\system\yt\includes\site\lib\yt_template.php on line 389

Захожу в этот файл, вот строки 388-390:

if($k < $countModules ) {
                                 $_total += substr($position['class'], 7 , strlen($position['class']) - 1);
                  }

Что тут неправильно и модули отображаются почему-то повертикали и должны по горизонтали
*

NewUsers

  • Живу я здесь
  • 2307
  • 215 / 0
  • +375 (25) 627-16-99 (WhatsApp, Telegram)
Возможно переменная $_total содержит не цифру.
В начале 389 строки напишите
Код: php
print_r($_total);
Занимаюсь создание расширений для Joomla 3.10.x и 4.2.x | Доработка и настройка сайтов. Занимаюсь создание Интернет магазинов с нуля на собственном компоненте + оптимизация загрузки страницы (после предоставляю техподдержку).
Работа с DOM деревом на PHP
*

ALEXRAW

  • Захожу иногда
  • 148
  • 0 / 0
Возможно переменная $_total содержит не цифру.
В начале 389 строки напишите
Код: php
print_r($_total);

Попробовал спереди строки ничего не поменялось, поставил вместо $_total - вообще сайт перестал работать
« Последнее редактирование: 10.01.2021, 11:36:23 от ALEXRAW »
*

NewUsers

  • Живу я здесь
  • 2307
  • 215 / 0
  • +375 (25) 627-16-99 (WhatsApp, Telegram)
Попробовал, вообще сайт перестаёт работать
а если так
Код: php
echo get_class($_total);
Занимаюсь создание расширений для Joomla 3.10.x и 4.2.x | Доработка и настройка сайтов. Занимаюсь создание Интернет магазинов с нуля на собственном компоненте + оптимизация загрузки страницы (после предоставляю техподдержку).
Работа с DOM деревом на PHP
*

ALEXRAW

  • Захожу иногда
  • 148
  • 0 / 0
а если так
Код: php
echo get_class($_total);

Так две ошибки выскакивает

Warning: get_class() expects parameter 1 to be object, int given in W:\domains\mysite.ru\plugins\system\yt\includes\site\lib\yt_template.php on line 389

Warning: A non-numeric value encountered in W:\domains\mysite.ru\plugins\system\yt\includes\site\lib\yt_template.php on line 389
*

NewUsers

  • Живу я здесь
  • 2307
  • 215 / 0
  • +375 (25) 627-16-99 (WhatsApp, Telegram)
Warning: A non-numeric value encountered in W:\domains\mysite.ru\plugins\system\yt\includes\site\lib\yt_template.php on line 389
скиньте этот файл
Занимаюсь создание расширений для Joomla 3.10.x и 4.2.x | Доработка и настройка сайтов. Занимаюсь создание Интернет магазинов с нуля на собственном компоненте + оптимизация загрузки страницы (после предоставляю техподдержку).
Работа с DOM деревом на PHP
*

ALEXRAW

  • Захожу иногда
  • 148
  • 0 / 0
<?php
/*
 * ------------------------------------------------------------------------
  * Copyright (C) 2020 The YouTech JSC. All Rights Reserved.
 * @license - GNU/GPL, http://megapoker.rul
  * Author: ALEXRAW
 * Websites: http://megapoker.ru
 * ------------------------------------------------------------------------
*/
// no direct access
defined( '_JEXEC' ) or die( 'Restricted access' );
jimport( 'joomla.plugin.plugin' );

// Class YtTemplate
if (!class_exists('YtFrameworkTemplate')){
abstract class YtFrameworkTemplate {
   var $_tpl = null;
   var $template = '';
   var $layout = '';
   var $browser = '';
   var $override = false;
   var $_params_cookie = array();
   
   function __construct ($template =null, $cookie) {
      $this->_tpl = $template;
      $this->template = $template->template;
      if(!defined('YT_TEMPLATENAME')){
         define('YT_TEMPLATENAME', $this->template);
      }
      $this->override = $this->isOverrideTemplate();
      $_params_cookie = $cookie;
      foreach ($_params_cookie as $k) {
         $this->_params_cookie[$k] = $this->_tpl->params->get($k);
      }
      $this->getUserSetting();
      
      
      if(is_file(JPATH_ROOT.'/templates/'.$this->template.'/less/color/'. $this->getParam('themecolor').'.less')){
         $colorcontent1 = JFile::read('templates/'.$this->template.'/less/color/variables_color.less');
         $colorcontent2 = JFile::read('templates/'.$this->template.'/less/color/'. $this->getParam('themecolor').'.less');
         
         if($colorcontent1 != $colorcontent2){
            JFile::write(JPATH_ROOT.'/templates/'.$this->template.'/less/color/variables_color.less', $colorcontent2);
         }
      }
   }
   
   // Get setting of user
   /* Save setting of user on frontend to cookie*/
   function getUserSetting(){
      $exp = time() + 60*60*24*355;
      if (isset($_COOKIE[$this->template.'_tpl']) && $_COOKIE[$this->template.'_tpl'] == $this->template){
         foreach($this->_params_cookie as $k=>$v) {
            $kc = $this->template.'_'.$k;
            if (JRequest::getVar($k)!= null){
               $v = JRequest::getVar($k);
               @setcookie ($kc, $v, $exp, '/');
            }else{
               if (isset($_COOKIE[$kc])){
                  $v = $_COOKIE[$kc];
               }
            }
            $this->setParam($k, $v);
         }
      }else{
         @setcookie ($this->template.'_tpl', $this->template, $exp, '/');
      }
      return $this;
   }
   
   // Get param template
   function getParam ($param, $default='') {
      if (isset($this->_params_cookie[$param]) && $this->override==false) {
         return $this->_params_cookie[$param];
      }
      return $this->_tpl->params->get($param, $default);
   }
   
   // Set param template
   function setParam ($param, $value) {
      $this->_params_cookie[$param] = $value;
   }
   
   // Set cookie for param
   function set_cookie($name, $value = "") {
      $expires = time() + 60*60*24*365;
      setcookie($name, $value, $expires,"/","");
   }
   
   // Get cookie of param
   function get_cookie($item) {
      if (isset($_COOKIE[$item]))
         return urldecode($_COOKIE[$item]);
      else
         return false;
   }
   
   /**
   * Set Themes Color
   *
   */
   public static function Preset() {
      $name = self::getInstance()->theme(). '_themecolor';
      self::getInstance()->resetCookie($name);

      $require = JRequest::getVar('themecolor',  ''  , 'get');
      if( !empty( $require ) ){
         setcookie( $name, $require, time() + 3600, '/');
         $current = $require;
      }
      elseif( empty( $require ) and  isset( $_COOKIE[$name] )) {
         $current = $_COOKIE[$name];
      } else {
         $current = self::getInstance()->Param('themecolor');
      }

      return $current;
   }
   
   public static function PresetParam($name) {
      return self::getInstance()->param( self::getInstance()->Preset().$name );
   }
   
   /**
   * Set Layout Type
   *
   */
   public static function Typelayout() {
      $name = self::getInstance()->theme(). '_typelayout';
      self::getInstance()->resetCookie($name);

      $require = JRequest::getVar('typelayout',  ''  , 'get');
      if( !empty( $require ) ){
         setcookie( $name, $require, time() + 3600, '/');
         $current = $require;
      }
      elseif( empty( $require ) and  isset( $_COOKIE[$name] )) {
         $current = $_COOKIE[$name];
      } else {
         $current = self::getInstance()->Param('typelayout');
      }

      return $current;
   }
   
   public static function TypelayoutParam($name) {
      return self::getInstance()->param( self::getInstance()->Typelayout().$name );
   }
   
   
   // Return url of site
   function baseurl(){
       return JURI::base();
   }
   
   // Return url of template
   function templateurl() {
      return JURI::base()."templates/".$this->template.'/';
   }
   
   // Check version template
   function templateVersion(){
      $t_filePath = JURI::base()."templates/".$this->template.'/templateDetails.xml';
      $t_xml = JInstaller::parseXMLInstallFile($t_filePath);
      return $t_xml['version'];
   }
   
   // Check page is home page or not
   function isHomePage(){
      $db  = JFactory::getDBO();
      $db->setQuery("SELECT home FROM #__menu WHERE id=" . intval(JRequest::getCmd( 'Itemid' )));
      $db->query();
      return  $db->loadResult();
   }
   
   function isOverrideTemplate(){
      if(JRequest::getVar('tmpl')!='component'){
         $menuid = '';
         if(is_object(JFactory::getApplication()->getMenu()->getActive())) $menuid = JFactory::getApplication()->getMenu()->getActive()->id;
         $db = JFactory::getDBO();
         if($menuid!=''){
            $query = "SELECT template_style_id FROM #__menu WHERE id = ".$menuid;
            $db->setQuery($query);
            $templateIdActive = $db->loadResult();

            $query = "SELECT id FROM #__template_styles WHERE home = 1 AND client_id = 0";
            $db->setQuery($query);
            $templateIdDefault = $db->loadResult(); //echo $templateIdDefault.' vs '.$templateIdActive; //die();

            if($templateIdActive > 0){
               return true;
            }else{
               return false;
            }
         }
      }
      return false;
   }
   
   function ytStyleSheet($url){
      $doc = JFactory::getDocument();
      if(!file_exists($url) && (strpos($url, 'http:')== false || strpos($url, 'https:')== false))
         $url = 'templates/'.$this->template.'/'.$url;
      $lessurl = str_replace('.css', '.less', str_replace('/css/', '/less/', $url));
      if(($this->getParam('developing', 0)==1 || JRequest::getVar('less2css')=='all') && file_exists($lessurl)){
         YTLess::addStyleSheet($lessurl);
      }elseif(file_exists($url)){
         $doc->addStyleSheet($url);
      }elseif(basename($url)=='template.css'){
         $doc->addStyleSheet(str_replace('template.css', 'template-'.$this->getParam('themecolor').'.css', $url));
      }else{
         die($url.' not exists');
      }
   }
   
   // Render logo
   function getLogo(){
      global $overimg;
      
      $app = JFactory::getApplication();
      $logoWidth  = 'width:'.$this->getParam('logoWidth').'px;';
      $logoHeight = 'height:'.$this->getParam('logoHeight').'px;';
      
      
      if ($this->getParam('logoType')=='image'): 
         if($this->getParam('overrideLogoImage')!=''):
            $url = $this->baseurl().$this->getParam('overrideLogoImage');
         else:
            
            if(!empty($overimg)){
               
               if(is_file('templates/'.$this->template.'/images/styling/'.$this->getParam('themecolor').'/'.$overimg.'.png')){
                  
                  $url = $this->templateurl().'images/styling/'.$this->getParam('themecolor').'/'.$overimg.'.png';
               }else{
                  $url = $this->templateurl().'images/styling/'.$this->getParam('themecolor').'/logo.png';
               }
            }else{
               if(is_file('templates/'.$this->template.'/images/styling/'.$this->getParam('themecolor').'/logo.png')){
                  $url = $this->templateurl().'images/styling/'.$this->getParam('themecolor').'/logo.png';
               }else{
                  $url = $this->templateurl().'images/logo.png';
               }
            }
            
            
         endif;
      ?>
         
         <a class="logo" href="<?php echo $this->baseurl(); ?>" title="<?php echo $app->getCfg('sitename'); ?>" >
            <span></span>
            <img data-placeholder="no" src="<?php echo $url; ?>" alt="<?php echo $app->getCfg('sitename'); ?>" style="<?php echo $logoWidth. $logoHeight  ?>"/>
         </a>
           
        <?php
      else:
            $logoText = (trim($this->getParam('logoText'))=='')? $app->getCfg('sitename') : $this->getParam('logoText');
            $sloganText = (trim($this->getParam('sloganText'))=='')? JText::_('SITE SLOGAN') : $this->getParam('sloganText');   ?>
         <div class="logo-text" style="<?php echo $logoWidth. $logoHeight  ?>">
            <a class="site-text" href="index.php" title="<?php echo $app->getCfg('sitename'); ?>"><?php echo $logoText; ?></a>
            <p class="site-slogan"><?php echo $sloganText;?></p>
         </div>
        <?php
      endif;
   }
   
   // Render menu
   function getMenu(){
      $menubase = J_TEMPLATEDIR.J_SEPARATOR.'menusys';
      include_once $menubase .J_SEPARATOR.'ytloader.php';
      if(isset($_COOKIE[$this->template.'_direction'])){
         $direction = $_COOKIE[$this->template.'_direction'];
      }else{
         $direction = $this->getParam('direction');
      }
      
      $templateMenuBase = new YTMenuBase(
      array(
         'menutype'   => $this->getParam('menutype'),
         'menustyle'   => $this->getParam('menustyle'),
         'moofxduration'   => $this->getParam('moofxduration'),
         'moofx'      => $this->getParam('moofx'),
         'jsdropline'=> $this->getParam('jsdropline', 0),
         'activeslider'=> $this->getParam('activeslider', 0),
         'startlevel'=> $this->getParam('startlevel',0),
         'endlevel'   => $this->getParam('endlevel',9),
         'direction'   => $direction,
         'basepath'   => str_replace('\\', '/', $menubase)
      ));
      $templateMenuBase->getMenu()->getContent();   
      
   }
   
   // render possition has attribute group in positions of block
   function renPositionsGroup($position, $type='', $special = null){
      $elStyle   = '';
      $class     = '';
      $more_attr = '';
      $doc       = JFactory::getDocument();
      // Element style
      if($position['group']=='main'){
         $prefx = $special['mainprefix'];
      }else{
         $prefx = '';
      }
      
      // Element class
      $_countpos = $this->_countPosGroup($this->_tagPG, $position['value']);
      if($_countpos == 1) {
         $class .= ' class="col-sm-12"';
      }
      elseif(isset($position[$prefx.'class']) && $position[$prefx.'class']!=''){
         $class .= ' class="'.$position[$prefx.'class'].'"';
      }
      
      // Element attribute
      if ( $position['type'] == 'modules' ) {
         $has_suffix = false;
         if ( isset($position['group']) && $position['group'] == 'main' && $this->getParam('layoutsuffix')!= '' )
            if ( $doc->countModules($position['value'] . '-' . $this->getParam('layoutsuffix')) )
               $has_suffix = true;
         if ( $has_suffix ) {
            $this->renModulePos($position, $elStyle, $class, $position['value'] . '-' . $this->getParam('layoutsuffix'));
         } else {
            if ( $doc->countModules($position['value']) )
               $this->renModulePos($position, $elStyle, $class, '');
         }   
      } elseif ($position['type'] == 'component' && $type=='main'){
         if ( $this->getParam('hideComponentHomePage')=='1'
            && $this->isHomePage() ){
         ?>
               <p style="display:none">Hide Main content block</p>
            <?php
         } else {
            $this->renComponent($elStyle, $class);
         }
      } elseif ( $position['type'] == 'html' ) {
         $this->renHTMLPos($position, $elStyle, $class);
      } elseif ( $position['type'] == 'feature' ) {
         $this->renFeaturePos($position, $elStyle, $class);
      } elseif ( $position['type']=='message' ) { ?>
         <jdoc:include type="message" />
        <?php
      }
   }
   
   function _countPosGroup($tagBD, $povalue = null) {
      $doc = JFactory::getDocument();
      $this->_tagPG = $tagBD;
      $countposgroup = 0;      
      if(!empty($tagBD) &&  $povalue != null) {
         $_value0 = $povalue;
         $_value = preg_replace('/\d+/', '', $_value0 );
         foreach($tagBD as $position):
            if($position['group'] == $_value &&  $doc->countModules($position['value']) ){
                $countposgroup++;
            }
            
         endforeach;
      }
      return $countposgroup;
   }
   
   public function get_next($array, $key) {
      $currentKey = key($array);
      while ($currentKey !== null && $currentKey != $key) {
         next($array);
         $currentKey = key($array);
      }
      return next($array);
   }
   
   // render possition no attribute group in positions of block nomarl
   function renPositionsNormal($positions, $countModules, $countTag){
      $doc = JFactory::getDocument();
      $k = 0;
      $_total = 0;
      
      foreach( $positions as $position ){
         $elStyle   = '';
         $class     = '';
         
         // set the grid class eg: col-sm-6
         if($position['class']!=''){
            if($countModules < $countTag){
               if ($doc->countModules($position['value'])!= 0 || $position['type'] == 'feature' ) {
                  $k++;
                  if($k < $countModules ) {
                     echo get_class($_total); $_total += substr($position['class'], 7 , strlen($position['class']) - 1);
                  }
                  if($k == $countModules) {
                     $cls_end = 12 - $_total;
                     $class .= 'class="col-sm-'.$cls_end.'"';
                  }else{
                     $class .= 'class="'.$position['class'].'"';
                  }
                  
               }
               
            }else{
               $class .= 'class="'.$position['class'].'"';
            }
         }
         
         
         if($position['type'] == 'modules'){
            if( $doc->countModules($position['value']) )
               $this->renModulePos($position, $elStyle, $class);
         }elseif($position['type'] == 'html'){
            $this->renHTMLPos($position, $elStyle, $class);
         }elseif($position['type'] == 'feature'){
            
            $this->renFeaturePos($position, $position['overlogo'], $class);
         }elseif($position['type']=='message'){ ?>
               <div <?php echo $class; ?> >
                   <jdoc:include type="message" />
                </div>
            <?php
            }
      }
      
   }
   
   // render possition no attribute group in positions of block content
   function renPositionsContentNoGroup($position){
      $doc       = JFactory::getDocument();
      $elStyle   = '';
      $class     = '';
      
      $_total = '';
      $k = 0 ;
      
      // set the grid class eg: col-sm-6
      if($position['class']!=''){
         if($countModules < $countTag){
            if ($doc->countModules($position['value'])!= 0 || $position['type'] == 'feature' ) {
               $k++;
               if($k < $countModules ) {
                  $_total += substr($position['class'], 7 , strlen($position['class']) - 1);
               }
               if($k == $countModules) {
                  $cls_end = 12 - $_total;
                  $class .= 'class="col-sm-'.$cls_end.'"';
               }else{
                  $class .= 'class="'.$position['class'].'"';
               }
               
            }
            
         }else{
            $class .= 'class="'.$position['class'].'"';
         }
      }
         
      
      if($position['type'] == 'modules'){
         if( $doc->countModules($position['value']) ){
            $this->renModulePos($position, $elStyle, $class);
         }
      }elseif($position['type'] == 'html'){
         $this->renHTMLPos($position, $elStyle, $class);
      }elseif($position['type'] == 'feature'){
         $this->renFeaturePos($position, $elStyle, $class);
      }elseif($position['type']=='message'){ ?>
           <div<?php echo $class; ?>>
            <jdoc:include type="message" />
            </div>
      <?php
      }
   }
   
   //render position with type: modules
   function renModulePos ($position, $elementstyle, $elementclass='', $more_attr='', $positionnamesuffix='', $yorn='1' ) {
      if($yorn == '1'){
      ?>
      <div id="<?php echo $position['value']; ?>" <?php echo $elementstyle; ?> <?php echo $elementclass; ?> <?php echo $more_attr;?>>
         <jdoc:include type="modules" name="<?php echo ($positionnamesuffix=='')?$position['value']:$positionnamesuffix; ?>" style="<?php echo $position['style'];?>" />
      </div>
      <?php
      }else{ ?>
         <jdoc:include type="modules" name="<?php echo ($positionnamesuffix=='')?$position['value']:$positionnamesuffix; ?>" style="<?php echo $position['style'];?>" />
        <?php   
      }
   }
   //render position with type: HTML
   function renHTMLPos ($position, $elementstyle, $elementclass='' ) {
      ?>
      <div <?php echo $elementclass; ?><?php echo $elementstyle; ?> >
         <?php echo $position['value']; ?>
        </div>
      <?php
   }
   
   //render position with type: feature
   function renFeaturePos ($position, $elementstyle, $elementclass='' ) {
      global $overimg;
       $overimg = $elementstyle;
      
      ?>
      <div id="<?php echo "yt_".strtolower(substr($position['value'], 1));?>" <?php echo $elementclass; ?>  >
         <?php
            if($position['value'] == '@logo'){
                echo $this->getLogo();
            }elseif($position['value'] == '@fontsize'){
                echo $this->getControlFontSize();
            }elseif($position['value'] == '@mainmenu'){
                 $this->getMenu();
            }elseif($position['value'] == '@linkFooter'){
                $this->getLinkFooter();
            }elseif($position['value'] == '@copyright'){
                $this->getCopyright();
            }
            ?>
        </div>
      <?php
   }
   
   //render position with type: component
   function renComponent ($elementstyle, $elementclass='', $more_attr='') {
      ?>
        <div id="yt_component"<?php echo $elementclass; ?><?php echo $elementstyle; ?><?php echo $more_attr; ?>>
             <jdoc:include type="component" />
        </div>
      <?php
   }
   
   
   // Check version of IE
   static function ieversion() {
      preg_match('/MSIE (.*?);/', $_SERVER['HTTP_USER_AGENT'], $matches);
      if(count($matches)<2){
        preg_match('/Trident\/\d{1,2}.\d{1,2}; rv:([0-9]*)/', $_SERVER['HTTP_USER_AGENT'], $matches);
      }
      if (count($matches)>1){
        //Then we're using IE
           if(!isset($matches[1])) {
            return -1;
         } else {
            return floatval($matches[1]);
         }
      }
      
   }
   
}
}
?>
*

ALEXRAW

  • Захожу иногда
  • 148
  • 0 / 0
Вот файл посмотрите пожалуйста, только я сейчас отойду от компьютера и буду только к вечеру
*

ALEXRAW

  • Захожу иногда
  • 148
  • 0 / 0
Ой я забыл убрать, то что Вы написали, вот оригинал:

<?php
/*
 * ------------------------------------------------------------------------
  * Copyright (C) 2020 The YouTech JSC. All Rights Reserved.
 * @license - GNU/GPL, http://megapoker.rul
  * Author: ALEXRAW
 * Websites: http://megapoker.ru
 * ------------------------------------------------------------------------
*/
// no direct access
defined( '_JEXEC' ) or die( 'Restricted access' );
jimport( 'joomla.plugin.plugin' );

// Class YtTemplate
if (!class_exists('YtFrameworkTemplate')){
abstract class YtFrameworkTemplate {
   var $_tpl = null;
   var $template = '';
   var $layout = '';
   var $browser = '';
   var $override = false;
   var $_params_cookie = array();
   
   function __construct ($template =null, $cookie) {
      $this->_tpl = $template;
      $this->template = $template->template;
      if(!defined('YT_TEMPLATENAME')){
         define('YT_TEMPLATENAME', $this->template);
      }
      $this->override = $this->isOverrideTemplate();
      $_params_cookie = $cookie;
      foreach ($_params_cookie as $k) {
         $this->_params_cookie[$k] = $this->_tpl->params->get($k);
      }
      $this->getUserSetting();
      
      
      if(is_file(JPATH_ROOT.'/templates/'.$this->template.'/less/color/'. $this->getParam('themecolor').'.less')){
         $colorcontent1 = JFile::read('templates/'.$this->template.'/less/color/variables_color.less');
         $colorcontent2 = JFile::read('templates/'.$this->template.'/less/color/'. $this->getParam('themecolor').'.less');
         
         if($colorcontent1 != $colorcontent2){
            JFile::write(JPATH_ROOT.'/templates/'.$this->template.'/less/color/variables_color.less', $colorcontent2);
         }
      }
   }
   
   // Get setting of user
   /* Save setting of user on frontend to cookie*/
   function getUserSetting(){
      $exp = time() + 60*60*24*355;
      if (isset($_COOKIE[$this->template.'_tpl']) && $_COOKIE[$this->template.'_tpl'] == $this->template){
         foreach($this->_params_cookie as $k=>$v) {
            $kc = $this->template.'_'.$k;
            if (JRequest::getVar($k)!= null){
               $v = JRequest::getVar($k);
               @setcookie ($kc, $v, $exp, '/');
            }else{
               if (isset($_COOKIE[$kc])){
                  $v = $_COOKIE[$kc];
               }
            }
            $this->setParam($k, $v);
         }
      }else{
         @setcookie ($this->template.'_tpl', $this->template, $exp, '/');
      }
      return $this;
   }
   
   // Get param template
   function getParam ($param, $default='') {
      if (isset($this->_params_cookie[$param]) && $this->override==false) {
         return $this->_params_cookie[$param];
      }
      return $this->_tpl->params->get($param, $default);
   }
   
   // Set param template
   function setParam ($param, $value) {
      $this->_params_cookie[$param] = $value;
   }
   
   // Set cookie for param
   function set_cookie($name, $value = "") {
      $expires = time() + 60*60*24*365;
      setcookie($name, $value, $expires,"/","");
   }
   
   // Get cookie of param
   function get_cookie($item) {
      if (isset($_COOKIE[$item]))
         return urldecode($_COOKIE[$item]);
      else
         return false;
   }
   
   /**
   * Set Themes Color
   *
   */
   public static function Preset() {
      $name = self::getInstance()->theme(). '_themecolor';
      self::getInstance()->resetCookie($name);

      $require = JRequest::getVar('themecolor',  ''  , 'get');
      if( !empty( $require ) ){
         setcookie( $name, $require, time() + 3600, '/');
         $current = $require;
      }
      elseif( empty( $require ) and  isset( $_COOKIE[$name] )) {
         $current = $_COOKIE[$name];
      } else {
         $current = self::getInstance()->Param('themecolor');
      }

      return $current;
   }
   
   public static function PresetParam($name) {
      return self::getInstance()->param( self::getInstance()->Preset().$name );
   }
   
   /**
   * Set Layout Type
   *
   */
   public static function Typelayout() {
      $name = self::getInstance()->theme(). '_typelayout';
      self::getInstance()->resetCookie($name);

      $require = JRequest::getVar('typelayout',  ''  , 'get');
      if( !empty( $require ) ){
         setcookie( $name, $require, time() + 3600, '/');
         $current = $require;
      }
      elseif( empty( $require ) and  isset( $_COOKIE[$name] )) {
         $current = $_COOKIE[$name];
      } else {
         $current = self::getInstance()->Param('typelayout');
      }

      return $current;
   }
   
   public static function TypelayoutParam($name) {
      return self::getInstance()->param( self::getInstance()->Typelayout().$name );
   }
   
   
   // Return url of site
   function baseurl(){
       return JURI::base();
   }
   
   // Return url of template
   function templateurl() {
      return JURI::base()."templates/".$this->template.'/';
   }
   
   // Check version template
   function templateVersion(){
      $t_filePath = JURI::base()."templates/".$this->template.'/templateDetails.xml';
      $t_xml = JInstaller::parseXMLInstallFile($t_filePath);
      return $t_xml['version'];
   }
   
   // Check page is home page or not
   function isHomePage(){
      $db  = JFactory::getDBO();
      $db->setQuery("SELECT home FROM #__menu WHERE id=" . intval(JRequest::getCmd( 'Itemid' )));
      $db->query();
      return  $db->loadResult();
   }
   
   function isOverrideTemplate(){
      if(JRequest::getVar('tmpl')!='component'){
         $menuid = '';
         if(is_object(JFactory::getApplication()->getMenu()->getActive())) $menuid = JFactory::getApplication()->getMenu()->getActive()->id;
         $db = JFactory::getDBO();
         if($menuid!=''){
            $query = "SELECT template_style_id FROM #__menu WHERE id = ".$menuid;
            $db->setQuery($query);
            $templateIdActive = $db->loadResult();

            $query = "SELECT id FROM #__template_styles WHERE home = 1 AND client_id = 0";
            $db->setQuery($query);
            $templateIdDefault = $db->loadResult(); //echo $templateIdDefault.' vs '.$templateIdActive; //die();

            if($templateIdActive > 0){
               return true;
            }else{
               return false;
            }
         }
      }
      return false;
   }
   
   function ytStyleSheet($url){
      $doc = JFactory::getDocument();
      if(!file_exists($url) && (strpos($url, 'http:')== false || strpos($url, 'https:')== false))
         $url = 'templates/'.$this->template.'/'.$url;
      $lessurl = str_replace('.css', '.less', str_replace('/css/', '/less/', $url));
      if(($this->getParam('developing', 0)==1 || JRequest::getVar('less2css')=='all') && file_exists($lessurl)){
         YTLess::addStyleSheet($lessurl);
      }elseif(file_exists($url)){
         $doc->addStyleSheet($url);
      }elseif(basename($url)=='template.css'){
         $doc->addStyleSheet(str_replace('template.css', 'template-'.$this->getParam('themecolor').'.css', $url));
      }else{
         die($url.' not exists');
      }
   }
   
   // Render logo
   function getLogo(){
      global $overimg;
      
      $app = JFactory::getApplication();
      $logoWidth  = 'width:'.$this->getParam('logoWidth').'px;';
      $logoHeight = 'height:'.$this->getParam('logoHeight').'px;';
      
      
      if ($this->getParam('logoType')=='image'): 
         if($this->getParam('overrideLogoImage')!=''):
            $url = $this->baseurl().$this->getParam('overrideLogoImage');
         else:
            
            if(!empty($overimg)){
               
               if(is_file('templates/'.$this->template.'/images/styling/'.$this->getParam('themecolor').'/'.$overimg.'.png')){
                  
                  $url = $this->templateurl().'images/styling/'.$this->getParam('themecolor').'/'.$overimg.'.png';
               }else{
                  $url = $this->templateurl().'images/styling/'.$this->getParam('themecolor').'/logo.png';
               }
            }else{
               if(is_file('templates/'.$this->template.'/images/styling/'.$this->getParam('themecolor').'/logo.png')){
                  $url = $this->templateurl().'images/styling/'.$this->getParam('themecolor').'/logo.png';
               }else{
                  $url = $this->templateurl().'images/logo.png';
               }
            }
            
            
         endif;
      ?>
         
         <a class="logo" href="<?php echo $this->baseurl(); ?>" title="<?php echo $app->getCfg('sitename'); ?>" >
            <span></span>
            <img data-placeholder="no" src="<?php echo $url; ?>" alt="<?php echo $app->getCfg('sitename'); ?>" style="<?php echo $logoWidth. $logoHeight  ?>"/>
         </a>
           
        <?php
      else:
            $logoText = (trim($this->getParam('logoText'))=='')? $app->getCfg('sitename') : $this->getParam('logoText');
            $sloganText = (trim($this->getParam('sloganText'))=='')? JText::_('SITE SLOGAN') : $this->getParam('sloganText');   ?>
         <div class="logo-text" style="<?php echo $logoWidth. $logoHeight  ?>">
            <a class="site-text" href="index.php" title="<?php echo $app->getCfg('sitename'); ?>"><?php echo $logoText; ?></a>
            <p class="site-slogan"><?php echo $sloganText;?></p>
         </div>
        <?php
      endif;
   }
   
   // Render menu
   function getMenu(){
      $menubase = J_TEMPLATEDIR.J_SEPARATOR.'menusys';
      include_once $menubase .J_SEPARATOR.'ytloader.php';
      if(isset($_COOKIE[$this->template.'_direction'])){
         $direction = $_COOKIE[$this->template.'_direction'];
      }else{
         $direction = $this->getParam('direction');
      }
      
      $templateMenuBase = new YTMenuBase(
      array(
         'menutype'   => $this->getParam('menutype'),
         'menustyle'   => $this->getParam('menustyle'),
         'moofxduration'   => $this->getParam('moofxduration'),
         'moofx'      => $this->getParam('moofx'),
         'jsdropline'=> $this->getParam('jsdropline', 0),
         'activeslider'=> $this->getParam('activeslider', 0),
         'startlevel'=> $this->getParam('startlevel',0),
         'endlevel'   => $this->getParam('endlevel',9),
         'direction'   => $direction,
         'basepath'   => str_replace('\\', '/', $menubase)
      ));
      $templateMenuBase->getMenu()->getContent();   
      
   }
   
   // render possition has attribute group in positions of block
   function renPositionsGroup($position, $type='', $special = null){
      $elStyle   = '';
      $class     = '';
      $more_attr = '';
      $doc       = JFactory::getDocument();
      // Element style
      if($position['group']=='main'){
         $prefx = $special['mainprefix'];
      }else{
         $prefx = '';
      }
      
      // Element class
      $_countpos = $this->_countPosGroup($this->_tagPG, $position['value']);
      if($_countpos == 1) {
         $class .= ' class="col-sm-12"';
      }
      elseif(isset($position[$prefx.'class']) && $position[$prefx.'class']!=''){
         $class .= ' class="'.$position[$prefx.'class'].'"';
      }
      
      // Element attribute
      if ( $position['type'] == 'modules' ) {
         $has_suffix = false;
         if ( isset($position['group']) && $position['group'] == 'main' && $this->getParam('layoutsuffix')!= '' )
            if ( $doc->countModules($position['value'] . '-' . $this->getParam('layoutsuffix')) )
               $has_suffix = true;
         if ( $has_suffix ) {
            $this->renModulePos($position, $elStyle, $class, $position['value'] . '-' . $this->getParam('layoutsuffix'));
         } else {
            if ( $doc->countModules($position['value']) )
               $this->renModulePos($position, $elStyle, $class, '');
         }   
      } elseif ($position['type'] == 'component' && $type=='main'){
         if ( $this->getParam('hideComponentHomePage')=='1'
            && $this->isHomePage() ){
         ?>
               <p style="display:none">Hide Main content block</p>
            <?php
         } else {
            $this->renComponent($elStyle, $class);
         }
      } elseif ( $position['type'] == 'html' ) {
         $this->renHTMLPos($position, $elStyle, $class);
      } elseif ( $position['type'] == 'feature' ) {
         $this->renFeaturePos($position, $elStyle, $class);
      } elseif ( $position['type']=='message' ) { ?>
         <jdoc:include type="message" />
        <?php
      }
   }
   
   function _countPosGroup($tagBD, $povalue = null) {
      $doc = JFactory::getDocument();
      $this->_tagPG = $tagBD;
      $countposgroup = 0;      
      if(!empty($tagBD) &&  $povalue != null) {
         $_value0 = $povalue;
         $_value = preg_replace('/\d+/', '', $_value0 );
         foreach($tagBD as $position):
            if($position['group'] == $_value &&  $doc->countModules($position['value']) ){
                $countposgroup++;
            }
            
         endforeach;
      }
      return $countposgroup;
   }
   
   public function get_next($array, $key) {
      $currentKey = key($array);
      while ($currentKey !== null && $currentKey != $key) {
         next($array);
         $currentKey = key($array);
      }
      return next($array);
   }
   
   // render possition no attribute group in positions of block nomarl
   function renPositionsNormal($positions, $countModules, $countTag){
      $doc = JFactory::getDocument();
      $k = 0;
      $_total = 0;
      
      foreach( $positions as $position ){
         $elStyle   = '';
         $class     = '';
         
         // set the grid class eg: col-sm-6
         if($position['class']!=''){
            if($countModules < $countTag){
               if ($doc->countModules($position['value'])!= 0 || $position['type'] == 'feature' ) {
                  $k++;
                  if($k < $countModules ) {
                     $_total += substr($position['class'], 7 , strlen($position['class']) - 1);
                  }
                  if($k == $countModules) {
                     $cls_end = 12 - $_total;
                     $class .= 'class="col-sm-'.$cls_end.'"';
                  }else{
                     $class .= 'class="'.$position['class'].'"';
                  }
                  
               }
               
            }else{
               $class .= 'class="'.$position['class'].'"';
            }
         }
         
         
         if($position['type'] == 'modules'){
            if( $doc->countModules($position['value']) )
               $this->renModulePos($position, $elStyle, $class);
         }elseif($position['type'] == 'html'){
            $this->renHTMLPos($position, $elStyle, $class);
         }elseif($position['type'] == 'feature'){
            
            $this->renFeaturePos($position, $position['overlogo'], $class);
         }elseif($position['type']=='message'){ ?>
               <div <?php echo $class; ?> >
                   <jdoc:include type="message" />
                </div>
            <?php
            }
      }
      
   }
   
   // render possition no attribute group in positions of block content
   function renPositionsContentNoGroup($position){
      $doc       = JFactory::getDocument();
      $elStyle   = '';
      $class     = '';
      
      $_total = '';
      $k = 0 ;
      
      // set the grid class eg: col-sm-6
      if($position['class']!=''){
         if($countModules < $countTag){
            if ($doc->countModules($position['value'])!= 0 || $position['type'] == 'feature' ) {
               $k++;
               if($k < $countModules ) {
                  $_total += substr($position['class'], 7 , strlen($position['class']) - 1);
               }
               if($k == $countModules) {
                  $cls_end = 12 - $_total;
                  $class .= 'class="col-sm-'.$cls_end.'"';
               }else{
                  $class .= 'class="'.$position['class'].'"';
               }
               
            }
            
         }else{
            $class .= 'class="'.$position['class'].'"';
         }
      }
         
      
      if($position['type'] == 'modules'){
         if( $doc->countModules($position['value']) ){
            $this->renModulePos($position, $elStyle, $class);
         }
      }elseif($position['type'] == 'html'){
         $this->renHTMLPos($position, $elStyle, $class);
      }elseif($position['type'] == 'feature'){
         $this->renFeaturePos($position, $elStyle, $class);
      }elseif($position['type']=='message'){ ?>
           <div<?php echo $class; ?>>
            <jdoc:include type="message" />
            </div>
      <?php
      }
   }
   
   //render position with type: modules
   function renModulePos ($position, $elementstyle, $elementclass='', $more_attr='', $positionnamesuffix='', $yorn='1' ) {
      if($yorn == '1'){
      ?>
      <div id="<?php echo $position['value']; ?>" <?php echo $elementstyle; ?> <?php echo $elementclass; ?> <?php echo $more_attr;?>>
         <jdoc:include type="modules" name="<?php echo ($positionnamesuffix=='')?$position['value']:$positionnamesuffix; ?>" style="<?php echo $position['style'];?>" />
      </div>
      <?php
      }else{ ?>
         <jdoc:include type="modules" name="<?php echo ($positionnamesuffix=='')?$position['value']:$positionnamesuffix; ?>" style="<?php echo $position['style'];?>" />
        <?php   
      }
   }
   //render position with type: HTML
   function renHTMLPos ($position, $elementstyle, $elementclass='' ) {
      ?>
      <div <?php echo $elementclass; ?><?php echo $elementstyle; ?> >
         <?php echo $position['value']; ?>
        </div>
      <?php
   }
   
   //render position with type: feature
   function renFeaturePos ($position, $elementstyle, $elementclass='' ) {
      global $overimg;
       $overimg = $elementstyle;
      
      ?>
      <div id="<?php echo "yt_".strtolower(substr($position['value'], 1));?>" <?php echo $elementclass; ?>  >
         <?php
            if($position['value'] == '@logo'){
                echo $this->getLogo();
            }elseif($position['value'] == '@fontsize'){
                echo $this->getControlFontSize();
            }elseif($position['value'] == '@mainmenu'){
                 $this->getMenu();
            }elseif($position['value'] == '@linkFooter'){
                $this->getLinkFooter();
            }elseif($position['value'] == '@copyright'){
                $this->getCopyright();
            }
            ?>
        </div>
      <?php
   }
   
   //render position with type: component
   function renComponent ($elementstyle, $elementclass='', $more_attr='') {
      ?>
        <div id="yt_component"<?php echo $elementclass; ?><?php echo $elementstyle; ?><?php echo $more_attr; ?>>
             <jdoc:include type="component" />
        </div>
      <?php
   }
   
   
   // Check version of IE
   static function ieversion() {
      preg_match('/MSIE (.*?);/', $_SERVER['HTTP_USER_AGENT'], $matches);
      if(count($matches)<2){
        preg_match('/Trident\/\d{1,2}.\d{1,2}; rv:([0-9]*)/', $_SERVER['HTTP_USER_AGENT'], $matches);
      }
      if (count($matches)>1){
        //Then we're using IE
           if(!isset($matches[1])) {
            return -1;
         } else {
            return floatval($matches[1]);
         }
      }
      
   }
   
}
}
?>
*

NewUsers

  • Живу я здесь
  • 2307
  • 215 / 0
  • +375 (25) 627-16-99 (WhatsApp, Telegram)
Сделайте так, после 389 строки
Код: php
echo substr($position['class'], 7 , strlen($position['class']) - 1);
и следом
Код: php
print_r($position);
Занимаюсь создание расширений для Joomla 3.10.x и 4.2.x | Доработка и настройка сайтов. Занимаюсь создание Интернет магазинов с нуля на собственном компоненте + оптимизация загрузки страницы (после предоставляю техподдержку).
Работа с DOM деревом на PHP
*

ALEXRAW

  • Захожу иногда
  • 148
  • 0 / 0
Сделайте так, после 389 строки
Код: php
echo substr($position['class'], 7 , strlen($position['class']) - 1);
и следом
Код: php
print_r($position);

Ничего не поменялось
*

NewUsers

  • Живу я здесь
  • 2307
  • 215 / 0
  • +375 (25) 627-16-99 (WhatsApp, Telegram)
Ничего не поменялось
Может не в том месте исправляете. В начало функции напишите
Код: php
echo __METHOD__; exit;
будет ли что ни будь выводить!
Занимаюсь создание расширений для Joomla 3.10.x и 4.2.x | Доработка и настройка сайтов. Занимаюсь создание Интернет магазинов с нуля на собственном компоненте + оптимизация загрузки страницы (после предоставляю техподдержку).
Работа с DOM деревом на PHP
*

ALEXRAW

  • Захожу иногда
  • 148
  • 0 / 0
Может не в том месте исправляете. В начало функции напишите
Код: php
echo __METHOD__; exit;
будет ли что ни будь выводить!

Может и правда не так делаю, напишите пожалуйста весь код этого файла, а я поменяю
*

NewUsers

  • Живу я здесь
  • 2307
  • 215 / 0
  • +375 (25) 627-16-99 (WhatsApp, Telegram)
Код: php
<?php
/*
 * ------------------------------------------------------------------------
  * Copyright (C) 2020 The YouTech JSC. All Rights Reserved.
 * @license - GNU/GPL, http://megapoker.rul
  * Author: ALEXRAW
 * Websites: http://megapoker.ru
 * ------------------------------------------------------------------------
*/
// no direct access
defined( '_JEXEC' ) or die( 'Restricted access' );
jimport( 'joomla.plugin.plugin' );

// Class YtTemplate
if (!class_exists('YtFrameworkTemplate')){
abstract class YtFrameworkTemplate {
   var $_tpl = null;
   var $template = '';
   var $layout = '';
   var $browser = '';
   var $override = false;
   var $_params_cookie = array();
   
   function __construct ($template =null, $cookie) {
      $this->_tpl = $template;
      $this->template = $template->template;
      if(!defined('YT_TEMPLATENAME')){
         define('YT_TEMPLATENAME', $this->template);
      }
      $this->override = $this->isOverrideTemplate();
      $_params_cookie = $cookie;
      foreach ($_params_cookie as $k) {
         $this->_params_cookie[$k] = $this->_tpl->params->get($k);
      }
      $this->getUserSetting();
     
     
      if(is_file(JPATH_ROOT.'/templates/'.$this->template.'/less/color/'. $this->getParam('themecolor').'.less')){
         $colorcontent1 = JFile::read('templates/'.$this->template.'/less/color/variables_color.less');
         $colorcontent2 = JFile::read('templates/'.$this->template.'/less/color/'. $this->getParam('themecolor').'.less');
         
         if($colorcontent1 != $colorcontent2){
            JFile::write(JPATH_ROOT.'/templates/'.$this->template.'/less/color/variables_color.less', $colorcontent2);
         }
      }
   }
   
   // Get setting of user
   /* Save setting of user on frontend to cookie*/
   function getUserSetting(){
      $exp = time() + 60*60*24*355;
      if (isset($_COOKIE[$this->template.'_tpl']) && $_COOKIE[$this->template.'_tpl'] == $this->template){
         foreach($this->_params_cookie as $k=>$v) {
            $kc = $this->template.'_'.$k;
            if (JRequest::getVar($k)!= null){
               $v = JRequest::getVar($k);
               @setcookie ($kc, $v, $exp, '/');
            }else{
               if (isset($_COOKIE[$kc])){
                  $v = $_COOKIE[$kc];
               }
            }
            $this->setParam($k, $v);
         }
      }else{
         @setcookie ($this->template.'_tpl', $this->template, $exp, '/');
      }
      return $this;
   }
   
   // Get param template
   function getParam ($param, $default='') {
      if (isset($this->_params_cookie[$param]) && $this->override==false) {
         return $this->_params_cookie[$param];
      }
      return $this->_tpl->params->get($param, $default);
   }
   
   // Set param template
   function setParam ($param, $value) {
      $this->_params_cookie[$param] = $value;
   }
   
   // Set cookie for param
   function set_cookie($name, $value = "") {
      $expires = time() + 60*60*24*365;
      setcookie($name, $value, $expires,"/","");
   }
   
   // Get cookie of param
   function get_cookie($item) {
      if (isset($_COOKIE[$item]))
         return urldecode($_COOKIE[$item]);
      else
         return false;
   }
   
   /**
   * Set Themes Color
   *
   */
   public static function Preset() {
      $name = self::getInstance()->theme(). '_themecolor';
      self::getInstance()->resetCookie($name);

      $require = JRequest::getVar('themecolor',  ''  , 'get');
      if( !empty( $require ) ){
         setcookie( $name, $require, time() + 3600, '/');
         $current = $require;
      }
      elseif( empty( $require ) and  isset( $_COOKIE[$name] )) {
         $current = $_COOKIE[$name];
      } else {
         $current = self::getInstance()->Param('themecolor');
      }

      return $current;
   }
   
   public static function PresetParam($name) {
      return self::getInstance()->param( self::getInstance()->Preset().$name );
   }
   
   /**
   * Set Layout Type
   *
   */
   public static function Typelayout() {
      $name = self::getInstance()->theme(). '_typelayout';
      self::getInstance()->resetCookie($name);

      $require = JRequest::getVar('typelayout',  ''  , 'get');
      if( !empty( $require ) ){
         setcookie( $name, $require, time() + 3600, '/');
         $current = $require;
      }
      elseif( empty( $require ) and  isset( $_COOKIE[$name] )) {
         $current = $_COOKIE[$name];
      } else {
         $current = self::getInstance()->Param('typelayout');
      }

      return $current;
   }
   
   public static function TypelayoutParam($name) {
      return self::getInstance()->param( self::getInstance()->Typelayout().$name );
   }
   
   
   // Return url of site
   function baseurl(){
       return JURI::base();
   }
   
   // Return url of template
   function templateurl() {
      return JURI::base()."templates/".$this->template.'/';
   }
   
   // Check version template
   function templateVersion(){
      $t_filePath = JURI::base()."templates/".$this->template.'/templateDetails.xml';
      $t_xml = JInstaller::parseXMLInstallFile($t_filePath);
      return $t_xml['version'];
   }
   
   // Check page is home page or not
   function isHomePage(){
      $db  = JFactory::getDBO();
      $db->setQuery("SELECT home FROM #__menu WHERE id=" . intval(JRequest::getCmd( 'Itemid' )));
      $db->query();
      return  $db->loadResult();
   }
   
   function isOverrideTemplate(){
      if(JRequest::getVar('tmpl')!='component'){
         $menuid = '';
         if(is_object(JFactory::getApplication()->getMenu()->getActive())) $menuid = JFactory::getApplication()->getMenu()->getActive()->id;
         $db = JFactory::getDBO();
         if($menuid!=''){
            $query = "SELECT template_style_id FROM #__menu WHERE id = ".$menuid;
            $db->setQuery($query);
            $templateIdActive = $db->loadResult();

            $query = "SELECT id FROM #__template_styles WHERE home = 1 AND client_id = 0";
            $db->setQuery($query);
            $templateIdDefault = $db->loadResult(); //echo $templateIdDefault.' vs '.$templateIdActive; //die();

            if($templateIdActive > 0){
               return true;
            }else{
               return false;
            }
         }
      }
      return false;
   }
   
   function ytStyleSheet($url){
      $doc = JFactory::getDocument();
      if(!file_exists($url) && (strpos($url, 'http:')== false || strpos($url, 'https:')== false))
         $url = 'templates/'.$this->template.'/'.$url;
      $lessurl = str_replace('.css', '.less', str_replace('/css/', '/less/', $url));
      if(($this->getParam('developing', 0)==1 || JRequest::getVar('less2css')=='all') && file_exists($lessurl)){
         YTLess::addStyleSheet($lessurl);
      }elseif(file_exists($url)){
         $doc->addStyleSheet($url);
      }elseif(basename($url)=='template.css'){
         $doc->addStyleSheet(str_replace('template.css', 'template-'.$this->getParam('themecolor').'.css', $url));
      }else{
         die($url.' not exists');
      }
   }
   
   // Render logo
   function getLogo(){
      global $overimg;
     
      $app = JFactory::getApplication();
      $logoWidth  = 'width:'.$this->getParam('logoWidth').'px;';
      $logoHeight = 'height:'.$this->getParam('logoHeight').'px;';
     
     
      if ($this->getParam('logoType')=='image'):
         if($this->getParam('overrideLogoImage')!=''):
            $url = $this->baseurl().$this->getParam('overrideLogoImage');
         else:
           
            if(!empty($overimg)){
               
               if(is_file('templates/'.$this->template.'/images/styling/'.$this->getParam('themecolor').'/'.$overimg.'.png')){
                 
                  $url = $this->templateurl().'images/styling/'.$this->getParam('themecolor').'/'.$overimg.'.png';
               }else{
                  $url = $this->templateurl().'images/styling/'.$this->getParam('themecolor').'/logo.png';
               }
            }else{
               if(is_file('templates/'.$this->template.'/images/styling/'.$this->getParam('themecolor').'/logo.png')){
                  $url = $this->templateurl().'images/styling/'.$this->getParam('themecolor').'/logo.png';
               }else{
                  $url = $this->templateurl().'images/logo.png';
               }
            }
           
           
         endif;
      ?>
         
         <a class="logo" href="<?php echo $this->baseurl(); ?>" title="<?php echo $app->getCfg('sitename'); ?>" >
            <span></span>
            <img data-placeholder="no" src="<?php echo $url; ?>" alt="<?php echo $app->getCfg('sitename'); ?>" style="<?php echo $logoWidth. $logoHeight  ?>"/>
         </a>
           
        <?php
      else:
            $logoText = (trim($this->getParam('logoText'))=='')? $app->getCfg('sitename') : $this->getParam('logoText');
            $sloganText = (trim($this->getParam('sloganText'))=='')? JText::_('SITE SLOGAN') : $this->getParam('sloganText');   ?>
         <div class="logo-text" style="<?php echo $logoWidth. $logoHeight  ?>">
            <a class="site-text" href="index.php" title="<?php echo $app->getCfg('sitename'); ?>"><?php echo $logoText; ?></a>
            <p class="site-slogan"><?php echo $sloganText;?></p>
         </div>
        <?php
      endif;
   }
   
   // Render menu
   function getMenu(){
      $menubase = J_TEMPLATEDIR.J_SEPARATOR.'menusys';
      include_once $menubase .J_SEPARATOR.'ytloader.php';
      if(isset($_COOKIE[$this->template.'_direction'])){
         $direction = $_COOKIE[$this->template.'_direction'];
      }else{
         $direction = $this->getParam('direction');
      }
     
      $templateMenuBase = new YTMenuBase(
      array(
         'menutype'   => $this->getParam('menutype'),
         'menustyle'   => $this->getParam('menustyle'),
         'moofxduration'   => $this->getParam('moofxduration'),
         'moofx'      => $this->getParam('moofx'),
         'jsdropline'=> $this->getParam('jsdropline', 0),
         'activeslider'=> $this->getParam('activeslider', 0),
         'startlevel'=> $this->getParam('startlevel',0),
         'endlevel'   => $this->getParam('endlevel',9),
         'direction'   => $direction,
         'basepath'   => str_replace('\\', '/', $menubase)
      ));
      $templateMenuBase->getMenu()->getContent();   
     
   }
   
   // render possition has attribute group in positions of block
   function renPositionsGroup($position, $type='', $special = null){
      $elStyle   = '';
      $class     = '';
      $more_attr = '';
      $doc       = JFactory::getDocument();
      // Element style
      if($position['group']=='main'){
         $prefx = $special['mainprefix'];
      }else{
         $prefx = '';
      }
     
      // Element class
      $_countpos = $this->_countPosGroup($this->_tagPG, $position['value']);
      if($_countpos == 1) {
         $class .= ' class="col-sm-12"';
      }
      elseif(isset($position[$prefx.'class']) && $position[$prefx.'class']!=''){
         $class .= ' class="'.$position[$prefx.'class'].'"';
      }
     
      // Element attribute
      if ( $position['type'] == 'modules' ) {
         $has_suffix = false;
         if ( isset($position['group']) && $position['group'] == 'main' && $this->getParam('layoutsuffix')!= '' )
            if ( $doc->countModules($position['value'] . '-' . $this->getParam('layoutsuffix')) )
               $has_suffix = true;
         if ( $has_suffix ) {
            $this->renModulePos($position, $elStyle, $class, $position['value'] . '-' . $this->getParam('layoutsuffix'));
         } else {
            if ( $doc->countModules($position['value']) )
               $this->renModulePos($position, $elStyle, $class, '');
         }   
      } elseif ($position['type'] == 'component' && $type=='main'){
         if ( $this->getParam('hideComponentHomePage')=='1'
            && $this->isHomePage() ){
         ?>
               <p style="display:none">Hide Main content block</p>
            <?php
         } else {
            $this->renComponent($elStyle, $class);
         }
      } elseif ( $position['type'] == 'html' ) {
         $this->renHTMLPos($position, $elStyle, $class);
      } elseif ( $position['type'] == 'feature' ) {
         $this->renFeaturePos($position, $elStyle, $class);
      } elseif ( $position['type']=='message' ) { ?>
         <jdoc:include type="message" />
        <?php
      }
   }
   
   function _countPosGroup($tagBD, $povalue = null) {
      $doc = JFactory::getDocument();
      $this->_tagPG = $tagBD;
      $countposgroup = 0;     
      if(!empty($tagBD) &&  $povalue != null) {
         $_value0 = $povalue;
         $_value = preg_replace('/\d+/', '', $_value0 );
         foreach($tagBD as $position):
            if($position['group'] == $_value &&  $doc->countModules($position['value']) ){
                $countposgroup++;
            }
           
         endforeach;
      }
      return $countposgroup;
   }
   
   public function get_next($array, $key) {
      $currentKey = key($array);
      while ($currentKey !== null && $currentKey != $key) {
         next($array);
         $currentKey = key($array);
      }
      return next($array);
   }
   
   // render possition no attribute group in positions of block nomarl
   function renPositionsNormal($positions, $countModules, $countTag){
      $doc = JFactory::getDocument();
      $k = 0;
      $_total = 0;
     
      foreach( $positions as $position ){
         $elStyle   = '';
         $class     = '';
         
         // set the grid class eg: col-sm-6
         if($position['class']!=''){
            if($countModules < $countTag){
               if ($doc->countModules($position['value'])!= 0 || $position['type'] == 'feature' ) {
                  $k++;
                  if($k < $countModules ) {
                      echo __METHOD__;
                     echo substr($position['class'], 7 , strlen($position['class']) - 1); print_r($position);
                     $_total += substr($position['class'], 7 , strlen($position['class']) - 1);
                  }
                  if($k == $countModules) {
                     $cls_end = 12 - $_total;
                     $class .= 'class="col-sm-'.$cls_end.'"';
                  }else{
                     $class .= 'class="'.$position['class'].'"';
                  }
                 
               }
               
            }else{
               $class .= 'class="'.$position['class'].'"';
            }
         }
         
         
         if($position['type'] == 'modules'){
            if( $doc->countModules($position['value']) )
               $this->renModulePos($position, $elStyle, $class);
         }elseif($position['type'] == 'html'){
            $this->renHTMLPos($position, $elStyle, $class);
         }elseif($position['type'] == 'feature'){
           
            $this->renFeaturePos($position, $position['overlogo'], $class);
         }elseif($position['type']=='message'){ ?>
               <div <?php echo $class; ?> >
                   <jdoc:include type="message" />
                </div>
            <?php
            }
      }
     
   }
   
   // render possition no attribute group in positions of block content
   function renPositionsContentNoGroup($position){
      $doc       = JFactory::getDocument();
      $elStyle   = '';
      $class     = '';
     
      $_total = '';
      $k = 0 ;
     
      // set the grid class eg: col-sm-6
      if($position['class']!=''){
         if($countModules < $countTag){
            if ($doc->countModules($position['value'])!= 0 || $position['type'] == 'feature' ) {
               $k++;
               if($k < $countModules ) {
                  $_total += substr($position['class'], 7 , strlen($position['class']) - 1);
               }
               if($k == $countModules) {
                  $cls_end = 12 - $_total;
                  $class .= 'class="col-sm-'.$cls_end.'"';
               }else{
                  $class .= 'class="'.$position['class'].'"';
               }
               
            }
           
         }else{
            $class .= 'class="'.$position['class'].'"';
         }
      }
         
     
      if($position['type'] == 'modules'){
         if( $doc->countModules($position['value']) ){
            $this->renModulePos($position, $elStyle, $class);
         }
      }elseif($position['type'] == 'html'){
         $this->renHTMLPos($position, $elStyle, $class);
      }elseif($position['type'] == 'feature'){
         $this->renFeaturePos($position, $elStyle, $class);
      }elseif($position['type']=='message'){ ?>
           <div<?php echo $class; ?>>
            <jdoc:include type="message" />
            </div>
      <?php
      }
   }
   
   //render position with type: modules
   function renModulePos ($position, $elementstyle, $elementclass='', $more_attr='', $positionnamesuffix='', $yorn='1' ) {
      if($yorn == '1'){
      ?>
      <div id="<?php echo $position['value']; ?>" <?php echo $elementstyle; ?> <?php echo $elementclass; ?> <?php echo $more_attr;?>>
         <jdoc:include type="modules" name="<?php echo ($positionnamesuffix=='')?$position['value']:$positionnamesuffix; ?>" style="<?php echo $position['style'];?>" />
      </div>
      <?php
      }else{ ?>
         <jdoc:include type="modules" name="<?php echo ($positionnamesuffix=='')?$position['value']:$positionnamesuffix; ?>" style="<?php echo $position['style'];?>" />
        <?php   
      }
   }
   //render position with type: HTML
   function renHTMLPos ($position, $elementstyle, $elementclass='' ) {
      ?>
      <div <?php echo $elementclass; ?><?php echo $elementstyle; ?> >
         <?php echo $position['value']; ?>
        </div>
      <?php
   }
   
   //render position with type: feature
   function renFeaturePos ($position, $elementstyle, $elementclass='' ) {
      global $overimg;
       $overimg = $elementstyle;
     
      ?>
      <div id="<?php echo "yt_".strtolower(substr($position['value'], 1));?>" <?php echo $elementclass; ?>  >
         <?php
            if($position['value'] == '@logo'){
                echo $this->getLogo();
            }elseif($position['value'] == '@fontsize'){
                echo $this->getControlFontSize();
            }elseif($position['value'] == '[member=168421]mainmenu[/member]'){
                 $this->getMenu();
            }elseif($position['value'] == '@linkFooter'){
                $this->getLinkFooter();
            }elseif($position['value'] == '[member=126442]copyright[/member]'){
                $this->getCopyright();
            }
            ?>
        </div>
      <?php
   }
   
   //render position with type: component
   function renComponent ($elementstyle, $elementclass='', $more_attr='') {
      ?>
        <div id="yt_component"<?php echo $elementclass; ?><?php echo $elementstyle; ?><?php echo $more_attr; ?>>
             <jdoc:include type="component" />
        </div>
      <?php
   }
   
   
   // Check version of IE
   static function ieversion() {
      preg_match('/MSIE (.*?);/', $_SERVER['HTTP_USER_AGENT'], $matches);
      if(count($matches)<2){
        preg_match('/Trident\/\d{1,2}.\d{1,2}; rv:([0-9]*)/', $_SERVER['HTTP_USER_AGENT'], $matches);
      }
      if (count($matches)>1){
        //Then we're using IE
           if(!isset($matches[1])) {
            return -1;
         } else {
            return floatval($matches[1]);
         }
      }
     
   }
   
}
}
?>
Занимаюсь создание расширений для Joomla 3.10.x и 4.2.x | Доработка и настройка сайтов. Занимаюсь создание Интернет магазинов с нуля на собственном компоненте + оптимизация загрузки страницы (после предоставляю техподдержку).
Работа с DOM деревом на PHP
*

ALEXRAW

  • Захожу иногда
  • 148
  • 0 / 0
сайт не работает, пишет


TEXT_404_JUSTICE
TEXT_ERROR_JUSTICE

Class 'YTMenuBase' not found
TEXT_BACK_HOME
Чтобы оставить сообщение,
Вам необходимо Войти или Зарегистрироваться
 

Ошибка 0 Call to undefined function GuzzleHttp\choose_handler()

Автор Alllex

Ответов: 0
Просмотров: 159
Последний ответ 15.03.2024, 21:03:09
от Alllex
Ошибка version_compare(): Argument #3 ($operator)

Автор Шмайсер

Ответов: 1
Просмотров: 418
Последний ответ 07.11.2023, 20:44:21
от fsv
reCapcha во всплывающем окне - "Ошибка защиты от спама"

Автор Dannik

Ответов: 12
Просмотров: 1843
Последний ответ 14.09.2023, 18:59:24
от all_zer
Меняются позиции в шаблоне?

Автор kochevnik

Ответов: 2
Просмотров: 366
Последний ответ 13.03.2023, 09:41:15
от kochevnik
Ошибка 1054 Unknown column 'created_by' in 'field list' VirtueMart

Автор Evgen Kulibin

Ответов: 3
Просмотров: 794
Последний ответ 26.02.2023, 01:56:42
от lakshmi