[SOLVED] Edit profile page missing page elements

Author Message

Nathan Kelly

Sunday 06 November 2005 7:37:00 pm

Hi all, I've set up some user accounts and have made a "my profile" link the same as the ez.no site, this links to user/edit/[id] and this page works fine. However when I go to the edit profile page content/edit/[id] my page layout falls apart.

Basically anything that is fetched on the pagelayout.tpl disappears leaving only the static content and the content/edit form.

I noticed in the content/edit url there is a version number added /content/edit/[id]/2. Could this have something to do with it?

Also the email sent to the user contains a url to content/view/full/[id]. This url displays a message saying "Unable to register new user" with a back button.

My registered user roles are:

user       login        SiteAccess( site )
content    read         Section( Restricted )
content    edit         Subtree( Users ) , Class( User ) , Section( Users ) , Owner( Self )
content    read         Subtree( Users ) , Class( User ) , Section( Users ) , Owner( Self )
user       password     No limitations
user 	   preferences  No limitations
user 	   selfedit     No limitations

I have assigned my anonymous roles to the restricted roles to allow logged in users to view the un restricted areas as well.

What could I be missing? Could anybody walk me through the possibilities please?

Cheers!

Pardon me while I burst into flames...

Nathan Kelly

Sunday 06 November 2005 9:08:11 pm

A few other things I have noticed while browsing around pages that are not a part of my content structure (like search pages, user profile pages etc) is that I am getting these errors as follows:

Error: eZTemplate  	Nov 07 2005 16:00:14

No such attribute for array(7): node_id
Choose one of following: content, path, is_default_navigation_part,
                         navigation_part, ui_context, ui_component,
                         uri

Warning: PHP  	Nov 07 2005 16:00:14

Undefined offset:  4 in /home/cctscom/public_html/kernel/common/eztreemenuoperator.php on line 110

Error: eZMySQLDB 	Nov 07 2005 16:00:14

Query error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ') AND
                      ezcontentobject_tree.contentobject_id=ezcontentobjec' at line 10. Query: SELECT ezcontentobject.*,
                       ezcontentobject_tree.*,
                       ezcontentclass.name as class_name,
                       ezcontentclass.identifier as class_identifier
                       , ezcontentobject_name.name as name,  ezcontentobject_name.real_translation 
                FROM ezcontentobject_tree,
                     ezcontentobject,
                     ezcontentclass
                     , ezcontentobject_name 
                WHERE node_id IN (  ) AND
                      ezcontentobject_tree.contentobject_id=ezcontentobject.id AND
                      ezcontentclass.version=0  AND
                      ezcontentclass.id = ezcontentobject.contentclass_id
                       and  ezcontentobject_tree.contentobject_id = ezcontentobject_name.contentobject_id and
                                  ezcontentobject_tree.contentobject_version = ezcontentobject_name.content_version and
                                  ezcontentobject_name.content_translation = 'eng-AU'

Notice: eZMySQLDB::query(0.000 ms) query number per page:1 	Nov 07 2005 16:00:14

SELECT ezcontentobject.*,
                       ezcontentobject_tree.*,
                       ezcontentclass.name as class_name,
                       ezcontentclass.identifier as class_identifier
                       , ezcontentobject_name.name as name,  ezcontentobject_name.real_translation 
                FROM ezcontentobject_tree,
                     ezcontentobject,
                     ezcontentclass
                     , ezcontentobject_name 
                WHERE node_id IN (  ) AND
                      ezcontentobject_tree.contentobject_id=ezcontentobject.id AND
                      ezcontentclass.version=0  AND
                      ezcontentclass.id = ezcontentobject.contentclass_id
                       and  ezcontentobject_tree.contentobject_id = ezcontentobject_name.contentobject_id and
                                  ezcontentobject_tree.contentobject_version = ezcontentobject_name.content_version and
                                  ezcontentobject_name.content_translation = 'eng-AU' 

Warning: PHP 	Nov 07 2005 16:00:14

Undefined offset:  1 in /home/cctscom/public_html/kernel/common/eztreemenuoperator.php on line 115

I think these errors are related to my treemenus in my pagelayout.tpl.

Does anyone know what would be causing these errors, as I said they only appear when I'm not on a node within my content structure, or the media library and user accounts nodes?

Do I need to change my pagelayout.tpl for the search and user profile pages?

I really need some advice on this if you can help.

Thanks in advance...

Pardon me while I burst into flames...

Nathan Kelly

Tuesday 08 November 2005 6:36:23 pm

Hi, I'm still banging my head against a brick wall here.

Does anybody know why treemenus and fetches stop working when viewing content/edit? My site is almost ready to go live with the exeption of this problem.

Also can anybody please try to explain the errors I'm recieving (above)? What would cause errors like these?

Maybe someone from the eZcrew knows? Please please help, I need to fix this problem but I dont know how.

More details (incase they help):
eZp v 3.6.0
Linux Box Dedicated Host
Apache v 1.3.33
PHP v 4.3.11
MySQL v 4.1.13 standard

If you need to see any of my templates or ini files please let me know and I'll post them.

Cheers!

Pardon me while I burst into flames...

Bruce Morrison

Tuesday 08 November 2005 6:42:19 pm

Hi Nathan

What does your debug output say?

I suspect that one of the variables that you are passing to tremenu is not present in the edit view. This is causing the SQL used to retrieve the nodes to fail - "WHERE node_id IN ( ) AND"

Cheers
Bruce

My Blog: http://www.stuffandcontent.com/
Follow me on twitter: http://twitter.com/brucemorrison
Consolidated eZ Publish Feed : http://friendfeed.com/rooms/ez-publish

Nathan Kelly

Tuesday 08 November 2005 6:56:10 pm

Hi Bruce, on my user profile page "user/edit/[id]" my debug output is as follows:

Timing:  	Nov 09 2005 13:46:02

Script start

Notice: eZMySQLDB::query(0.000 ms) query number per page:0 	Nov 09 2005 13:46:02

SET NAMES 'utf8'

Timing: 	Nov 09 2005 13:46:02

Module start 'user'

Timing: 	Nov 09 2005 13:46:02

Module end 'user'

Error: eZTemplate 	Nov 09 2005 13:46:02

No such attribute for array(6): node_id
Choose one of following: content, path, is_default_navigation_part,
                         ui_context, ui_component, uri

Error: eZMySQLDB 	Nov 09 2005 13:46:02

Query error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ') AND
                      ezcontentobject_tree.contentobject_id=ezcontentobjec' at line 10. Query: SELECT ezcontentobject.*,
                       ezcontentobject_tree.*,
                       ezcontentclass.name as class_name,
                       ezcontentclass.identifier as class_identifier
                       , ezcontentobject_name.name as name,  ezcontentobject_name.real_translation 
                FROM ezcontentobject_tree,
                     ezcontentobject,
                     ezcontentclass
                     , ezcontentobject_name 
                WHERE node_id IN (  ) AND
                      ezcontentobject_tree.contentobject_id=ezcontentobject.id AND
                      ezcontentclass.version=0  AND
                      ezcontentclass.id = ezcontentobject.contentclass_id
                       and  ezcontentobject_tree.contentobject_id = ezcontentobject_name.contentobject_id and
                                  ezcontentobject_tree.contentobject_version = ezcontentobject_name.content_version and
                                  ezcontentobject_name.content_translation = 'eng-AU'

Notice: eZMySQLDB::query(0.000 ms) query number per page:1 	Nov 09 2005 13:46:02

SELECT ezcontentobject.*,
                       ezcontentobject_tree.*,
                       ezcontentclass.name as class_name,
                       ezcontentclass.identifier as class_identifier
                       , ezcontentobject_name.name as name,  ezcontentobject_name.real_translation 
                FROM ezcontentobject_tree,
                     ezcontentobject,
                     ezcontentclass
                     , ezcontentobject_name 
                WHERE node_id IN (  ) AND
                      ezcontentobject_tree.contentobject_id=ezcontentobject.id AND
                      ezcontentclass.version=0  AND
                      ezcontentclass.id = ezcontentobject.contentclass_id
                       and  ezcontentobject_tree.contentobject_id = ezcontentobject_name.contentobject_id and
                                  ezcontentobject_tree.contentobject_version = ezcontentobject_name.content_version and
                                  ezcontentobject_name.content_translation = 'eng-AU' 

