1

Webサイトのログインシステムを設定しました。サーバーは正しいログインの詳細を承認し、ハッシュされたCookieを送信してログインセッションを維持します。

問題は、ユーザーがログインしたときに、カスタムヘッダーバーにログインの詳細を表示して、まったく同じページを送信したいということです(ここで見つけたほとんどの投稿では、ログイン時にまったく新しいページを送信する方法について説明しています。する)。

htmlファイル全体を読み込んでいるので、その場で編集できず、情報をロードする必要があるため、WebSocket呼び出しを実行したくないので、これには少し戸惑っていると思います。ページが読み込まれた瞬間から。

ここでは非常に単純なものが欠けていると確信していますが、検索しても何も見つかりませんでした。

4

1 に答える 1

0

It sounds like you want to send similar pages and not the exact same pages. If that is the case then I would suggest you use view templates to generate the HTML on the server instead of using static HTML files. I use Kiwi and I have a single layout.kiwi file that renders the main layout for many of my pages. The layout template renders links in the header section with this:

    {{each headerItems}}
      {{if $value.link}}
        <a href="${$value.link}">${$value.title}</a>
      {{else}}
        <span>${$value.title}</span>
      {{/if}}
    {{/each}}

On the server I build an array {link: '', title: ''} objects and pass that to the function that renders the template. I build a different array depending on whether the user is logged in or whether the user has access to additional administration pages.

于 2013-01-11T02:31:08.233 に答える