Новости Joomla

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

Kadimp

  • Захожу иногда
  • 180
  • 2 / 0
Подскажите, как объединить эти вайлы стилей в один и прописать это в CSS.php?

// CSS by IceTheme for this Tempalte
$doc->addStyleSheet($this->baseurl. '/templates/' .$this->template. '/css/joomla.css');
$doc->addStyleSheet($this->baseurl. '/templates/' .$this->template. '/css/modules.css');
$doc->addStyleSheet($this->baseurl. '/templates/' .$this->template. '/css/general.css');
$doc->addStyleSheet($this->baseurl. '/templates/' .$this->template. '/css/pages.css');
$doc->addStyleSheet($this->baseurl. '/templates/' .$this->template. '/css/joomshopping.css');
*

Филипп Сорокин

  • Завсегдатай
  • 1918
  • 160 / 4
  • разработчик.москва
Создаёте файл CSS.php и прописываете в него содержимое этих файлов.
*

Kadimp

  • Захожу иногда
  • 180
  • 2 / 0
это у меня и так в CSS.php прописано. Мне нужно сделать из них один файл CSS и прописать в CSS.php
*

yandex_hb

  • Захожу иногда
  • 263
  • 12 / 3
1. Создаёте новый текстовый файл.
2. Открываете каждый подключаемый CSS, и его содержимое копируете в файл из первого шага.
3. Сохраняете получившийся файл как .css.
4. Убираете все подключаемые CSS из шаблона.
5. Подключаете свой CSS, который сделали выше.
6. ...?
7. PROFIT!
*

Kadimp

  • Захожу иногда
  • 180
  • 2 / 0
1. Создаёте новый текстовый файл.
2. Открываете каждый подключаемый CSS, и его содержимое копируете в файл из первого шага.
3. Сохраняете получившийся файл как .css.
4. Убираете все подключаемые CSS из шаблона.
5. Подключаете свой CSS, который сделали выше.
6. ...?
7. PROFIT!
не понял 6 и 7 пункт. Когда я сделаю свой файл CSS я просто удалю подключаемые файлы из CSS.php и пропишу туда свой файл? А прописывать также как и прописаны предыдущие файлы?
 
*

yandex_hb

  • Захожу иногда
  • 263
  • 12 / 3
CSS.php тоже надо удалить. А в шаблоне вместо него подключить свой moi.CSS
*

AlekVolsk

  • Гуру
  • 6915
  • 415 / 4
Код: php
$css_files = array(
'/templates/' .$this->template. '/css/joomla.css',
'/templates/' .$this->template. '/css/modules.css',
'/templates/' .$this->template. '/css/general.css',
'/templates/' .$this->template. '/css/pages.css',
'/templates/' .$this->template. '/css/joomshopping.css'
);
$css_out = '/templates/' .$this->template. '/css/theme.css',

$out = '';
foreach ($css_files as $item)
{
ob_start();
require JPATH_BASE . $item;
$buf = ob_get_clean();
$out .= $buf . "\r\n";
}
unset($buf);

// в этом месте можно добавить функцию минификации

$file = fopen( JPATH_BASE . $css_out, 'w' );
fwrite( $file, $out );
flush();
fclose( $file );
unset($out);

$doc->addStyleSheet($this->baseurl . $css_out);
*

Kadimp

  • Захожу иногда
  • 180
  • 2 / 0
Код: php
$css_files = array(
'/templates/' .$this->template. '/css/joomla.css',
'/templates/' .$this->template. '/css/modules.css',
'/templates/' .$this->template. '/css/general.css',
'/templates/' .$this->template. '/css/pages.css',
'/templates/' .$this->template. '/css/joomshopping.css'
);
$css_out = '/templates/' .$this->template. '/css/theme.css',

$out = '';
foreach ($css_files as $item)
{
ob_start();
require JPATH_BASE . $item;
$buf = ob_get_clean();
$out .= $buf . "\r\n";
}
unset($buf);

// в этом месте можно добавить функцию минификации

