Project

General

Profile

Actions

Bug #22273

closed

PageRenderer does not work for USER_INT plugins

Added by Susanne Moog about 14 years ago. Updated over 5 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
-
Target version:
-
Start date:
2011-08-25
Due date:
% Done:

100%

Estimated time:
(Total: 0.00 h)
TYPO3 Version:
4.3
PHP Version:
5.3
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

From the mailinglist (thread on typo3.dev called "PageRender and USER_INT Plugins")

"it looks like the pageRenderer actually renders all the page content before the USER_INT plugins are substituted in the cached output. When this substitution occurs, it seems to only support the old TSFE->additionalHeaderData and not the pageRenderer."

To reproduce

With felogin (or any other USER_INT plugin):

- Added "$GLOBALS['TSFE']->getPageRenderer()->addCssFile('fileadmin/html/123.css');" to the main function --> does not get included
- Changed plugin to USER instead of USER_INT --> file gets included
- Changed back --> gets not included
(issue imported from #M13808)


Files

22273.tar.gz (196 KB) 22273.tar.gz Tobias Hochgürtel, 2011-07-29 20:45
22273.patch (21.8 KB) 22273.patch Tobias Hochgürtel, 2011-07-29 21:26
0001-include-jsFooterFiles-and-jsFooterInline-Javascript-.patch (1.21 KB) 0001-include-jsFooterFiles-and-jsFooterInline-Javascript-.patch Kim Lang, 2012-05-16 00:14

Subtasks 2 (0 open2 closed)

Bug #38238: Refactor page rendererClosedHelmut Hummel2012-06-20

Actions
Bug #29254: TSFE->additionalFooterData for USER_INTClosedOliver Hader2011-08-25

Actions

Related issues 4 (0 open4 closed)

Related to TYPO3 Core - Bug #35371: JMENU headerdata are written without <script>-Tag with UserInt on pageClosed2012-03-29

Actions
Related to TYPO3 Core - Bug #23370: rsaauth doesn't use PageRenderer API to add JS filesClosed2010-08-13

Actions
Related to TYPO3 Core - Bug #39950: Cleanup pageRenderer USER_INT handlingClosed2012-08-19

Actions
Related to TYPO3 Core - Bug #44825: Pagerenderer / page.headerData + USER_INT is not workingClosedHelmut Hummel2013-01-26

Actions
Actions #1

Updated by Ingo Renner over 13 years ago

increased priority, I take the amount of people monitoring this issue as a sign of interest in getting this issue fixed...

Actions #2

Updated by Ingo Renner over 13 years ago

Hey Steffen,

a lot of people seem interested in this issue, could you take a look at it please?

Actions #3

Updated by Steffen Kamper about 13 years ago

  • Target version deleted (0)

I look into this amd try to find a solution. It's not really a pageRenderer issue but the logic behind substitution in USER_INT. Now i'm aware of this problem again ;)

Actions #4

Updated by Tobias Hochgürtel about 13 years ago

Steffen Kamper wrote:

I look into this amd try to find a solution. It's not really a pageRenderer issue but the logic behind substitution in USER_INT. Now i'm aware of this problem again ;)

I have fixed this issue. Should I attach here an patch, when I have complete done?

Actions #5

Updated by Clemens Riccabona almost 13 years ago

Tobias, I would personally appreciate to have a patch, or at least some hints how to fix, as I need this really!

thxal in adv, clemens

Actions #6

Updated by Steffen Gebert over 12 years ago

Tobias? Could you please provide the patch?

Thanks for your contribution!
Steffen

Actions #7

Updated by Tobias Hochgürtel over 12 years ago

hey sorry for my late! I will answer later with Patch. Have to done an task now/currently.

Actions #8

Updated by Tobias Hochgürtel over 12 years ago

Here is my Fix/patch. I hope this is complete. The Used TYPO3 Version is: TYPO3_4.5 when I'm right. If you extract the Archive, you will find 3 folders,

  • hackes | The Modified Files, which I have changed.
  • hackes_with_debug | The Modiefied Files, which I have changed, with debuging Code inside, should not be used.
  • orginales | The Orginal files, which I haven't modified.

All Directories have the folder structure from the typo3 root dir, with only the needed Directories with the changed/patches files.

I hope it will help! If there is an Problem write, I could help to get this into the official TYPO3 tree.

Actions #9

