|
|
Posted by lister on 02/18/07 21:58
On Feb 18, 9:23 pm, "petersprc" <peters...@gmail.com> wrote:
> Since the PHP script is run for each request, you can output the name
> in the session:
>
> header.php:
>
> <p>
> You are logged in as
> <?= htmlentities($_SESSION['userName'], ENT_QUOTES) ?>
> </p>
>
> On Feb 18, 4:17 pm, "lister" <listerofsme...@hotmail.com> wrote:
>
>
>
> > I'm fairly new to this web authoring lark, and I was pondering today
> > how to optimise my site for cacheing, but as far as I can see there is
> > no way to do it.
>
> > My site has a standard header that includes the option to either
> > "Login" or "Logout <username>". This header is generated by PHP
> > reading the session ID and looking up the corresponding username.
>
> > I guess I could cache the username in the user's session data to save
> > a DB lookup (or maybe even a cookie to save looking up any session
> > data at all). However, I still cannot see how I can ever cache the
> > resultant page since the header is user specific, even if everything
> > else is static?
>
> > How do other people handle this? Having the username at the top seems
> > a pretty common design, so I guess the problem must have been tackled
> > somehow?- Hide quoted text -
>
> - Show quoted text -
Yes, that's what I'm doing now (near enough).
My point was that many high hit websites cache the result of the php,
so that the script doesn't have to be run at all. I could not see a
way of doing that when user specific login details are displayed in
the header.
Navigation:
[Reply to this message]
|