Ez is looking for templates called .tpl

Author Message

Johan Grasmo

Wednesday 10 December 2003 3:48:57 am

Hi,

I'm creating my own register-page for a custom user. I've followed the guide "Tutorial: Using user/register", and after some quirks I got it to work. But the problem I'm experiencing is that it won't show the input-text box. It seems like it don't find the content/datatype/edit/-templates which attribute_edit_gui needs.
The error messages i get are:
Notice: Dec 10 2003 12:36:58

eZTemplate: Loading template "content/datatype/edit/.tpl" with resource "design"

Notice: Dec 10 2003 12:36:58

eZTemplate: Loading template "content/datatype/edit/.tpl" with resource "design"

Warning: eZTemplate:attribute_edit_gui Dec 10 2003 12:36:58

None of the templates design:content/datatype/edit/.tpl, design:content/datatype/edit/.tpl could be found

I haven't done anything extraordinary which should result in this error.
The form itself looks like this:
<form enctype="multipart/form-data" action={"/user/register/"|ezurl} method="post" name="Register">

<div class="maincontentheader">
<h1>{"Register user"|i18n("design/standard/user")}</h1>
</div>

{let content_attributes=fetch('content', 'class_attribute', hash(attribute_id, 163))}
{$content_attributes.temporary_object_attribute.contentclass_attribute.name} {attribute_edit_gui attribute=$content_attributes}

<div class="buttonblock">
<input type="submit" name="PublishButton" value="{'Register'|i18n('design/standard/user')}" />
<input type="submit" name="CancelButton" value="{'Discard'|i18n('design/standard/user')}" />
</div>
{/let}
</form>

Any help is appreciated :-)

Johan G.

Johan Grasmo

Wednesday 10 December 2003 11:38:11 am

Update on the situation.

Since I have three different user-classes, I've created three separate pages (with overrides), that displays the register-form. I don't know if this has anything to do with the missing templates, or why it looks for .tpl under the edit-folder. I tried with the class_attribute_edit_gui and it worked. So I suspect the fault lies elsewhere.

I am not using the /user/register-page at all, has this something to do with it ?

Cheers,

Johan

Johan Grasmo

Thursday 11 December 2003 11:05:42 am

Another update,

I thought that perhaps me mocking around with the override.ini.append-file made ez unstable, so I did another install with the corporate-design. I added the same lines of code into the file design/corporate/templates/pagelayout.tpl to check if the error would disappear....

It didn't.

So I suspect that you cannot use attribute_edit_gui freely, but you are only limited to use it within some "special" areas of ez... But this don't quite sound right.

Do anyone have any useful comments or insightful explanations why attribute_edit_gui returns:

None of the templates design:content/datatype/edit/.tpl, design:content/datatype/edit/.tpl could be found

??

Is this supposed to happen or is this a bug ?

Cheers,

Johan

Tore Skobba

Friday 12 December 2003 4:59:49 am

Hmm you are saying you are using three register templates as you have three different types of users. How do you then set which class is to be used for creation of each different user?

This is maybe a question for the EZ team, does EZ support more than one type of user register at the main site?

Cheers
Tore

Johan Grasmo

Tuesday 16 December 2003 4:27:26 am

Hi Tore,

Afaik, the user-class and the normal content-classes are almost the same. Creation of users are only a wrapper around creation of other objects, so it should be possible to put the register user on a "custom" page.

To explain it in more details:

Since I have three different user-classes, I need three separate registration pages. In these pages I fetch the content_attributes from the individual user-classes, and by using attribute_edit_gui, it should be able to display a nice input-form.

But the problem is that ez is looking for the templates to display the form, and it is looking for templates named .tpl.

So I have a problem since ez is looking for templates without a name, just the ending .tpl.

I'm really stretched there guys, so ANY tips/hints/ideas are most welcome.

Johan

Paul Forsyth

Tuesday 16 December 2003 7:17:38 am

I've noticed the .tpl problems too, but during class editing. For some reason eZ requires an template for datatype editing, even if it is a zero length file.

Look in the directory:

design/standard/templates/class/datatype/edit/

and you will see lots of zero length files!

When i create a new datatype that doesn't require a new class edit template i need to create a zero length file to stop the error from appearing.

