Fetching class name and class identifier

Author Message

John Smith

Thursday 15 December 2005 8:36:59 am

hi paul

last thing mate.

In the \design\news\templates\edit\forum_reply.tpl

the code below

<h1>{"Edit %1 - %2"|i18n("design/base",,array($class.name|wash,$object.name|wash))}</h1>

is used for both New and Edit forum reply.

Here i want to use if statement to use heading "Edit" for editing forum reply and heading "New" for new forum reply.

I wonder on which condition i use the if statement.

cheers.

Paul Forsyth

Thursday 15 December 2005 9:01:25 am

I guess you could look at the object version. Any new object will have version 1. Any edit will be greater than 1.

Paul

John Smith

Thursday 15 December 2005 10:07:36 am

Paul,

I checked the same stuff. Not working paul.

If you create a new forum reply the version is one. fine. if you again go the forum reply you just created and try to edit the version will still remain 1 untill you edit it and send it for publiishing.

Am i right?

Paul Forsyth

Thursday 15 December 2005 10:18:36 am

Not quite.

It depends on how you are accessing the edit.

If you create a new object its an object id, say 99. This will have 1 version.

If you edit it, say by accessing /content/edit/99 a new draft will be created, which is version 2, and so on.

Play around with the object values to detect this correctly.

Paul

John Smith

Thursday 15 December 2005 10:39:21 am

Paul

thanks mate.

sorted.

Cheers.

Jeroen Sangers

Wednesday 12 July 2006 4:05:39 am

I am also trying to get rid of the obligatory subject field in forum replies. I tried to follow the steps described here, but cannot get it to work. Can somebody post a complete and working example of edit_attribute.tpl?

Jeroen Sangers

Monday 09 October 2006 9:26:57 am

John or Paul, can you please post a complete and working example of edit_attribute.tpl????

Jeroen Sangers

Wednesday 11 October 2006 9:49:13 am

After trying out several solutions, I finally managed to get the subject filled in automatically. Just in case anybody is looking for the same thing, here is the final edit_attribute.tpl I used:

{section name=ContentObjectAttribute loop=$content_attributes sequence=array(bglight,bgdark)}
<div class="block">

{* only show edit GUI if we can edit *}
{section show=and(eq($ContentObjectAttribute:item.contentclass_attribute.can_translate,0),
                  ne($object.initial_language_code,$ContentObjectAttribute:item.language_code) ) }
    <label>{$ContentObjectAttribute:item.contentclass_attribute.name|wash}</label><div class="labelbreak"></div>
    <input type="hidden" name="ContentObjectAttribute_id[]" value="{$ContentObjectAttribute:item.id}" />
    {attribute_view_gui attribute_base=$attribute_base attribute=$ContentObjectAttribute:item}
    </div>
{section-else}
    <label{section show=$ContentObjectAttribute:item.has_validation_error} class="validation-error"{/section}>{$ContentObjectAttribute:item.contentclass_attribute.name|wash}</label><div class="labelbreak"></div>
    <input type="hidden" name="ContentObjectAttribute_id[]" value="{$ContentObjectAttribute:item.id}" />
    {if eq($ContentObjectAttribute:item.contentclass_attribute.name|wash, "Subject")}
        {def $parent=fetch( content, node, hash( node_id, $object.current.main_parent_node_id ) )}
            <input type="hidden" name="ContentObjectAttribute_ezstring_data_text_{$ContentObjectAttribute:item.id}" value="Re: {$parent.name|wash()}" />
            Re: {$parent.name|wash()}
        {/undef}
    {else}
        {attribute_edit_gui attribute_base=$attribute_base attribute=$ContentObjectAttribute:item}
    {/if}

    </div>

{/section}

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 04:22:06
Script start
Timing: Jan 19 2025 04:22:06
Module start 'layout'
Timing: Jan 19 2025 04:22:06
Module start 'content'
Timing: Jan 19 2025 04:22:08
Module end 'content'
Timing: Jan 19 2025 04:22:08
Script end

Main resources:

Total runtime1.4142 sec
Peak memory usage4,096.0000 KB
Database Queries73

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0055 589.7109152.6406
Module start 'layout' 0.00550.0034 742.351639.9063
Module start 'content' 0.00901.4031 782.2578582.8203
Module end 'content' 1.41200.0021 1,365.078118.2734
Script end 1.4141  1,383.3516 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00420.2942160.0003
Check MTime0.00200.1392160.0001
Mysql Total
Database connection0.00100.072710.0010
Mysqli_queries1.346795.2322730.0184
Looping result0.00080.0585710.0000
Template Total1.370396.920.6852
Template load0.00220.154320.0011
Template processing1.368196.744820.6841
Template load and register function0.00020.013710.0002
states
state_id_array0.00140.101210.0014
state_identifier_array0.00270.191820.0014
Override
Cache load0.00200.1395420.0000
Sytem overhead
Fetch class attribute can translate value0.00100.071830.0003
Fetch class attribute name0.00050.037390.0001
XML
Image XML parsing0.00090.061830.0003
class_abstraction
Instantiating content class attribute0.00000.0013110.0000
General
dbfile0.00180.1288160.0001
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
8content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
9content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
2content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
3content/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: 24
 Number of unique templates used: 6

Time used to render debug report: 0.0001 secs