• DONATE to NULLED!
    Форуму и его команде можно помочь, мотивировать модераторов разделов.
    Помогите модератору этого раздела killoff лично.

Помощь Помогите с модулем

Статус
В этой теме нельзя размещать новые ответы.

zloy_admin

Разработчик
Заблокирован
Регистрация
15 Авг 2011
Сообщения
186
Реакции
28
  • Автор темы
  • Заблокирован
  • #1
имеется модуль погоды РНР
PHP:
<?php
$pogoda = file_get_contents('http://export.yandex.ru/weather/?city=23848&#
39;);
preg_match('/<weather_type>(.*?)<\/weather_type
>/i',$pogoda,$type);
preg_match('/<dampness>(.*?)<\/dampness>/i
',$pogoda,$vlaga);
preg_match('/<temperature>(.*?)<\/temperature&#
62;/i',$pogoda,$temp);
preg_match('/<image2>(.*?)<\/image2>/i
9;,$pogoda,$img2);
preg_match('/<pressure>(.*?)<\/pressure>/i
',$pogoda,$press);
$vivod = "<div style=\"float:left;display:inline;margin-top:5px;\"
;><font size = 3><strong>В Нефтеюганске
          $temp[1] °</strong></font>
          <img align=top src=$img2[1] /></div>
          <div style=\"display:inline;\">
          <font size = 2>
";
echo $vivod;
?>
Вывожу через {include file="engine/modules/pogoda.php"}
помогите зделать на нем кэширование на 4 часа
 
прив. я в этом не силен, но попробуй так
PHP:
<?php 
if( ! defined( 'DATALIFEENGINE' ) ) {
    die( "Hacking attempt!" );
}
$vivod = $dle_api->load_from_cache ( 'weather', 14400);
if( !$vivod ) {
	$pogoda = file_get_contents('http://export.yandex.ru/weather/?city=23848'); 
	preg_match('/<weather_type>(.*?)</weather_type>/i',$pogoda,$type); 
	preg_match('/<dampness>(.*?)</dampness>/i',$pogoda,$vlaga); 
	preg_match('/<temperature>(.*?)</temperature>/i',$pogoda,$temp); 
	preg_match('/<image2>(.*?)</image2>/i9;,$pogoda,$img2); 
	preg_match('/<pressure>(.*?)<\/pressure>/i',$pogoda,$press); 
	$vivod = "<div style=\"float:left;display:inline;margin-top:5px;\" ;><font size = 3><strong>В Нефтеюганске $temp[1] °</strong></font><img align=top src=$img2[1] /></div><div style=\"display:inline;\"><font size = 2>";
	$dle_api->save_to_cache( weather );
	echo $vivod;
	}
else {
	echo $vivod;
}
?>
 
  • Автор темы
  • Заблокирован
  • #3
прив. я в этом не силен, но попробуй так
PHP:
<?php 
if( ! defined( 'DATALIFEENGINE' ) ) {
    die( "Hacking attempt!" );
}
$vivod = $dle_api->load_from_cache ( 'weather', 14400);
if( !$vivod ) {
	$pogoda = file_get_contents('http://export.yandex.ru/weather/?city=23848'); 
	preg_match('/<weather_type>(.*?)</weather_type>/i',$pogoda,$type); 
	preg_match('/<dampness>(.*?)</dampness>/i',$pogoda,$vlaga); 
	preg_match('/<temperature>(.*?)</temperature>/i',$pogoda,$temp); 
	preg_match('/<image2>(.*?)</image2>/i9;,$pogoda,$img2); 
	preg_match('/<pressure>(.*?)<\/pressure>/i',$pogoda,$press); 
	$vivod = "<div style=\"float:left;display:inline;margin-top:5px;\" ;><font size = 3><strong>В Нефтеюганске $temp[1] °</strong></font><img align=top src=$img2[1] /></div><div style=\"display:inline;\"><font size = 2>";
	$dle_api->save_to_cache( weather );
	echo $vivod;
	}
else {
	echo $vivod;
}
?>

Нет не работает, есть еще ли какие нить предложения?
 
PHP:
<?php 
if( ! defined( 'DATALIFEENGINE' ) ) {
    die( "Hacking attempt!" );
}
$vivod = $dle_api->load_from_cache ( 'weather', 14400);
if( !$vivod ) {
    $pogoda = file_get_contents('http://export.yandex.ru/weather/?city=23848'); 
    preg_match('/<weather_type>(.*?)</weather_type>/i',$pogoda,$type); 
    preg_match('/<dampness>(.*?)</dampness>/i',$pogoda,$vlaga); 
    preg_match('/<temperature>(.*?)</temperature>/i',$pogoda,$temp); 
    preg_match('/<image2>(.*?)</image2>/i9;,$pogoda,$img2); 
    preg_match('/<pressure>(.*?)</pressure>/i,$pogoda,$press); 
    $vivod = "<div style=\"float:left;display:inline;margin-top:5px;\" ;><font size = 3><strong>В Нефтеюганске $temp[1] °</strong></font><img align=top src=$img2[1] /></div><div style=\"display:inline;\"><font size = 2>";
    $dle_api->save_to_cache( 'weather', $vivod);
    echo $vivod;
    }
else {
    echo $vivod;
}
?>
 
  • Автор темы
  • Заблокирован
  • #6
PHP:
<?php 
if( ! defined( 'DATALIFEENGINE' ) ) {
    die( "Hacking attempt!" );
}
$vivod = $dle_api->load_from_cache ( 'weather', 14400);
if( !$vivod ) {
    $pogoda = file_get_contents('http://export.yandex.ru/weather/?city=23848'); 
    preg_match('/<weather_type>(.*?)</weather_type>/i',$pogoda,$type); 
    preg_match('/<dampness>(.*?)</dampness>/i',$pogoda,$vlaga); 
    preg_match('/<temperature>(.*?)</temperature>/i',$pogoda,$temp); 
    preg_match('/<image2>(.*?)</image2>/i9;,$pogoda,$img2); 
    preg_match('/<pressure>(.*?)</pressure>/i,$pogoda,$press); 
    $vivod = "<div style=\"float:left;display:inline;margin-top:5px;\" ;><font size = 3><strong>В Нефтеюганске $temp[1] °</strong></font><img align=top src=$img2[1] /></div><div style=\"display:inline;\"><font size = 2>";
    $dle_api->save_to_cache( 'weather', $vivod);
    echo $vivod;
    }
else {
    echo $vivod;
}
?>

с этого кода выдает ошибку
Parse error: syntax error, unexpected '<' in Z:\home\dle\www\engine\modules\weather_nef.php on line 12
как исправить?
 
попробуй так
PHP:
<?php  
if( ! defined( 'DATALIFEENGINE' ) ) { 
    die( "Hacking attempt!" ); 
} 
$vivod = $dle_api->load_from_cache ( 'weather', 14400); 
if( !$vivod ) { 
    $pogoda = file_get_contents('http://export.yandex.ru/weather/?city=23848');  
    preg_match('/<weather_type>(.*?)</weather_type>/i',$pogoda,$type);  
    preg_match('/<dampness>(.*?)</dampness>/i',$pogoda,$vlaga);  
    preg_match('/<temperature>(.*?)</temperature>/i',$pogoda,$temp);  
    preg_match('/<image2>(.*?)</image2>/i',$pogoda,$img2);  
    preg_match('/<pressure>(.*?)</pressure>/i',$pogoda,$press);  
    $vivod = "<div style=\"float:left;display:inline;margin-top:5px;\" ;><font size = 3><strong>В Нефтеюганске $temp[1] °</strong></font><img align=top src=$img2[1] /></div><div style=\"display:inline;\"><font size = 2>"; 
    $dle_api->save_to_cache( 'weather', $vivod); 
    echo $vivod; 
    } 
else { 
    echo $vivod; 
} 
?>
 
  • Автор темы
  • Заблокирован
  • #8
попробуй так
PHP:
<?php  
if( ! defined( 'DATALIFEENGINE' ) ) { 
    die( "Hacking attempt!" ); 
} 
$vivod = $dle_api->load_from_cache ( 'weather', 14400); 
if( !$vivod ) { 
    $pogoda = file_get_contents('http://export.yandex.ru/weather/?city=23848');  
    preg_match('/<weather_type>(.*?)</weather_type>/i',$pogoda,$type);  
    preg_match('/<dampness>(.*?)</dampness>/i',$pogoda,$vlaga);  
    preg_match('/<temperature>(.*?)</temperature>/i',$pogoda,$temp);  
    preg_match('/<image2>(.*?)</image2>/i',$pogoda,$img2);  
    preg_match('/<pressure>(.*?)</pressure>/i',$pogoda,$press);  
    $vivod = "<div style=\"float:left;display:inline;margin-top:5px;\" ;><font size = 3><strong>В Нефтеюганске $temp[1] °</strong></font><img align=top src=$img2[1] /></div><div style=\"display:inline;\"><font size = 2>"; 
    $dle_api->save_to_cache( 'weather', $vivod); 
    echo $vivod; 
    } 
else { 
    echo $vivod; 
} 
?>
обратно ошибка
Parse error: syntax error, unexpected T_STRING in Z:\home\dle\www\engine\modules\weather_sur.php on line 13
 
PHP:
<?php   
if( ! defined( 'DATALIFEENGINE' ) ) {  
    die( "Hacking attempt!" );  
}
include (ENGINE_DIR.'/api/api.class.php');
$vivod = $dle_api->load_from_cache ( 'weather', 14400);  
if( !$vivod ) {  
    $pogoda = file_get_contents('http://export.yandex.ru/weather/?city=23848');   
    preg_match('/<weather_type>(.*?)</weather_type>/i',$pogoda,$type);   
    preg_match('/<dampness>(.*?)</dampness>/i',$pogoda,$vlaga);   
    preg_match('/<temperature>(.*?)</temperature>/i',$pogoda,$temp);   
    preg_match('/<image2>(.*?)</image2>/i9',$pogoda,$img2);  
    preg_match('/<pressure>(.*?)</pressure>/i',$pogoda,$press);   
    $vivod = "<div style=\"float:left;display:inline;margin-top:5px;\" ;><font size = 3><strong>В Нефтеюганске $temp[1] °</strong></font><img align=top src=$img2[1] /></div><div style=\"display:inline;\"><font size = 2>";  
    $dle_api->save_to_cache( 'weather', $vivod);  
    echo $vivod;  
    }  
else {  
    echo $vivod;  
}  
?>
 
Статус
В этой теме нельзя размещать новые ответы.
Назад
Сверху