Timing: 	Nov 09 2005 13:46:02

End

Whereas on my change details page "content/edit/[id]/[version]" my output shows:

Timing:  	Nov 09 2005 13:47:46

Script start

Notice: eZMySQLDB::query(0.000 ms) query number per page:0 	Nov 09 2005 13:47:46

SET NAMES 'utf8'

Timing: 	Nov 09 2005 13:47:46

Module start 'content'

Timing: 	Nov 09 2005 13:47:46

Module end 'content'

Error: eZTemplate 	Nov 09 2005 13:47:46

No such attribute for array(7): node_id
Choose one of following: content, path, navigation_part, is_default_navigation_part,
                         ui_context, ui_component, uri

Timing: 	Nov 09 2005 13:47:46

End

Also I have two treemenus on the pagelayout.tpl, one for my main navigation which should always be present and one for my sub navigation which should only appear in certain sections. The menus are as follows:

Main navigation:

		<div id="main-nav">

			<div class="wrapper">
		
				<p class="skip-nav"><a href="#content" title="Main navigation - skip to content.">{"Main navigation - skip to content"|i18n( "design/ccts" )}</a></p>		

				<ul>
{def $main_menu=treemenu($module_result.path, 
			 $module_result.node_id,
			 array('folder'), 0, 1 ) }

{foreach $main_menu as $m_menu}

					<li><a{$m_menu.is_selected|choose('',' class="current"')} href={$m_menu.url_alias|ezurl}>{$m_menu.text}</a></li>
{/foreach}
{undef}
				
				</ul>				
				
			</div>
			
			<div class="nav-end"></div>
				
			<hr />
			
		</div>

Sub Navigation:

			<div id="sub-nav">
			
{def $sub_nav_needed=array(1,8,9,6,10,11)}
{if $sub_nav_needed|contains($module_result.section_id) show=$sub_nav_needed}
			
				<p class="skip-nav"><a href="#content" title="Sub navigation - skip to content.">{"Sub navigation - skip to content"|i18n( "design/ccts" )}</a></p>
				
				<ul>		
{def $sub_menu=treemenu($module_result.path, 
			$module_result.node_id,
                                     array('standard_page','folder','contact_form','sub_page'), 1, 2)}

{def $last=0} 
{foreach $sub_menu as $s_menu}
{if and($last|ne(0), $last.level|gt($s_menu.level))}

					</ul>
					</li>
{/if}

					<li>
{if and($last|ne(0), $last.level|lt($s_menu.level))}

					<ul>
					<li>{/if}<a{$s_menu.is_selected|choose('',' class="current"',' class="current-parent"')} href={$s_menu.url_alias|ezurl}>{$s_menu.text}</a></li>
{set last=$s_menu}
{/foreach}

				</ul>

{else}
{* Sub Nav Not Needed *}
{/if}
{undef}

{include uri="design:service_menu.tpl"}
				
				<hr />

			</div>

When I view my edit profile page "content/edit/[id]/[version]" my tree menus and any other fetched data (within pagelayout.tpl) is lost, so my whole site breaks down exept for the edit form.

I hope you can help, I know its hard when you cant see it.

Cheers!

Pardon me while I burst into flames...

Bruce Morrison

Tuesday 08 November 2005 7:21:06 pm

Hi Nathan

It's as I suspected the variable node_id is not availiable when editing.

Error: eZTemplate 	Nov 09 2005 13:46:02

No such attribute for array(6): node_id
Choose one of following: content, path, is_default_navigation_part,
                         ui_context, ui_component, uri

