Re: [Cppcms-users] How to store/manipulate dates?
Brought to you by:
artyom-beilis
|
From: Artyom B. <art...@ya...> - 2012-02-07 11:37:56
|
----- Original Message -----
> From: "ele...@ex..." <ele...@ex...>
>
> [snip]
>
> The example blog application seems use java script to do some client side
> checking, but what's the best way to do it on the server side?
>
I use javascript because I want to cache pages and so I don't need to
have separate version for visitor and administrator.
> In simplistic terms what I'm trying to do in the template is something
> like this
>
> <%if is_logged_in()%>
> <% gt "Hello {1}" using first_name%>
> <%else%>
> Please login below:
> <%end%>
>
a) you can create a variable called first_name that you set in the controller
that remains empty if the user is not logged in
<%if not empty first_name %>
<% gt "Hello {1}" using first_name%>
<%else%>
Please login below:
<%end%>
b) You can create a variable or callback in the content called "is_logged_in"
c) You can use session object directly
<% if app().session().is_set("username") %>
<% gt "Hello {1}" using first_name%>
<%else%>
Please login below:
<%end%>
Enjoy :-)
Artyom Beilis
-------------
Support CppCMS by donating money:
https://sourceforge.net/donate/index.php?group_id=209965
|