1

画像のフィードを処理してアルバムを作成するカスタム php ページがあります。ただし、フィードに写真を追加するたびに、キャッシュをクリアするまで Drupal ページは変更されません。

その特定のページをキャッシュしないように Drupal に指示する方法はありますか?

ありがとう、ブレイク

編集: Drupal v6.15 oswald の意味が正確にはわかりません。team2648.com/media はページです。私はphpインタープリターモジュールを使用しました。phpコードは次のとおりです。

    <?php
//////// CODE by Pikori Web Designs - pikori.org   ///////////
//////// Please do not remove this title,          ///////////
//////// feel free to modify or copy this software ///////////
$feedURL = 'http://picasaweb.google.com/data/feed/base/user/Techplex.Engineer?alt=rss&kind=album&hl=en_US';


$photoNodeNum = 4;
$galleryTitle = 'Breakaway Pictures';
$year = '2011';
?>



<?php
  /////////////// DO NOT EDIT ANYTHING BELOW THIS LINE //////////////////

$album = $_GET['album'];
if($album != ""){

  //GENERATE PICTURES
  $feedURL= "http://".$album."&kind=photo&hl=en_US";
  $feedURL = str_replace("entry","feed",$feedURL);

  $sxml = simplexml_load_file($feedURL);
  $column = 0;
  $pix_count = count($sxml->channel->item);

  //print '<h2>'.$sxml->channel->title.'</h2>';
  print '<table cellspacing="0" cellpadding="0" style="font-size:10pt" width="100%"><tr>';
  for($i = 0; $i < $pix_count; $i++) { 

print '<td align="center">';
$entry = $sxml->channel->item[$i];
$picture_url = $entry->enclosure['url'];
$time = $entry->pubDate;
$time_ln = strlen($time)-14;
$time = substr($time,0,$time_ln);
$description = $entry->description;
$tn_beg = strpos($description, "src=");
$tn_end = strpos($description, "alt=");
$tn_length = $tn_end - $tn_beg;
$tn = substr($description, $tn_beg, $tn_length);
$tn_small = str_replace("s288","s128",$tn);

$picture_url = $tn;
$picture_beg = strpos($picture_url,"http:");
$picture_len = strlen($picture_url)-7;
$picture_url = substr($tn, $picture_beg, $picture_len);
$picture_url = str_replace("s288","s640",$picture_url);
print '<a rel="lightbox[group]" href="'.$picture_url.'">';
print '<img '.$tn_small.' style="border:1px solid #02293a"><br>';
print '</a></td> ';

if($column == 4){ print '</tr><tr>'; $column = 0;}
else $column++;
  }
  print '</table>';
  print '<br><center><a href="media">Return to album</a></center>';
} else {

  //GENERATE ALBUMS 
  $sxml = simplexml_load_file($feedURL);
  $column = 0;
  $album_count = count($sxml->channel->item);

  //print '<h2>'.$galleryTitle.'</h2>';
  print '<table cellspacing="0" cellpadding="0" style="font-size:10pt" width="100%"><tr>';
  for($i = 0; $i < $album_count; $i++) { 

$entry = $sxml->channel->item[$i];

$time = $entry->pubDate;
$time_ln = strlen($time)-14;
$time = substr($time,0,$time_ln);

$description = $entry->description;
$tn_beg = strpos($description, "src=");
$tn_end = strpos($description, "alt=");
$tn_length = $tn_end - $tn_beg;
$tn = substr($description, $tn_beg, $tn_length);

$albumrss = $entry->guid;
$albumrsscount = strlen($albumrss) - 7;
$albumrss = substr($albumrss, 7, $albumrsscount);

$search = strstr($time, $year);
if($search != FALSE || $year == ''){
  print '<td valign="top">';
  print '<a href="/node/'.$photoNodeNum.'?album='.$albumrss.'">';
  print '<center><img '.$tn.' style="border:3px double #cccccc"><br>';
  print $entry->title.'<br>'.$time.'</center>';
  print '</a><br></td> ';

  if($column == 3){ 
    print '</tr><tr>'; $column = 0;
  } else {
    $column++;
  }
} 
  }
  print '</table>';
}
?>
4

6 に答える 6

2

ご回答有難うございます。

あなたがリンクしたサイトは私に検索するためのいくつかの新しい言い回しを与えてくれたので、私はこれを見つけました: http ://www.drupalcoder.com/story/365-disable-drupals-page-cache-for-some-pages

それから私はこれにつながりました:http: //drupal.org/project/cacheexclude

それはまさに私が望んでいたことをしました。

于 2011-01-12T17:26:35.717 に答える
2

お役に立てれば。

これは Drupal 6 用です。

于 2011-01-12T17:01:43.773 に答える
1

キャッシュしたくないカスタム ページの上部に次のコード行を記述します。

$GLOBALS['conf']['cache'] = FALSE;
于 2012-10-12T12:34:18.407 に答える
1

これは、キャッシュに関する特定の質問には答えませんが、このようなものにはPicasaモジュールのような Drupal ネイティブ ソリューションを使用することを検討してください。

ここにあるような Drupal 環境で Drupal 以外の PHP アプリケーションを使用すると、他の Drupal コンポーネントとの奇妙なやり取りが発生します。Drupal モジュールは Drupal を念頭に置いて構築されているため、通常は適切なキャッシングなどが組み込まれています。

于 2011-01-12T21:48:18.957 に答える
0

Drupal 6 の場合、

特定のページをキャッシュから除外するだけの場合は、URL を指定するだけでキャッシュ除外モジュールを使用できます。

drupal 7 でも利用できますが、開発版です。

于 2012-10-16T05:47:44.947 に答える
0

はい、プログラムで実行できます。以下のコードは Drupal 6 と 7 の両方で有効です。

参照: http://techrappers.com/post/27/how-prevent-javascript-and-css-render-some-drupal-pages

/**
 * Implements hook_init().
 */
function MODULE_NAME_init() {
global $conf;
// current_path() is the path on which you want to turn of JS or CSS cache
  if (current_path() == 'batch' || current_path() == 'library-admin') {
    // If you want to force CSS or JS cache to turned off
    $conf['preprocess_js'] = FALSE;
    $conf['preprocess_css'] = FALSE;

    // If you want normal caching to turned off 
     drupal_page_is_cacheable(FALSE); 
  } 
}

drupal_page_is_cacheable(FALSE); に注意してください。$conf['preprocess_js'] = FALSE を使用しない限り、JS キャッシュが自動的にオフになることはありません。

于 2017-03-09T04:28:56.563 に答える