Updated by Chris topher over 12 years ago

  • Status changed from New to Needs Feedback

Hi Tobias,

thanks for your work!

Can you please provide your changes as a diff file?
You can create such a file by using the tool "diff" on the folders "hackes" and "originales".
Use the parameter "-u" like "diff -u ..." to get the resulting diff file in unified format.

Actions #10

Updated by Tobias Hochgürtel over 12 years ago

okay, I think I have it?

Actions #11

Updated by Chris topher over 12 years ago

Yes, basically looks good. A quick formal review:

  • General
    • indentation always with tabs
  • class.tslib_fe.php
    • I think the patch - at least class.tslib_fe.php - is in the wrong direction (your new lines are displayed as "to be removed" and vice versa).
    • Only that one hunk around lines 3199 with your changes should be there. The rest not.
    • Shorten the comment. One or two lines above your new lines are enough.
  • class.t3lib_pagerenderer.php
    • Did you use the same code as a base for both file versions? I am asking because of the many changes, new functions and so on. It would be ideal if you took the most current version from the branch you are working with from http://git.typo3.org/TYPO3v4/Core.git (look for "heads" at bottom of page).
    • remove debug() code.
    • do not comment unused code, but remove it completely.
    • do not add "@author" tags and "@see forge.typo3...".
Actions #12

Updated by Tobias Hochgürtel over 12 years ago

okay, thanks for the advice. I will try to consider them in the future, but don't hesitate to give me more advices.

I will check the patch/code for adding an clean Version of it.

I have use the same base version of the file. Without looking into the file now, I would say that the many new functions are from me. I have packed some Code into few small function's to get it working correctly and reducing doubled code.

Not used the git version yet of typo3. Shorting comments is possible.(question of taste). If I find time, I will implement the patch for the git-Version.

Indentation, that's an terrible thing. In one Project they use tabs and in an other they use spaces. I use normally 4 Spaces for intending.

Actions #13

Updated by Simon Schaufelberger over 12 years ago

any progress here?

Actions #14

Updated by Gerrit Code Review over 12 years ago

  • Status changed from Needs Feedback to Under Review

Patch set 1 for branch master has been pushed to the review server.
It is available at http://review.typo3.org/7465

Actions #15

Updated by Gerrit Code Review over 12 years ago

Patch set 2 for branch master has been pushed to the review server.
It is available at http://review.typo3.org/7465

Actions #16

Updated by Kim Lang almost 12 years ago

i missed the "jsFooterFiles" in this patch.

perhaps was this a solution:

$this->content = str_replace('</body>', $additionalHeaderDataForUserIntPlugin['jsFooterFiles'] . $additionalHeaderDataForUserIntPlugin['jsFooterInline'] . '</body>', $this->content);

Actions #17

Updated by Markus Klein almost 12 years ago

What do you mean with "I missed"?

If you have a comment to the code, please post it directly in gerrit.

Actions #18

Updated by Kim Lang almost 12 years ago

Markus Klein wrote:

What do you mean with "I missed"?

If you have a comment to the code, please post it directly in gerrit.

I dont know how to do this.
a make a patch.
can you post it for me?

Actions #19

Updated by Simon Schaufelberger almost 12 years ago

I dont know how to do this.

learn how to do it: http://wiki.typo3.org/Contribution_Walkthrough_with_CommandLine ;)

  1. do a checkout with the url in gerrit
  2. make your changes
  3. add them
  4. git commit --amend
  5. push them
Actions #20

Updated by Gerrit Code Review almost 12 years ago

Patch set 3 for branch master has been pushed to the review server.
It is available at http://review.typo3.org/7465

Actions #21

Updated by Kim Lang almost 12 years ago

I make an Update of the patch from "Dominique Feyer" that includes a Fix for TS Option "config.moveJsFromHeaderToFooter".

It is available at http://review.typo3.org/7465

Actions #22

Updated by Gerrit Code Review almost 12 years ago

Patch set 4 for branch master has been pushed to the review server.
It is available at http://review.typo3.org/7465

Actions #23

Updated by Gerrit Code Review almost 12 years ago

Patch set 5 for branch master has been pushed to the review server.
It is available at http://review.typo3.org/7465

Actions #24

Updated by Gerrit Code Review almost 12 years ago

Patch set 6 for branch master has been pushed to the review server.
It is available at http://review.typo3.org/7465