$file = fopen( JPATH_BASE . $css_out, 'w' );
fwrite( $file, $out );
flush();
fclose( $file );
unset($out);

$doc->addStyleSheet($this->baseurl . $css_out);
Круто! Спасибо помогло. Получилось:
Код
<?php
//  @copyright Copyright (C) 2012 IceTheme. All Rights Reserved
//  @license Copyrighted Commercial Software
//  @author     IceTheme (icetheme.com)

// No direct access.
defined('_JEXEC') or die;


//////////////////////////////////////  CSS  //////////////////////////////////////

// Twitter bootstrap
$doc->addStyleSheet($this->baseurl. '/templates/' .$this->template. '/bootstrap/css/bootstrap.min.css');

if ($this->params->get('responsive_template')) {
$doc->addStyleSheet($this->baseurl. '/templates/' .$this->template. '/bootstrap/css/bootstrap-responsive.min.css');
}

// CSS by IceTheme for this Tempalte
$css_files = array(
'/templates/' .$this->template. '/css/joomla.css',
'/templates/' .$this->template. '/css/modules.css',
'/templates/' .$this->template. '/css/general.css',
'/templates/' .$this->template. '/css/pages.css',
'/templates/' .$this->template. '/css/joomshopping.css'
);
$css_out = '/templates/' .$this->template. '/css/new.css',
 
$out = '';
foreach ($css_files as $item)
{
ob_start();
require JPATH_BASE . $item;
$buf = ob_get_clean();
$out .= $buf . "\r\n";
}
unset($buf);
 
// в этом месте можно добавить функцию минификации
 
$file = fopen( JPATH_BASE . $css_out, 'w' );
fwrite( $file, $out );
flush();
fclose( $file );
unset($out);
 
$doc->addStyleSheet($this->baseurl . $css_out);


if ($this->params->get('responsive_template')) {
$doc->addStyleSheet($this->baseurl. '/templates/' .$this->template. '/css/responsive.css');
$doc->addStyleSheet($this->baseurl. '/templates/' .$this->template. '/css/joomshopping_responsive.css');
}
$doc->addStyleSheet($this->baseurl. '/templates/' .$this->template. '/css/custom.css');
?>
А не подскажите ещё, пожалуйста, как можно и остальные файлы CSS из этого кода вставить в один и правильно прописать в файл CSS.php. Или хотя бы как напрямую вставить код из файла custom.css в этот файл CSS.php?

*

AlekVolsk

  • Гуру
  • 6915
  • 415 / 4
добавьте все необходимые файлы в массив $css_files
*

AlekVolsk

  • Гуру
  • 6915
  • 415 / 4
Код: php
<?php
//  @copyright Copyright (C) 2012 IceTheme. All Rights Reserved
//  @license Copyrighted Commercial Software
//  @author     IceTheme (icetheme.com)

// No direct access.
defined('_JEXEC') or die;

//////////////////////////////////////  CSS  //////////////////////////////////////

$css_files = array();

$css_files[] = '/templates/' .$this->template. '/bootstrap/css/bootstrap.min.css';

if ($this->params->get('responsive_template')) {
$css_files[] = '/templates/' .$this->template. '/bootstrap/css/bootstrap-responsive.min.css';
}

$css_files[] = '/templates/' .$this->template. '/css/joomla.css';
$css_files[] = '/templates/' .$this->template. '/css/modules.css';
$css_files[] = '/templates/' .$this->template. '/css/general.css';
$css_files[] = '/templates/' .$this->template. '/css/pages.css';
$css_files[] = '/templates/' .$this->template. '/css/joomshopping.css';

if ($this->params->get('responsive_template')) {
$css_files[] = '/templates/' .$this->template. '/css/responsive.css';
$css_files[] = '/templates/' .$this->template. '/css/joomshopping_responsive.css';
}

$css_files[] = '/templates/' .$this->template. '/css/custom.css';

$css_out = '/templates/' .$this->template. '/css/theme.css',

$out = '';
foreach ($css_files as $item)
{
ob_start();
require JPATH_BASE . $item;
$buf = ob_get_clean();
$out .= $buf . "\r\n";
}
unset($buf);

