| Author |
Message |
![[Post New]](/forum/templates/default/images/icon_minipost_new.gif) 24/02/2010 12:55:39
|
arcotc
Expert
Joined: 11/11/2009 14:24:05
Messages: 72
Offline
|
Yes, I have done that at the root node level and allowed it to be inherited down by each page.
But this isn't working for the root node page, never mind any other pages. Depending on the browser I have to manually refresh the page to get it to go get the latest version of the page.
I have tried all the usual tricks of setting cache-control, expiring the page and pragma in the http header.
Everything points to the way the pages are being delivered by the live version of the site as the working version works perfectly.
Mark.
|
|
|
 |
![[Post New]](/forum/templates/default/images/icon_minipost_new.gif) 24/02/2010 13:46:24
|
astik
Expert
Joined: 11/11/2009 11:41:32
Messages: 99
Location: France
Offline
|
When you say you "manually refresh the page" ... what do you do exactly ? just hitting F5 on your browser ?
When you talk about "usual tricks of setting cache-control", did you set it into your component ? Did you check the http headers with a proxy ?
|
|
|
 |
![[Post New]](/forum/templates/default/images/icon_minipost_new.gif) 24/02/2010 14:35:33
|
arcotc
Expert
Joined: 11/11/2009 14:24:05
Messages: 72
Offline
|
Yes I mean pressed F5 or hit the refresh button to get the page to reload.
I have set the http header values in the base template and also in my component. I have not checked the http headers with a proxy, I will do that now.
Mark.
|
|
|
 |
![[Post New]](/forum/templates/default/images/icon_minipost_new.gif) 24/02/2010 16:21:27
|
astik
Expert
Joined: 11/11/2009 11:41:32
Messages: 99
Location: France
Offline
|
Ok ... so I've got my answer ...
There is no problem with infoglue cache management so ... If it works only when you change something on your browser it means that there is a problem on your browser or with the http headers ...
In infoglue, if you put code into your template, it will be execute only one ... then the resulting code is cache, that the first thing.
Then, if you're modifying request and response into your components, it on't change anything ... if I'm not wrong there is a different render context for each component So the response you are modifying is not the response the browser receive.
To change something on the main request or main response you have 2 solutions :
- servlet filter : you have to add it in your web.xml
- pretemlate processing : check the developer manual, it's on page 32 for infoglue 2.9.6 :
"Since 2.9 there is a new solution. The solution is based on that every component can have a preprocess phase if wanted. If a component has a PreTemplate it (and all other components PreTemplates) will run first in the preprocessing phase where they will be free to put data into the page context for the normal presentation templates to read. Before the preprocessing all components on the page with a PreTemplate is ordered in any sortorder defined in advanced properties on each component. The PreTemplate can do anything the normal Template can except print to the browser so you should consider it the dataprocessing part and not a presentation part."
|
|
|
 |
![[Post New]](/forum/templates/default/images/icon_minipost_new.gif) 24/02/2010 17:20:07
|
arcotc
Expert
Joined: 11/11/2009 14:24:05
Messages: 72
Offline
|
This sounds like a possibility, but the documentation is a little sparse (1 page with no example), can I state what I think I need to do and can you please confirm or amend it as necessary.
1. Create a component in the Content Tool (which will be used as a preprocessor)
2. In the preprocessor component add some code that will set an Infoglue Property (or can I just set a session/request attribute?)
3. Define a place holder for this new component in my base component template using <ig:slot/> in the normal way, the preprocessor needs to be run on every page as the banner is on every page which shows the login box.
4. In the Structure Tool add the preprocessor component to the page and set it's Advance Properties\Preprocessor Order to 1 (the default is 0 which I presume means that it is not a preprocessor component, or do I have to increase the number for all components on the page so that the preprocessor component has a lower number than them?)
Every time the page loads the preprocessor component will now be run, and because it will set the Infoglue Property (or session/request attribute?) the page will be affected appropriately, i.e. be able to display the logged in/out state correctly based on the Infoglue Property (or session/request attribute?).
Yes /No /Complete wrong?
Thanks,
Mark.
|
|
|
 |
