[TYPO3-hci] Saving default main and submodules into cookie

Tapio Markula tapio.markula at atwebteam.com
Sun Dec 31 15:33:22 CET 2006


Bernd Wilke
>> When you for example have last time used
>> File > Images , in next session you open Typo3 so that in the main 
>> module 'File' is open on top
>> and related module opened as default starting module.
>>
>> Would that be nice in Typo3 as default?
> 
> I think it would be a nice feature, but why storing in cookies?

better at least than storing in JavaScript objects, which will be 
rewritten every time you reload the entire frameset.
storing into cookies works at least in the same computer over sessions.

> Some sites I'm accessing from different computers. On every computer I get
> another startscreen? sounds disturbing. :-(

the only way to avoid this is to create some extra fields into table
be_users and save information there.
But in many situations this might not be possible because actions are
handled with JavaScript. Typo3 stores information of last visited page 
and last highlighted page into temporary JavaScript objects o the 
frameset. They are available as far as the entire frameset has not been 
reloaded. Every file, which has the same frameset can use the same 
JavaScript objects.

In addition of temporary JavaScript object, cookies can be used with 
JavaScript and they store information over sessions in the same computer 
- much better solution however than loosing information in every reload 
of the frameset!

Concerning highligted page and last active page, I use a cookie to store 
information temporary as JavaScript object, which Typo3 uses as default.


 > Why not storing this data in the BE-user-data (serialized)?

or just simple unserialized values. That is not the main problem.

How do you would save using JavaScript the necessary information into 
the table be_users of the Typo3 database? I don't know if this is 
possible and how to do that with JavaScript.

Note that almost in all situations, JavaScript creates the new cookie 
information.

Cookie-data could be stored using PHP also into database and if
data exists, it would be used, if cookies have not been found.
Then the information is stored between computers.

In order to store information to use it in PHP-scripts,
I anyway need cookies, because I don't know any other way,
how to get information, created by JavaScipt usable for PHP-scripts.

Note that if you execute JavaScript, the information is available for 
PHP in the *next* reload of the page because PHP has been executed 
before any client side scripts.

In this case this is ok, because you need the information only in the
next reload because you can use meanwhile JavaScript objects of the 
frameset. You need temporary JavaScript object because you can't
use cookie-data without reloading the page.

Maybe direct access to database using JavaScript is possible,
but I don't know how to do that.


More information about the TYPO3-team-hci mailing list