// minify this

$file = fopen( JPATH_BASE . $css_out, 'w' );
fwrite( $file, $out );
flush();
fclose( $file );
unset($out);

$doc->addStyleSheet($this->baseurl . $css_out);

как-то так примерно...

учите матчасть, этот код можно неплохо оптимизировать и улучшить его производительность, но пусть это будет вашим домашним заданием
« Последнее редактирование: 14.08.2016, 20:00:12 от AlekVolsk »
*

Kadimp

  • Захожу иногда
  • 180
  • 2 / 0
Код: php
<?php
//  @copyright Copyright (C) 2012 IceTheme. All Rights Reserved
//  @license Copyrighted Commercial Software
//  @author     IceTheme (icetheme.com)

// No direct access.
defined('_JEXEC') or die;

//////////////////////////////////////  CSS  //////////////////////////////////////

$css_files = array();

$css_files[] = '/templates/' .$this->template. '/bootstrap/css/bootstrap.min.css';

if ($this->params->get('responsive_template')) {
$css_files[] = '/templates/' .$this->template. '/bootstrap/css/bootstrap-responsive.min.css';
}

$css_files[] = '/templates/' .$this->template. '/css/joomla.css';
$css_files[] = '/templates/' .$this->template. '/css/modules.css';
$css_files[] = '/templates/' .$this->template. '/css/general.css';
$css_files[] = '/templates/' .$this->template. '/css/pages.css';
$css_files[] = '/templates/' .$this->template. '/css/joomshopping.css';

if ($this->params->get('responsive_template')) {
$css_files[] = '/templates/' .$this->template. '/css/responsive.css';
$css_files[] = '/templates/' .$this->template. '/css/joomshopping_responsive.css';
}

$css_files[] = '/templates/' .$this->template. '/css/custom.css';

$css_out = '/templates/' .$this->template. '/css/theme.css',

$out = '';
foreach ($css_files as $item)
{
ob_start();
require JPATH_BASE . $item;
$buf = ob_get_clean();
$out .= $buf . "\r\n";
}
unset($buf);

// minify this

$file = fopen( JPATH_BASE . $css_out, 'w' );
fwrite( $file, $out );
flush();
fclose( $file );
unset($out);

$doc->addStyleSheet($this->baseurl . $css_out);

как-то так примерно...

учите матчасть, этот код можно неплохо оптимизировать и улучшить его производительность, но пусть это будет вашим домашним заданием
Совсем запутался. Сейчас я скопировал 5 фалов CSS в один (new.css) и у меня получилось следующее:
Код
<?php
//  @copyright Copyright (C) 2012 IceTheme. All Rights Reserved
//  @license Copyrighted Commercial Software
//  @author     IceTheme (icetheme.com)

// No direct access.
defined('_JEXEC') or die;


//////////////////////////////////////  CSS  //////////////////////////////////////

// Twitter bootstrap
$doc->addStyleSheet($this->baseurl. '/templates/' .$this->template. '/bootstrap/css/bootstrap.min.css');

if ($this->params->get('responsive_template')) {
$doc->addStyleSheet($this->baseurl. '/templates/' .$this->template. '/bootstrap/css/bootstrap-responsive.min.css');
}

// CSS by IceTheme for this Tempalte
$doc->addStyleSheet($this->baseurl. '/templates/' .$this->template. '/css/new.css');

if ($this->params->get('responsive_template')) {
$doc->addStyleSheet($this->baseurl. '/templates/' .$this->template. '/css/responsive.css');
$doc->addStyleSheet($this->baseurl. '/templates/' .$this->template. '/css/joomshopping_responsive.css');
}
?>

Когда заменяю его на Ваш код, сайт не работает(
*

yandex_hb

  • Захожу иногда
  • 263
  • 12 / 3
Я писал про "сделать руками без всяких там CSS.php".
AlekVolsk написал вам конструкцию, которая сама склеивает все CSS файлы в один. И вроде у вас всё заработало, знай себе CSSки в массив подпихивай и не парься.

Цитировать
Когда заменяю его на Ваш код, сайт не работает(
Что значит "не работает"? Какие-то ошибки?
*

Wertos

  • Захожу иногда
  • 489
  • 22 / 0
Установить JCH Optimize и не лезть в код.
*

Kadimp

  • Захожу иногда
  • 180
  • 2 / 0
Я писал про "сделать руками без всяких там CSS.php".
AlekVolsk написал вам конструкцию, которая сама склеивает все CSS файлы в один. И вроде у вас всё заработало, знай себе CSSки в массив подпихивай и не парься.
Что значит "не работает"? Какие-то ошибки?
Та конструкция в итоге тоже не заработала, я её тоже в CSS.php всунул, просто кеш не обновился сразу. А по поводу удалить CSS.php? так там ещё кусок большой кода прописан, как же без него! JCH Optimize не очень приветствую.
*

yandex_hb

  • Захожу иногда
  • 263
  • 12 / 3
Там код, отвечающий за погрузку стилей в зависимости от настроек шаблона. Если вы знаете, какие стили нужны, а какие нет - убрать CSS.php не проблема.
Код AlekVolsk работает прекрасно, я проверял.

Цитировать
Когда заменяю его на Ваш код, сайт не работает(
Что значит "не работает"? Какие-то ошибки?
« Последнее редактирование: 15.08.2016, 15:39:38 от yandex_hb »
*

Kadimp

  • Захожу иногда
  • 180
  • 2 / 0
Там код, отвечающий за погрузку стилей в зависимости от настроек шаблона. Если вы знаете, какие стили нужны, а какие нет - убрать CSS.php не проблема.
Код AlekVolsk работает прекрасно, я проверял.
Что значит "не работает"? Какие-то ошибки?
Сайт одавал 500 Error. Вот весь код CSS.php который сейчас работает
Код
<?php
//  @copyright Copyright (C) 2012 IceTheme. All Rights Reserved
//  @license Copyrighted Commercial Software
//  @author     IceTheme (icetheme.com)

// No direct access.
defined('_JEXEC') or die;


//////////////////////////////////////  CSS  //////////////////////////////////////

// Twitter bootstrap
$doc->addStyleSheet($this->baseurl. '/templates/' .$this->template. '/bootstrap/css/bootstrap.min.css');

if ($this->params->get('responsive_template')) {
$doc->addStyleSheet($this->baseurl. '/templates/' .$this->template. '/bootstrap/css/bootstrap-responsive.min.css');
}

// CSS by IceTheme for this Tempalte
$doc->addStyleSheet($this->baseurl. '/templates/' .$this->template. '/css/new.css');

if ($this->params->get('responsive_template')) {
$doc->addStyleSheet($this->baseurl. '/templates/' .$this->template. '/css/responsive.css');
$doc->addStyleSheet($this->baseurl. '/templates/' .$this->template. '/css/joomshopping_responsive.css');
}
?>
<style type="text/css" media="screen">

<?php if($this->params->get('homepage_content')) {
$menu = $app->getMenu();
$lang = JFactory::getLanguage();
if ($menu->getActive() == $menu->getDefault($lang->getTag())) {  ?>
#columns { display:none;}
<?php }} ?>

<?php if (!$this->countModules('sidebar')) { ?>
#content #content_inner {width:100%; border-radius:10px}
#content #content_inner #middlecol {float:none;}
<?php } ?>

<?php if ($this->countModules('slider')) { ?>
@media (max-width: 1200px) {
#promo .container {
width:865px}
}

@media (max-width: 979px) {
#promo .container {
width: 570px;}
.iceslider .flex-control-nav { height:20px; overflow:hidden}
.iceslider .flex-control-nav li:last-child a,
.iceslider .flex-control-nav li:first-child a{
border-radius:0;}
}

@media (max-width: 640px) {
#promo .container {
width: 265px;}
}

<?php } ?>


/* IE10-only styles go here */  
.ie10 ul#ice-switcher {
padding-right:20px;}  
.ie10 ul#ice-switcher:hover {
padding-right:35px}


/* Custom CSS code throught paramters */
<?php echo $this->params->get('custom_css_code'); ?>
</style>

<!-- Template Styles  -->
<?php  if ($this->params->get('enable_template_style')!=1) { ?>
<link rel="stylesheet" type="text/css" href="<?php echo $this->baseurl ?>/templates/<?php echo $this->template ?>/css/styles/<?php echo $templatestyle; ?>.css" />
<?php } ?>

<!-- Google Fonts -->
<link href='http://fonts.googleapis.com/css?family=Coming+Soon' rel='stylesheet' type='text/css'>


<?php  if ($this->params->get('responsive_template')) { ?>
<!-- Template Styles -->
<link rel="stylesheet" type="text/css" href="<?php echo $this->baseurl ?>/templates/<?php echo $this->template ?>/css/styles/<?php echo $templatestyle; ?>_responsive.css" />

<?php } ?>


<!--[if lte IE 8]>
<link rel="stylesheet" type="text/css" href="<?php echo $this->baseurl ?>/templates/<?php echo $this->template ?>/css/ie8.css" />
<![endif]-->

<!--[if lt IE 9]>
    <script src="<?php echo $this->baseurl ?>/media/jui/js/html5.js"></script>
<![endif]-->


<!--[if !IE]><!--><script>  
if(Function('/*@cc_on return document.documentMode===10@*/')()){
    document.documentElement.className+=' ie10';
}
</script><!--<![endif]-->
Т. е. код AlekVolsk нужно вставить в отдельный файл, а сюда нельзя? что за файл theme.css ? Я его должен пустым создать?
« Последнее редактирование: 15.08.2016, 16:40:18 от Kadimp »
*

yandex_hb

  • Захожу иногда
  • 263
  • 12 / 3
Т. е. код AlekVolsk нужно вставить в отдельный файл, а сюда нельзя?
Именно сюда его вставлять и надо.

Цитировать
что за файл theme.css ? Я его должен пустым создать?
Ну создайте на всякий случай)
« Последнее редактирование: 15.08.2016, 16:52:35 от yandex_hb »
*

Kadimp

  • Захожу иногда
  • 180
  • 2 / 0
Именно сюда его вставлять и надо.
Ну создайте на всякий случай)
Спасибо, в целом работает - собирает все файлы CSS в один, но немного сбилось оформление страницы, пропал фон
*

yandex_hb

  • Захожу иногда
  • 263
  • 12 / 3
Спасибо AlekVolsk.

Цитировать
но немного сбилось оформление страницы, пропал фон
Это уже надо сами CSS смотреть, где этот фон прописан и почему пропал.
*

Kadimp

  • Захожу иногда
  • 180
  • 2 / 0
Спасибо AlekVolsk.
Это уже надо сами CSS смотреть, где этот фон прописан и почему пропал.
фон прописан в general.css
Код
body{font-family:Arial, Helvetica, sans-serif;background:#E3E4E6;line-height:24px;overflow-x:hidden;}
Чтобы оставить сообщение,
Вам необходимо Войти или Зарегистрироваться
 

Кэш не сохраняется, файлы сами удаляются

Автор Guran

Ответов: 6
Просмотров: 592
Последний ответ 10.05.2022, 22:55:51
от Guran
Версия файла стилей

Автор Mick_20

Ответов: 2
Просмотров: 500
Последний ответ 04.04.2021, 10:59:46
от Gosha5767
Не загружаются файлы pdf и docx

Автор Аня

Ответов: 3
Просмотров: 1901
Последний ответ 07.08.2020, 01:27:11
от arma
Объединить картинки-ссылки в один запрос

Автор Elimelech

Ответов: 0
Просмотров: 727
Последний ответ 10.03.2020, 13:19:58
от Elimelech
Права доступа на файлы и папки для обновления

Автор system1024

Ответов: 6
Просмотров: 2559
Последний ответ 20.12.2019, 11:01:26
от Matinaz