[TYPO3-english] cHash does not work with forms
Vahan Amirbekyan
vamirbekyan at dgfoundation.org
Mon Mar 30 21:54:42 CEST 2009
Xavier,
I used your suggestion as it was the easiest to try out.
thank you!
Xavier Perseguers wrote:
> Hi,
>
>>> I think there should be a solution operantly it is not that obvious.
>>> I have a form with a dropdown of country codes that reloads the same
>>> page with &country= URL get parameter.
>>> I need these pages to be cached.
>>> How to get the page URLs with cHash?
>>
>> Fake a cHash using one of early TSFE hooks. This is a dangerous way
>> but I do not think you have any other option.
>
> I do not know whether this is an option for you but I had the very same
> problem with a combobox I populated with info in one of my extensions.
>
> I had a dropdown with years and upon selection I reloaded the page with
> a year GET parameter. Here is my code:
>
> -------------------------
>
> $options = array();
> foreach ($years as $year) {
> if ($year == $selectedYear) {
> $format = '<option value="%s" selected="selected">%s-%s</option>';
> } else {
> $format = '<option value="%s">%s-%s</option>';
> }
>
> $url = $this->cObj->typoLink_URL(
> array(
> 'parameter' => $GLOBALS['TSFE']->id,
> 'useCacheHash' => true,
> 'additionalParams' => '&' . $this->prefixId . '[year]=' .
> $year,
> )
> );
> $options[] = sprintf($format, $url, $year, $year + 1);
> }
>
> $yearSelector = '
> <label for="' . $this->prefixId . '[year]">' . $this->sL('year') .
> '</label>
> <select name="' . $this->prefixId . '[year]" id="' . $this->prefixId
> . '[year]" onchange="location=this.value;">
> ' . join("\n", $options) . '
> </select>
> ';
>
> -------------------------
>
> I hope this will help you not having to fake the cHash and still use
> cache...
>
More information about the TYPO3-english
mailing list