Actions #25

Updated by Gerrit Code Review almost 12 years ago

Patch set 7 for branch master has been pushed to the review server.
It is available at http://review.typo3.org/7465

Actions #26

Updated by Gerrit Code Review almost 12 years ago

Patch set 8 for branch master has been pushed to the review server.
It is available at http://review.typo3.org/7465

Actions #27

Updated by Helmut Hummel almost 12 years ago

Just for the records, here is how the rendering of *_INT works respecting the additionalHeaderData and additionalFooterData:

First Hit (or uncachable page):

  1. render page cObjects (tslib_pagegen::renderContent )
  2. add placeholders for uncached objects during this rendering (tslib_content_*Internal)
  3. Store additionalHeaderData and additionalFooterData in cached config (tslib_pagegen::renderContentWithHeader starting from if (is_array($GLOBALS['TSFE']->config['INTincScript'])) {)
  4. Replace additionalHeaderData and additionalFooterData data array with placeholders ($GLOBALS['TSFE']->additionalHeaderData = array ('<!--HD_' . $GLOBALS['TSFE']->config['INTincScript_ext']['divKey'] . '-->'); // Clearing the array)
  5. render the page with all placeholders (tslib_pagegen::renderContentWithHeader)
  6. cache HTML page + config ($TSFE->generatePage_postProcessing();)
  7. restore additionalHeaderData and additionalFooterData from config ($TSFE->INTincScript();)
  8. replace placeholders of uncached objects ($TSFE->INTincScript();)
  9. replace additionalHeaderData and additionalFooterData placeholders ($TSFE->INTincScript();)

Cache Hit:

  1. get placehoder HTML + config from cache ($TSFE->getFromCache();)
  2. restore additionalHeaderData and additionalFooterData from config ($TSFE->INTincScript();)
  3. replace placeholders of uncached objects ($TSFE->INTincScript();)
  4. replace additionalHeaderData and additionalFooterData placeholders ($TSFE->INTincScript();)

As you can see, the last 3 steps are always the same. To get this working with the pageRenderer, we need to store the current state of it at step 3. of the uncached rendering and restore this state before the uncached objects are executed. This needs to be done to avoid double inclusion of assets with the pageRenderer which is easy with additionalHeaderData and additionalFooterData if unique keys for the arrays are used.

Hope this makes it a bit clearer and serves as a reference for future changes in this area.

Actions #28

Updated by Gerrit Code Review almost 12 years ago

Patch set 9 for branch master has been pushed to the review server.
It is available at http://review.typo3.org/7465

Actions #29

Updated by Gerrit Code Review over 11 years ago

Patch set 10 for branch master has been pushed to the review server.
It is available at http://review.typo3.org/7465

Actions #30

Updated by Gerrit Code Review over 11 years ago

Patch set 11 for branch master has been pushed to the review server.
It is available at http://review.typo3.org/7465

Actions #31

Updated by Gerrit Code Review over 11 years ago

Patch set 12 for branch master has been pushed to the review server.
It is available at http://review.typo3.org/7465

Actions #32

Updated by Helmut Hummel over 11 years ago

  • Status changed from Under Review to Resolved
Actions #33

Updated by Dominic Garms over 11 years ago

Hello, great that this issue is finally fixed! will it be backported into the versions 4.5, 4.6, 4.7? Some extensions requires the pageRenderer (fed, dmf_galleria ...) and would love to see this fix for the 4.x branch. Cheers Dominic

Actions #34

Updated by Kay Strobach over 11 years ago

Hello Dominnic,

as i would interpret that as a bug, please just cherrypick the current fix and port it to 4.5, 4.6 and 4.7 as seperate changerequest :D

I hope it will than be included in the next release - i stumbled upon that bug during the development of my dynamic css extension as well.
Especially stuff from ts (get files and replace them (*.less -> *.css) hasn't worked well with enabled caching :(

Regards
Kay

Actions #35

Updated by Helmut Hummel over 11 years ago

Hi,

Kay Strobach wrote:

as i would interpret that as a bug, please just cherrypick the current fix and port it to 4.5, 4.6 and 4.7 as seperate changerequest :D

I would also consider this a bug, but the fix was rather complicated and included a lot of prior refactoring of the pageRenderer.
This change will not go into released branches, sorry.

Actions #37

Updated by Benni Mack over 5 years ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF