[SOLVED]admin: Call member function GetURL() on a non-object
Posted: Sat Aug 04, 2012 9:02 am
My problem is solved but I am posting this to maybe help others.
After I upgraded my 1.10.3 site to version 1.11 the public site worked perfectly.
However, whenever I tried to open a page for editing in the admin interface, or tried to save a template I got a 404-page and error in the logfile:
The apache errorlog showed a warning just before that with:
This led me to the solution. My template had a line:
which in the default templates is:
It appears you need to test for the existence of content_obj.
As I could not edit templates in the admin interface anymore I had to use phpmyadmin to change the template directly in the table cms_templates. After that the problem was gone and I could edit pages again.
I do not remember when I added the canonical part to my template and why I only added the content_obj line but I am leaving this as a warning for other people.
This does leave me with one minor question: is it logical that a template works fine in the normal published site but will throw errors in the admin interface (where a preview is generated I suppose) ?
After I upgraded my 1.10.3 site to version 1.11 the public site worked perfectly.
However, whenever I tried to open a page for editing in the admin interface, or tried to save a template I got a 404-page and error in the logfile:
Code: Select all
Call to a member function GetURL() on a non-object in /var/www/XXXXX/tmp/templates_c/c1344001880^55f7216a49f40af311680e5c40b180e7c548bfdb.template.17.php on line 46
Code: Select all
Undefined index: content_obj in /var/www/XXXXX/tmp/templates_c/c1344001880^55f7216a49f40af311680e5c40b180e7c548bfdb.template.17.php on line 46
Code: Select all
<link rel="canonical" href="{$content_obj->GetURL()}" />
Code: Select all
{if isset($canonical)}
<link rel="canonical" href="{$canonical}" />
{elseif isset($content_obj)}
<link rel="canonical" href="{$content_obj->GetURL()}" />
{/if}
As I could not edit templates in the admin interface anymore I had to use phpmyadmin to change the template directly in the table cms_templates. After that the problem was gone and I could edit pages again.
I do not remember when I added the canonical part to my template and why I only added the content_obj line but I am leaving this as a warning for other people.
This does leave me with one minor question: is it logical that a template works fine in the normal published site but will throw errors in the admin interface (where a preview is generated I suppose) ?