So your'll have to either not display the menu (you don't want people leaving in the middle of editing do you? ;) or find another source for the node_id (I'm not sure there will be one :(.

http://ez.no/doc/ez_publish/technical_manual/3_6/templates/the_pagelayout/variables_in_pagelayout
May help

Cheers
Bruce

My Blog: http://www.stuffandcontent.com/
Follow me on twitter: http://twitter.com/brucemorrison
Consolidated eZ Publish Feed : http://friendfeed.com/rooms/ez-publish

Nathan Kelly

Tuesday 08 November 2005 8:13:40 pm

So are you saying that the treemenus in my pagelayout.tpl are incorrect? I've never had a problem with them until now.

The main nav is present when viewing "content/advancedsearch", "content/search", "user/edit" and every "content/view" page, the only page that loses the navigation is "content/edit".

What I don't understand is why "content/edit" handles the pagelayout.tpl differently? Is there an /ini setting I could be missing perhaps?

I know in reality a user may not need to use the main navigation while editing but the problem is that the main nav makes up a significant part of the header layout of the page, when it vanishes the site looks completely broken, so it needs to be there regardless.

How do eZ systems do it? Their pagelayout stays intact when viewing "content/edit" and I assume they use the treemenu operator for the navigation.

I'll play with the treemenus and see what I can come up with but in the mean time any other input is welcome (needed).

Thanks for your input so far Bruce.

Pardon me while I burst into flames...

Bruce Morrison

Tuesday 08 November 2005 9:01:41 pm

Hi Nathan

For one reason or the other it appears that $module_result.node_id is not set when editing content.

I must admit that I don't use the treemenu function so I do not have much experience with it. I tend to use fetches to do Nav stuff.

You can replace your main nav with something like

<ul>
{def 
  $home=fetch(content, node, hash(node_id,2))
  $main_menu=fetch(content, list, 
    hash(parent_node_id,2,
         sort_by,$home.sort_array,
         class_filter_type,include,
         class_filter_array,array('folder')
        )
  )
 }
{foreach $main_menu as $m_menu}
  <li><a{if eq($module_result.path[$home.depth].node_id,$m_menu.node_id)} class="current{/if} href={$m_menu.url_alias|ezurl}>{$m_menu.text}</a></li>
{/foreach}
{undef}
</ul>				

HTH

Bruce

My Blog: http://www.stuffandcontent.com/
Follow me on twitter: http://twitter.com/brucemorrison
Consolidated eZ Publish Feed : http://friendfeed.com/rooms/ez-publish

Nathan Kelly

Tuesday 08 November 2005 9:37:38 pm

Hi Bruce, well the good news is using your fetch function for the main menu removes the errors on all of the pages where there were errors.

The bad news is I can't seem to get it to show the menu?

There was one little error in the code, you missed the closing " at class="current but I fixed this and checked the rest of the fetch, it looks ok to me, but still no joy.

The variable you have in the first fetch ($topnode_id) should this remain the same or do I need to specify something different here?

I'll keep hacking at it, I think if I can get this working I'll stop using tremenus from now on!

Cheers!

Pardon me while I burst into flames...

Nathan Kelly

Tuesday 08 November 2005 10:14:21 pm

Bruce, you are a legend, I got it working, silly me forgot that {$m_menu.text} won't output anything in the fetch but {$m_menu.name} will, I'll remember that in future...

Cheers Bruce all is working as expectedt now thanks to you.

Pardon me while I burst into flames...

Bruce Morrison

Tuesday 08 November 2005 10:25:12 pm

Hey Nathan

Glad you figured it out. Should have put a disclaimer on the code I posted - I didn't test it.

Cheers
Bruce

My Blog: http://www.stuffandcontent.com/
Follow me on twitter: http://twitter.com/brucemorrison
Consolidated eZ Publish Feed : http://friendfeed.com/rooms/ez-publish

Nathan Kelly

Tuesday 08 November 2005 11:42:17 pm

Haha, I should have looked at the source sooner, no disclamer needed.

Thanks again, I won't be using treemenu from now on.

Cheers!

Pardon me while I burst into flames...

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