Forums / General / Fetching class name and class identifier

"Please Note:
  • At the specific request of Ibexa we are changing this projects name to "Exponential" or "Exponential (CMS)" effective as of August, 11th 2025.
  • This project is not associated with the original eZ Publish software or its original developer, eZ Systems or Ibexa".

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}