$key_60_sql = $pname.':'.get_field('user_version');
if ($redis->exists($key_60_sql)) {
$_s_3 = $redis->hgetall($key_60_sql);
$s_3 = (object)$_s_3;
} else {
$sql_60 = $wpdb->get_row (
"
SELECT *
FROM learn
WHERE s_name = '".$_60n->name."'
"
);
$array = (array)$sql_60;
// вычисляете свой кусок, затем
$redis->hMSet($key_60_sql, $array);
$redis->expire($key_60_sql, 604800); // 1 неделя
$_s_3 = $redis->hgetall($key_60_sql);
$s_3 = (object)$_s_3;
}
function get20($bild_20,$pname)
{
global $wpdb;
$current_user = wp_get_current_user();
ob_start();
foreach( $bild_20 as $_bild_20 ) { include '20n.php'; }
return ob_get_clean();
}
$redis = new Redis();
// подключение к серверу
$redis->connect( 'localhost' );
if ( $bild_20 ) {
echo '<div class="20s '.$pname.'">блок 1</div>';
$key = $pname.'_20_';
if ($redis->exists($key)) {
echo $redis->get($key);
} else {
$content20 = get20($bild_20,$pname);
// вычисляете свой кусок, затем
$redis->set($key, $content20);
$redis->expire($key, 3600); // expires in 1 hour
echo $redis->get($key);
}
}
<?php
session_start();
if( isset($_POST['width']) && isset($_POST['height']) ){
$_SESSION['screenWidth'] = $_POST['width'] ;
$_SESSION['screenHeight'] = $_POST['height'] ;
}
?>
$.post(
'<?php bloginfo('template_url'); ?>/screen.php',
{
'width' : $(window).width(),
'height' : $(window).height()
}
)
include 'screen.php';
$width = $_SESSION['screenWidth'];
echo $width;
$big = '1700';
$midle = '1000';
if ($width > $big){echo '-1';}
if ($width > $midle && $width < $big){echo '-2';}
if ($width < $midle){echo '-3';}