[TYPO3-german] Wie schaffe ich es, dass meine Seite Trotz Suchform auf jeder Seite keinen pragma: no-cache bekommt

Oliver Leitner shadow333 at gmail.com
Wed Mar 25 12:19:07 CET 2009


Hallo liebe Kollegen

Ich habe das folgende Problem:

Ich habe auf meiner Seite per Typoscript sowohl ein Such-, als auch
ein Loginformular eingebaut.

Der Code hierfür sieht wie folgt aus:

temp.searchbox = TEXT
temp.searchbox.value (
<form method="post" action="index.php?id=46"
id="abb0731867fc909db4a95fc8d2d4b0965"
name="abb0731867fc909db4a95fc8d2d4b0965" enctype="multipart/form-data"
onsubmit="return
validateForm('abb0731867fc909db4a95fc8d2d4b0965','','','','')">
        <fieldset>
        <label for="searchfield">Search:&nbsp;</label>
        <input type="hidden" name="stype" value="L0" />
        <input type="hidden" name="locationData" value="46:tt_content:189" />
        <input type="hidden" name="scols"
value="tt_content.header-bodytext-imagecaption:tt_news.title-bodytext-short"
/>
        <input class="searchfield" id="searchfield" type="text" name="sword" />
        <input class="search_submit" type="submit" name="submit"
value="search" />
        </fieldset>
</form>
)

[usergroup=*]
#Logoff form with username
lib.login = COA_INT
lib.login {

  20 = TEXT
  20.typolink.parameter = 1
  20.typolink.returnLast = url
  #20.value = Hello <!--###USERNAME###-->!
  20.wrap = <form action="|" method="post"><fieldset
class="loginbox_fieldset"><legend>Hello
<!--###USERNAME###-->!</legend>
  25 = TEXT
  25.value = Welcome on Neverslair Blog, feel free to blog away!
  25.wrap = <p>|</p>
  30 = COA
  30 {
    5 = TEXT
    5.value =
    5.wrap = <input type="submit" id="logout" value="|" />
    10 = TEXT
    10.value = <input type="hidden" name="logintype" value="logout" />
    20 = TEXT
    20.value = <input type="hidden" name="redirect_url" value="" />
    30 = TEXT
    30.value = <div class="sublinks"><a
href="login/register/srfu/edit/">Edit my
profile</a></div></fieldset></form>
  }
}

#lib.login.25.value = Hello <!--###USERNAME###-->
lib.login.30.5.value = logout

# if no user is logged in we show the loginform
[else]
lib.login = COA_INT
lib.login {
  10 = TEXT
  #10.typolink.parameter = |
  #10.typolink.returnLast = url
  10.data = global:HTTP_GET_VARS|id
  10.wrap = <form action="index.php?id=|" method="post"><fieldset
class="loginbox_fieldset"><legend>Login to Neverslair</legend>

  # form
  20 = COA
  20 {
    10 = TEXT
    10.value =
    10.wrap = <p><label for="user">User name: </label><input
type="text" id="user" name="user" value="|" /><br />
    20 = TEXT
    20.value =
    20.wrap = <label for="pass">Password: </label><input
type="password" id="pass" name="pass" value="|" />

    30 = COA
    30 {
      10 = TEXT
      10.value = <input type="hidden" name="logintype" value="login" />
      20 = TEXT
      20.value = {$plugin.tx_newloginbox.storageUID}
      20.wrap = <input type="hidden" name="pid" value="|" />

      # Call the PHP - Script
      #25 = USER
      #25.userFunc = user_md5fepw->md5Challenge

      30 = TEXT
      30.value = <input type="submit" name="submit" value="login" /></p>
      40 = TEXT
      40.value = <div class="sublinks"><a
href="login/register/srfu/create/">Register</a></div></fieldset></form>
    }
  }
}
[usergroup]
[global]

Die Sache funktioniert auch so weit, nur leider schreibt er mir in den
response headers jedesmal raus, dass die Seite nicht gecached werden
soll...

Date: Wed, 25 Mar 2009 11:17:01 GMT
Server: Apache/2.2.4 (Unix) mod_ssl/2.2.4 OpenSSL/0.9.7a PHP/5.2.8
X-Powered-By: PHP/5.2.8
Set-Cookie: fe_typo_user=ea6a1b59b75a67ec6ca81616b9296f6c; path=/
be_typo_user=d3e2fb5dfd0da854f93b6f35cec2ee3b; path=/
Expires: 0
Last-Modified: Wed, 25 Mar 2009 11:17:02 GMT
Cache-Control: private
Pragma: no-cache
Keep-Alive: timeout=15, max=100
Connection: Keep-Alive
Transfer-Encoding: chunked
Content-Type: text/html;charset=utf-8

Die Typo3 Version ist 4.2.6 und mod_headers ist auf dem apachen nicht
eingeschalten.

In der tslib fe siehts ja wie folgt aus:

        /**
         * Reporting status whether we can send cache control headers
for proxy caching or publishing to static files
         *
         * Rules are:
         * no_cache cannot be set: If it is, the page might contain
dynamic content and should never be cached.
         * There can be no USER_INT objects on the page
("isINTincScript()" / "isEXTincScript()") because they implicitly
indicate dynamic content
         * There can be no logged in user because user sessions are
based on a cookie and thereby does not offer client caching a chance
to know if the user $
         *
         * @return      boolean
         */
        function isStaticCacheble()     {
                $doCache = !$this->no_cache
                                && !$this->isINTincScript()
                                && !$this->isEXTincScript()
                                && !$this->isUserOrGroupSet();
                return $doCache;
        }


Gibts da irgendeinen Trick, wie ich des Trozdem public und cacheable hinbekomm?

lg
-- 
Oliver Leitner
http://www.neverslair-blog.net


More information about the TYPO3-german mailing list