New objects

New objects

Saturday 27 September 2003 1:24:12 pm - 7 replies

Author Message

Paolo Tramontani

Monday 29 September 2003 2:22:26 am

I think the question is: How can I create new classes? I think you want create a different kind of object...

http://ez.no/developer/ez_publish_3/documentation/customization/content_structure/content_classes

You can open the admin site, choose "setup" in the tabs and "classes" on the left contextual menu.
Choose now the group "content" (classes are grouped in groups): you will find the list of classes. Then press "New class". You have to insert all infos and attributes choising the datatyape of each attribute.

Then you can insert new object from this class with the tab content. If you want customize the appearance you have to override the "line" and "full" template for your site.

Take a look at
http://ez.no/developer/ez_publish_3/documentation/customization/custom_design/override_templates

Hope this help you

Paolo

Dan Mcd

Monday 29 September 2003 8:45:42 am

I've created new classes, but they will not show up on the page.

Paolo Tramontani

Monday 29 September 2003 10:02:19 am

Perhaps you have problem with permission: the anonymous user have the anonymous role that can access only an explicit list of classes. When you create a new class you have to add it in the read permission of the anonymous role:
- Open the admin, select the "user" tab
- In the left menu choose "roles"
- Click on the edit icon of the anonymous entry (the icon with the pencil in the edit coloumn)
You should find the list of the permissions (edit policiy):
user login * *
content read The list of classes
- choose the edit icon on the content/read entry
- In the multiselect "classes" add your class (ctrl-click)
- Click update
- Back to the role edit for anonymous: click Store

Now you should view your object in the user site access

Hope this is the solution,
Paolo

Dan Mcd

Monday 29 September 2003 12:09:07 pm

That did it. Thanks.

But I've run into a new problem.

I have created the new class (news), it recieved an id of 23. I also created a template with a Match conditions of 23. But when I create new content with news, it shows me the name of the new content as a link, and when I follow it, it shows me the info of the content if a default template view.

Paolo Tramontani

Tuesday 30 September 2003 1:39:46 am

Ok, overriding template made me in great confusion too, but it is only a question of find the right procedure. It is only a question of put all puzzle pieces in the right place.

You have to create the template and place it in the mysite/override/template folder (where mysite is the name of your site);

Then you have to go in the settings/siteaccess/mysite folder and edit the file override.ini.append.
Insert this in the file (let's suppose that your file templates are mynestemplate.tpl for full view and line_mynewstemplate.tpl for line view):

[mynewstemplate]
Source=node/view/full.tpl
MatchFile=mynewstemplate.tpl
Subdir=templates
Match[class]=23

[line_mynewstemplate]
Source=node/view/line.tpl
MatchFile=line_mynewstemplate.tpl
Subdir=templates
Match[class]=23

This is all you need for your template... If you have already done all this let me know. Perhaps you have some other problem...

Dan Mcd

Tuesday 30 September 2003 9:24:57 am

Ya, I've already done that. It still doesn't help.

I did it! It was my cache. I had to manually clear it. Thx for your help. I really appreciate it.

I've got one more question though. One my site I have a coloum that displays new articles (it displays them from all folders). When you click on (in the coloum) them it brings you to the full view of the article. This is fine for some of my classes, but my new class (id:23, wich shows in the coloum) doesn't have a full view, I would like for it to (when clicked) bring you to the folder displaying the class; but only for the class with an id of 23. Do you know the code for this?

Or will I have to set it to go to the folder regardless?

This is the code as of now: (ignore the html)

<td width="204" valign="top">

<table class="menu" width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<th class="menuhead">
News
</th>
</tr>

{let news_list=fetch( content, tree, hash(
parent_node_id, 2,
limit, 3,
sort_by, array( published, false() ),
class_filter_type, include,
class_filter_array, array( 2, 23, ) ) )}

{section name=News loop=$news_list}
<tr>
<td class="menuitem">
<div class="menuname">
<a href={concat('content/view/full/',$News:item.node_id)|ezurl}>{$News:item.name|wash}</a>
</div>
<div class="menudate">
({$News:item.object.published|l10n( shortdate )})
</div>
</td>
</tr>
{delimiter}
{/delimiter}
{/section}

{/let}
</table>

Paolo Tramontani

Wednesday 01 October 2003 1:18:19 am

This means that you have built a specific folder which contain (and display as list) all objects with class=23?
If so you can change the url of the <a href=> for each object with class = 23 bringing statically to the same folder for each.

Let's suppose that the folder for the class 23 have the node_id=99.

Than the code should be:

{section name=News loop=$news_list}
<tr>
<td class="menuitem">
<div class="menuname">

{* distinguish your node looking at the class_id *}
{section show=$News:item.class_id|eq(23) }
<a href={'content/view/full/99'|ezurl}>
{section-else}
<a href={concat('content/view/full/',$News:item.node_id)|ezurl}>
{/section}

{$News:item.name|wash}</a>
</div>
<div class="menudate">
({$News:item.object.published|l10n( shortdate )})
</div>
</td>
</tr>
{delimiter}
{/delimiter}
{/section}

NNNB: I am not sure that you can retrieve the class_id of your item with item.class_id. It is only a try. Perhaps it should be item.node.class_id or item.node.content.class_id or some other sintax... I never use it and I can't find it in the docs. If these tries don't work you can try to search for this property in the docs by yourself...

I Hope I understood your needs
Paolo

You must be logged in to post messages in this topic!

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