Some kind of {section show=$user.is_logged}

Author Message

Federico Canuti

Monday 19 September 2005 9:31:02 am

I would like to create a section like
{section show=$node.object.can_create}
code
{section-else}
code
{/section}
but looking if the user is logged or not (and not using a permission policy or something, logged in the entire site even if he can't do anything).
Can you help me?
Thanks

Hans Melis

Monday 19 September 2005 9:37:20 am

Try this:

{def $current_user=fetch('user','current_user')}

{if $current_user.is_logged_in}
do stuff
{else}
do other stuff
{/if}

That syntax is of course only valid if your version >= 3.6.0. For lower versions, try your familiar let block with {section show=...}.

hth

Hans
http://blog.hansmelis.be

Federico Canuti

Monday 19 September 2005 4:54:15 pm

great thanks

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.

eZ debug

Timing: Jan 19 2025 11:55:02
Script start
Timing: Jan 19 2025 11:55:02
Module start 'layout'
Timing: Jan 19 2025 11:55:02
Module start 'content'
Timing: Jan 19 2025 11:55:03
Module end 'content'
Timing: Jan 19 2025 11:55:03
Script end

Main resources:

Total runtime1.3415 sec
Peak memory usage4,096.0000 KB
Database Queries57

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0051 589.2891152.6406
Module start 'layout' 0.00510.0032 741.929739.4766
Module start 'content' 0.00841.3318 781.4063528.8438
Module end 'content' 1.34020.0013 1,310.25008.1250
Script end 1.3415  1,318.3750 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00310.2332160.0002
Check MTime0.00130.0980160.0001
Mysql Total
Database connection0.00070.052010.0007
Mysqli_queries1.296296.6215570.0227
Looping result0.00050.0354550.0000
Template Total1.305597.320.6528
Template load0.00210.158520.0011
Template processing1.303497.157920.6517
Template load and register function0.00020.012310.0002
states
state_id_array0.00130.096610.0013
state_identifier_array0.00140.107820.0007
Override
Cache load0.00170.1290200.0001
Sytem overhead
Fetch class attribute can translate value0.00040.032620.0002
Fetch class attribute name0.00100.074540.0002
XML
Image XML parsing0.00130.099620.0007
class_abstraction
Instantiating content class attribute0.00000.000740.0000
General
dbfile0.00230.1716150.0002
String conversion0.00000.000640.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
3content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
1content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
4content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
1content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
1content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 12
 Number of unique templates used: 7

Time used to render debug report: 0.0001 secs