Conditional output

Author Message

Talk Apache

Saturday 17 July 2004 10:28:49 pm

I wish to display text on my article based on some condition like weather the user is logged in or not logged in. If the user is not logged in, i wish to show some text like "Please register to get access to links below:" but if the user is already registered user and logged in I don't wish to show this text. I can do it via template overrides. But then i have to write all text of my document in a template. Is that any way to do this if i can do this by entering some tags in an article?

Thanks

Talk Apache

Alex Jones

Tuesday 20 July 2004 8:42:32 am

Well, you can't just add a tag to the text of an article, but you could modify the article class (or any other class for that matter) to include a check box that would toggle the login requirement. You could then create the override template to detect the state of the check box. If the box is checked, the template would then check to see if the user is logged in. IF they are, the links would be shown, if not, your message would be shown.

Does this help?

Alex

Alex
[ bald_technologist on the IRC channel (irc.freenode.net): #eZpublish ]

<i>When in doubt, clear the cache.</i>

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 14:00:59
Script start
Timing: Jan 19 2025 14:00:59
Module start 'layout'
Timing: Jan 19 2025 14:00:59
Module start 'content'
Timing: Jan 19 2025 14:01:00
Module end 'content'
Timing: Jan 19 2025 14:01:00
Script end

Main resources:

Total runtime0.6913 sec
Peak memory usage4,096.0000 KB
Database Queries54

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0049 589.0391152.6094
Module start 'layout' 0.00490.0027 741.648439.4297
Module start 'content' 0.00760.6822 781.0781518.0078
Module end 'content' 0.68980.0015 1,299.08598.1875
Script end 0.6913  1,307.2734 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00290.4241160.0002
Check MTime0.00120.1796160.0001
Mysql Total
Database connection0.00080.115710.0008
Mysqli_queries0.647893.7079540.0120
Looping result0.00050.0743520.0000
Template Total0.659895.420.3299
Template load0.00190.280820.0010
Template processing0.657995.162520.3289
Template load and register function0.00030.036510.0003
states
state_id_array0.00110.154510.0011
state_identifier_array0.00090.128920.0004
Override
Cache load0.00150.2169110.0001
Sytem overhead
Fetch class attribute can translate value0.00070.099920.0003
Fetch class attribute name0.00120.173430.0004
XML
Image XML parsing0.00060.084920.0003
class_abstraction
Instantiating content class attribute0.00000.001330.0000
General
dbfile0.00090.1272160.0001
String conversion0.00000.000940.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
2content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
2content/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
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 7
 Number of unique templates used: 5

Time used to render debug report: 0.0001 secs