Now, about your user registration. From my own user registration experience ( i wrote the tutorial you used ) you can only create one type of user with the standard user/register call, and if you have created a different user class you will have need to have specified this in the correct ini file, as discussed in the tutorial.

You mention you are not using the user/register page to display these field so can you give a step-by-step listing of what you are doing?

paul

Johan Grasmo

Tuesday 16 December 2003 9:56:58 am

Hi Paul and thanks for the reply,

I was writing a loooong reply (spent at least 30 minutes on it) but then I read your tutorial "Using user/register" again, and things became clearer. I cannot use attribute_edit_gui since I'm overriding an attributes display. I have to create the <input>-tags by myself.

I will try this approach, and I think with better success.

Thanks alot Paul (big manly hug your way ;) ); I'll keep you updated on how this works!

Johan

Paul Forsyth

Tuesday 16 December 2003 10:19:34 am

Good luck.

I thought i'd add a couple of things you may or may not be trying.

attribute_edit_gui simply uses the relevant template for including the input tags. when i have trouble i also stop using it and revert to plain html until i can find the problem ;)

but attribute_edit_gui is the best way to handle your various views for each of your user classes. so stick in a specific override and you should find attribute_edit_gui working. this you probably know.

to really make your different user classes work you may need to create a new user class with all of the attributes that you want to support. each user template will then show a portion of that class to the user. in this way you can support multiple user types through a single class.

When i was last creating a different user class i wondered if i could create several user classes, one for shopping, one for forums, one for emails etc etc but found i couldn't. Creating one big one and filling in just the bits you need for each area may be a compromise.

paul

Johan Grasmo

Wednesday 17 December 2003 12:36:34 am

Hi again,

I've discovered that I'm not 100% sure what I'm doing here - but I recon ez is giving a lot of people a headache.

Anyways,
I've got the template "design/fairtradenet/templates/full_view_client_register.tpl" which is going to display the registration-form for the "Client" user. What I've done is to fetch each class attribute (from the Client user-class), and display the attribute and the corresponding input-field.
Sample:
[snip]
<tr>
{let attribute=fetch('content', 'class_attribute', hash(attribute_id, 208))}
<td>{$attribute.name}</td> <td><input type="text" name="ContentObjectAttribute_id[]" size="20" value="" maxlength="{$attribute.data_int1}" /></td>
{/let}
</tr>
[/snip]

By doing this for every attribute, I've managed to display the form.

But my next question is where to post the form. I was hoping that I could use the form-bit from the "register.tpl"-template, but no such luck. Do I have to add manually the logic to validate and store the form ? I should think that this is something that ez can do.

Another question is how I'm doing this entire registration-bit. Is this the simplest (best?) way to do it, or is there another - easier - way ?

Johan

Johan Grasmo

Wednesday 17 December 2003 12:38:16 am

This is the link to the form:
http://fairtradenet2.ragnarok.no/index.php/content/view/full/141/

Johan

Paul Forsyth

Wednesday 17 December 2003 1:33:20 am

Looks good.

You should override the standard user/register.tpl template with your own. As you have several register templates you should perhaps put some template logic into user/register.tpl to show the relevant template. In this way you have control over the presentation while users can still register by going to user/register.

Johan Grasmo

Wednesday 17 December 2003 2:54:15 am

Hi again,

Oki, I've overridden user/register.tpl and the entry looks like:
[register_freelancer]
Source=user/register.tpl
MatchFile=register_freelancer.tpl
Subdir=templates

The funny thing is that it doesn't find the /user/register, but index.php/ftn_en/user/register works. Is this normal ?
When I access /user/register I get a kernel 3 error (Object is unavailable)

Anyways, the form action is /user/register and if I press submit I get a blank page. If I replace /user/register with /ftn_en/user/register, I get a kernel 20 error (module not found) since it tries to access index.php/ftn_en/ftn_en/user/register/.

Is this a result of I have a multilingual site ?

Johan

Paul Forsyth

Wednesday 17 December 2003 3:09:35 am

The multilingual part is causing some problems. I haven't much experience with multilingual sites. Next year i will... I think once you enable languages you need to have the language in the URI and cant go back.

But i tried:

http://fairtradenet2.ragnarok.no/index.php/ftn_en/user/register

and i notice from the page source the form command is:

<form enctype="multipart/form-data" action="/index.php/ftn_en/ftn_en/user/register/" method="post" name="Register">

