Jump to content

last modified на все страницы


Rashp
 Share

Recommended Posts

Всем, привет, помогите плз. мозгов не хватает прикрутить в header.twig

<meta http-equiv="expires" content="{{ expires }}">
<meta http-equiv="last-modified" content="{{ last_modified }}">

 

сделал в catalog/controller/common/lastmodified.php

 

<?php
// Установите заголовки
$Expires = @date('D, d M Y H:i:00', time() + 360000);
$num = mt_rand(2000, 10000);
$LastModified = gmdate("D, d M Y H:i:s \G\M\T", time() - $num);

$IfModifiedSince = false;
if (isset($_ENV['HTTP_IF_MODIFIED_SINCE']))
    $IfModifiedSince = strtotime(substr($_ENV['HTTP_IF_MODIFIED_SINCE'], 5));
if (isset($_SERVER['HTTP_IF_MODIFIED_SINCE']))
    $IfModifiedSince = strtotime(substr($_SERVER['HTTP_IF_MODIFIED_SINCE'], 5));

if ($IfModifiedSince && $IfModifiedSince >= $num) {
    header($_SERVER['SERVER_PROTOCOL'] . ' 304 Not Modified');
    exit;
}

 Установка заголовков
header('Expires: ' . $Expires);
header('Last-Modified: ' . $LastModified);

 Загрузка и рендеринг шаблона Twig
$this->load->view('common/header', $data);
?>
 

но последний блок не работает чтоб зацепить его в header

подскажите плз.

Заранее благодарен

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...