![[Post New]](/forum/templates/default/images/icon_minipost_new.gif) 24/02/2010 17:33:56
|
astik
Expert
Joined: 11/11/2009 11:41:32
Messages: 99
Location: France
Offline
|
Sorry to say that : Complete wrong =D
indeed the doc is far from perfect and it's too bad because it's a pretty neat feature.
Allowing pretemplating is quite easy in fact ! In management tool > content type definition, you'll find a CTD called HTMLTemplate. Edit it.
Add a new attribute : PreTemplate (Pre processing template) of type textarea.
Save and you're done.
Now, go back to your component (your base one for example), you should have a new textarea after "group name" and before "Associated attachments". In this textarea you should be able to make all java treatment you want. Remember one thing : you cannot write to the response outputstream. For a start, you could do a System.out.println ... (I know it's ugly =/ but it's just to validate that pretemplate is activate).
|
|
|
 |
![[Post New]](/forum/templates/default/images/icon_minipost_new.gif) 03/03/2010 11:32:53
|
arcotc
Expert
Joined: 11/11/2009 14:24:05
Messages: 72
Offline
|
I didn't need to set up the PreTemplate text box as I'm using version 2.9.7.1 Final and it is already available in that version.
I have placed the following code in this text field:
I can not find any reference to the System.out.println in any log file or on the page itself (which I'm not expecting this is not writting to the page output stream).
When I attempt to load the session attribute set in the PreTemplate on the page itself I get nothing.
It looks to me as if this is not working, can you please shed some light on this?
Thanks,
Mark.
|
|
|
 |
![[Post New]](/forum/templates/default/images/icon_minipost_new.gif) 03/03/2010 11:54:08
|
astik
Expert
Joined: 11/11/2009 11:41:32
Messages: 99
Location: France
Offline
|
I use this feature using request :
<c:set var="pageTitle" value="${pc.pageTitle}" scope="request" />
it works great.
I try to do the same way you told us :
and in the template :
It works too ...
I don't understand why it is not working for you.
BTW, I'm using the same version as you : 2.9.7.1.
This message was edited 1 time. Last update was at 27/01/2011 15:34:39
|
|
|
 |
![[Post New]](/forum/templates/default/images/icon_minipost_new.gif) 03/03/2010 12:15:14
|
arcotc
Expert
Joined: 11/11/2009 14:24:05
Messages: 72
Offline
|
Quick question, do you have to define the taglib 'c' in the PreTemplate text box, i.e. does it have to be a complete JSP page in it's own right?
Or do you simply put:
Thanks,
Mark.
|
|
|
 |
![[Post New]](/forum/templates/default/images/icon_minipost_new.gif) 03/03/2010 12:19:32
|
astik
Expert
Joined: 11/11/2009 11:41:32
Messages: 99
Location: France
Offline
|
You have to define it ... I think it's a separate JSP ...
|
|
|
 |
![[Post New]](/forum/templates/default/images/icon_minipost_new.gif) 04/03/2010 10:29:59
|
arcotc
Expert
Joined: 11/11/2009 14:24:05
Messages: 72
Offline
|
One more step, a little bit forward but still no joy!
I have my pageKey set up as follows in deliver.properties (infoglueCMS and infoglueDeliverLive webapps, still not certain which takes effect):
I have the following code in the Template HTML ("Template"):
In the Pre processing template ("PreTemplate") textarea I have the following code:
As things stand I would expect rightNow to continue to hold the same value each time I navigate away from the page, and then back again, but the rightNow2 value (as it is set in the PreTemplate) should be changing its values every visit to the page.
This is not happening, both rightNow and rightNow2 are assigned values when the page is first loaded, then when navigating away and back again the values do NOT change. If I press F5 on the browser window both values are updated.
I was under the impression that PreTemplate code was run every visit to a page regardless of whether the page is cached or not.
Please advise.
Thanks,
Mark.
|
|
|
 |
![[Post New]](/forum/templates/default/images/icon_minipost_new.gif) 04/03/2010 11:27:53
|
astik
Expert
Joined: 11/11/2009 11:41:32
Messages: 99
Location: France
Offline
|
You're mixing things ...
Pre-template, as for template is executed each time it is necessary ... so if there is cache, it won't be executed for each visit.
So if there is no cache, it will be executed each time !
If you have no change while you're browsing your website and there is a change when you hit F5 for refresh, it is a browser cache matter, not an infoglue one ! To check for this problem, one more time, please check your HTTP header with an http proxy ! That way you will be sure of 2 things :
- is your browser sending a request ?
- are the http header correct ?
If the http header are incorrect for your needs, set them into the pretemplate block (response.setXXX, ...).
There is no miracle, if you want your page dynamic with that kind of timer on the server side, you'll have to deactivate cache ...
|
|
|
 |
|
|