which is why the post isn't working.

Take a look at your template code to see why this is occuring. You may need to play with a few settings here, but its fixable :)

btw, are you using an apache virtual host on your site? have a look through the forums to see how to remove the 'index.php' from your URI. Eg

http://ez.no/developer/ez_publish_3/forum/install_configuration/virtual_host_hmmm

paul

Johan Grasmo

Wednesday 17 December 2003 3:25:16 am

I've altered the action back to {"/user/register/"|ezurl}, and when I post the form I get a blank page. The source shows the form command: action="/index.php/ftn_en/user/register" which is correct. The error-log gives the following:
[ Dec 17 2003 12:19:55 ] [62.70.51.2] Timing Point: Module start 'user'
[ Dec 17 2003 12:19:55 ] [62.70.51.2] Undefined variable: 'UseSpecialCharacters' in group 'UserSettings'

But this shouldn't result in a blank page.
I'm not running virtualhost atm, since the entire site will be moved when I'm finished (at this rate sometime during 2005).

Ez should return something more than a white page ?

Johan

Paul Forsyth

Wednesday 17 December 2003 4:27:57 am

The blank white page looks to me to be php failing in some way. eZ should return with the form results but this isn't happening.

Can you check you logs in var/log, specificially your error logs because something odd has occured.

paul

Johan Grasmo

Wednesday 17 December 2003 4:49:42 am

Hmmm,

Got some errors in my error-log yes:

[ Dec 17 2003 13:42:40 ] [62.70.51.2] Timing Point: Module start 'user'
[ Dec 17 2003 13:42:40 ] [62.70.51.2] Undefined index: EditLanguage in /admin/johan/sites/ragnarok.no/fairtradenet2/htdocs/kernel/content/attribute_edit.php on line 60
[ Dec 17 2003 13:42:40 ] [62.70.51.2] Undefined post variable: ContentObjectAttribute_data_user_login_774
[ Dec 17 2003 13:42:40 ] [62.70.51.2] Undefined post variable: ContentObjectAttribute_data_user_email_774
[ Dec 17 2003 13:42:40 ] [62.70.51.2] Undefined post variable: ContentObjectAttribute_data_user_password_774
[ Dec 17 2003 13:42:40 ] [62.70.51.2] Undefined post variable: ContentObjectAttribute_data_user_password_confirm_774
[ Dec 17 2003 13:42:40 ] [62.70.51.2] Undefined variable: userID in /admin/johan/sites/ragnarok.no/fairtradenet2/htdocs/kernel/classes/datatypes/ezuser/ezuser.php on line 183
[ Dec 17 2003 13:42:40 ] [62.70.51.2] Missing main operation memento for key: fe021791c105f052c0ff87c82a8454fb
[ Dec 17 2003 13:42:40 ] [62.70.51.2] Undefined index: user_id in /admin/johan/sites/ragnarok.no/fairtradenet2/htdocs/kernel/classes/ezworkflowprocess.php on line 156
[ Dec 17 2003 13:42:40 ] [62.70.51.2] Undefined index: real_translation in /admin/johan/sites/ragnarok.no/fairtradenet2/htdocs/kernel/classes/ezcontentobjecttreenode.php on line 2331
[ Dec 17 2003 13:42:40 ] [62.70.51.2] Undefined index: real_translation in /admin/johan/sites/ragnarok.no/fairtradenet2/htdocs/kernel/classes/ezcontentobjecttreenode.php on line 2331
[ Dec 17 2003 13:42:42 ] [62.70.51.2] Undefined index: real_translation in /admin/johan/sites/ragnarok.no/fairtradenet2/htdocs/kernel/classes/ezcontentobjecttreenode.php on line 2331
[ Dec 17 2003 13:42:42 ] [62.70.51.2] Cannot modify header information - headers already sent in /admin/johan/sites/ragnarok.no/fairtradenet2/htdocs/lib/ezutils/classes/ezhttptool.php on line 355

I suspect the undefined variable userID is the cause of the blank page. What is this value ? Is this the UserClassID that is set in the site.ini.append.php ?

Johan

Johan Grasmo

Wednesday 17 December 2003 4:57:36 am

My register_freelancer.tpl that overrides user/register:

<form enctype="multipart/form-data" action={"/user/register/"|ezurl} method="post" name="Register">
<div class="maincontentheader">
<h1>{"Register user"|i18n("design/standard/user")}</h1>
</div>

{section show=$validation.processed}

{section name=UnvalidatedAttributes loop=$validation.attributes show=$validation.attributes}
<div class="warning">
<h2>{"Input did not validate"|i18n("design/standard/user")}</h2>
<ul>
<li>{$UnvalidatedAttributes:item.name}: {$UnvalidatedAttributes:item.description}</li>
</ul>
</div>
{section-else}
<div class="feedback">
<h2>{"Input was stored successfully"|i18n("design/standard/user")}</h2>
</div>
{/section}

{/section}

<table border="0">
<tr>
{let attribute=fetch('content', 'class_attribute', hash(attribute_id, 207))}
<td>{$attribute.name|i18n}</td> <td><input type="text" name="ContentObjectAttribute_id[]" size="20" value="" maxlength="{$attribute.data_int1}" /></td>
{/let}
</tr>
<tr>
{let attribute=fetch('content', 'class_attribute', hash(attribute_id, 208))}
<td>{$attribute.name}</td> <td><input type="text" name="ContentObjectAttribute_id[]" size="20" value="" maxlength="{$attribute.data_int1}" /></td>
{/let}
</tr>

<tr>
{let attribute=fetch('content', 'class_attribute', hash(attribute_id, 209))}
<td>{$attribute.name}</td> <td><input type="text" name="ContentObjectAttribute_id[]" size="20" value="" maxlength="{$attribute.data_int1}" /></td>
{/let}
</tr>
<tr>
{let attribute=fetch('content', 'class_attribute', hash(attribute_id, 210))}
<td>{$attribute.name}</td> <td><input type="text" name="ContentObjectAttribute_id[]" size="20" value="" maxlength="{$attribute.data_int1}" /></td>
{/let}
</tr>
<tr>
{let attribute=fetch('content', 'class_attribute', hash(attribute_id, 211))}
<td>{$attribute.name}</td> <td><input type="text" name="ContentObjectAttribute_id[]" size="20" value="" maxlength="{$attribute.data_int1}" /></td>
{/let}
</tr>
<tr>
{let attribute=fetch('content', 'class_attribute', hash(attribute_id, 212))}
<td>{$attribute.name}</td> <td><input type="text" name="ContentObjectAttribute_id[]" size="20" value="" maxlength="{$attribute.data_int1}" /></td>
{/let}
</tr>
<tr>
{let attribute=fetch('content', 'class_attribute', hash(attribute_id, 213))}
{*$attribute.content.options|attribute(show)*}
<td>{$attribute.name}</td>
<td>
<select name="ContentObjectAttribute_id[]">
{section name=country loop=$attribute.content.options}
<option value="{$country:item.id}">{$country:item.name}</option>
{/section}
</select>
</td>
{/let}
</tr>
<tr>
{let attribute=fetch('content', 'class_attribute', hash(attribute_id, 214))}
<td>{$attribute.name}</td> <td><input type="text" name="ContentObjectAttribute_id[]" size="20" value="" maxlength="{$attribute.data_int1}" /></td>
{/let}
</tr>
<tr>
{let attribute=fetch('content', 'class_attribute', hash(attribute_id, 215))}
<td>{$attribute.name}</td> <td><input type="text" name="ContentObjectAttribute_id[]" size="20" value="" maxlength="{$attribute.data_int1}" /></td>
{/let}
</tr>
<tr>
{let attribute=fetch('content', 'class_attribute', hash(attribute_id, 216))}
<td>{$attribute.name}</td> <td><input type="text" name="ContentObjectAttribute_id[]" size="20" value="" maxlength="{$attribute.data_int1}" /></td>
{/let}
</tr>
<tr>
{let attribute=fetch('content', 'class_attribute', hash(attribute_id, 217))}
<td>{$attribute.name}</td> <td><input type="text" name="ContentObjectAttribute_id[]" size="20" value="" maxlength="{$attribute.data_int1}" /></td>
{/let}
</tr>
<tr>
{let attribute=fetch('content', 'class_attribute', hash(attribute_id, 218))}
<td>{$attribute.name}</td> <td><input type="text" name="ContentObjectAttribute_id[]" size="20" value="" maxlength="{$attribute.data_int1}" /></td>
{/let}
</tr>
<tr>
{let attribute=fetch('content', 'class_attribute', hash(attribute_id, 219))}
<td>{$attribute.name}</td> <td><input type="text" name="ContentObjectAttribute_id[]" size="20" value="" maxlength="{$attribute.data_int1}" /></td>
{/let}
</tr>
<tr>
<td>User Login</td> <td><input type="text" name="ContentObjectAttribute_data_user_login_{$attribute.id}" size="20" value="" maxlength="20" /></td>
</tr>
<tr>
<td>Email Address</td> <td><input type="text" name="ContentObjectAttribute_data_user_email_{$attribute.id}" size="20" value="" maxlength="100" /></td>
</tr>
<tr>
<td>Password</td> <td><input type="text" name="ContentObjectAttribute_data_user_password_{$attribute.id}" size="20" value="" maxlength="20" /></td>
</tr>
<tr>
<td>Confirm Password</td> <td><input type="text" name="ContentObjectAttribute_data_user_password_confirm_{$attribute.id}" size="20" value="" maxlength="20" /></td>
</tr>

</table>
<div class="buttonblock">
<input type="submit" name="PublishButton" value="{'Register'|i18n('design/standard/user')}" />
<input type="submit" name="CancelButton" value="{'Discard'|i18n('design/standard/user')}" />
</div>

</form>

Paul Forsyth

Wednesday 17 December 2003 5:26:19 am

The anonymous user should be apperaing here. Having looked through your source again i see that a few important things are missing.

It seems you are using:

name="ContentObjectAttribute_id[]"

everywhere but this is wrong.

Look over the original 'user/register.tpl' to see what it does.

For each attribute you need to call {attribute_edit_gui} to get it to display the input tag properly for that attribute.

At the end of the template, but still within the form you need to declare the content object attribute id for each attribute, as so:

<input type="hidden" name="ContentObjectAttribute_id[]" value="{$content_attributes[0].id}" />

which is where i think you are going wrong.

So, use attribute_edit_gui for each attribute and finish the form of as i suggest in the tutorial under the heading: "Input tags for register.tpl"

But, if you already have this and are including your template from within your new register.tpl you may need to pass in the array "$content_attributes" to your new templates. Something like:

{include uri="my.tpl" content_attributes=$content_attributes}

Also notice in your source that your user settings input tags are not declared properly. You have the names:

name="ContentObjectAttribute_data_user_password_"

declared but there should be an attribute value at the end but there isn't anything. Hopefully by passing in the array will fix this...

Im sorry this is quite technical :( If you are stuck read over the original register.tpl and try to see what it does, then read the tutorial again.

paul

Johan Grasmo

Wednesday 17 December 2003 6:28:06 am

This kinda brings me back to my initial problem :-(

If I write:
{section name=ContentObjectAttribute loop=$content_attributes sequence=array(bglight,bgdark)}
<tr>
<input type="hidden" name="ContentObjectAttribute_id[]" value="{$ContentObjectAttribute:item.id}" />

<td>{$ContentObjectAttribute:item.contentclass_attribute.name}</td> <td>{attribute_edit_gui attribute=$ContentObjectAttribute:item}</td>
</tr>

{/section}

I get the fields first name, last name, login, email etc.

But I need the rest of the attributes that my custom-user contains. So if I try this:
{let my_content_attributes=fetch('content', 'class_attribute_list', hash(class_id,20))}
{section name=ContentObjectAttribute loop=$my_content_attributes sequence=array(bglight,bgdark)}
<tr>
<input type="hidden" name="ContentObjectAttribute_id[]" value="{$ContentObjectAttribute:item.id}" />

<td>{$ContentObjectAttribute:item.contentclass_attribute.name}</td> <td>{attribute_edit_gui attribute=$ContentObjectAttribute:item}</td>
</tr>

{/section}
{/let}

I don't get anything besides error messages. In the code above I fetch a list of all the attributes to my custom-user class, and I want to display them as input fields..

Did this make any sense ?

Johan

Paul Forsyth

Thursday 18 December 2003 12:54:43 am

Since you have a new user you need to have a template for it. Override the template found at:

design/standard/content/datatype/edit/ezuser.tpl

with the input tags for your new user and you should find the User Account datatype being shown correctly.

paul

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