Page 1 of 1

[SOLVED] News Detail Template fails after move to new server

Posted: Tue Sep 17, 2013 11:08 pm
by webform
After i moved a site to a new server/host, my News Detail Template have started to give me error messages like:

Code: Select all

Notice: Trying to get property of non-object in /home/u12v7cx/www/tmp/templates_c/nd6^d1b692be4d8923892b0461accc2bef9865a7b838.module_db_tpl.News;detailartikel.php on line 52
When i look in the referenced file on line 52 i can see it's my custom field generating the error:

Code: Select all

<?php if ($_smarty_tpl->tpl_vars['entry']->value->fields['Billede']->value){?>
But the field work just fine on my summary template.

I've noticed the new host have a different version of PHP (New Host = 5.3.10, Old Host = 5.3.27) and a long list of disabled PHP functions - Can that be the root of the problem?

Code: Select all

pcntl_alarm, pcntl_fork, pcntl_waitpid, pcntl_wait, pcntl_wifexited, pcntl_wifstopped, pcntl_wifsignaled, pcntl_wexitstatus, pcntl_wtermsig, pcntl_wstopsig, pcntl_signal, pcntl_signal_dispatch, pcntl_get_last_error, pcntl_strerror, pcntl_sigprocmask, pcntl_sigwaitinfo, pcntl_sigtimedwait, pcntl_exec, pcntl_getpriority, pcntl_setpriority,
CMS Version 1.11.7

Re: News Detail Template fails after move to new server

Posted: Tue Sep 17, 2013 11:23 pm
by calguy1000
Looks like a bad site migration, or you deleted the Billede custom field without changing the templates.

{$entry->fields.Billede->value} is valid code if the Billede field exists in the database

You could do some checking though:
{if isset($entry->fields.Billede)}{$entry->fields.Billede->value}{/if}

Re: News Detail Template fails after move to new server

Posted: Tue Sep 17, 2013 11:56 pm
by calguy1000
oh yeah, and make sure the field is marked as 'public'.

Re: News Detail Template fails after move to new server

Posted: Wed Sep 18, 2013 6:49 am
by Rolf
You did a clear cache after moving?

Re: News Detail Template fails after move to new server

Posted: Wed Sep 18, 2013 7:16 am
by webform
I think i've solved it now!

I get the error if the custom field is empty. I've used
{if $entry->fields.Billede->value}My Custom Field{/if}

And it worked fine on the "old" server and still do without change on the summary template (how come?)

I've changed it to
{if isset($entry->fields.Billede)}

And now the error message is gone!

So thanks Calguy.

Is it the difference in PHP versions that dictate what if sentence i can use? And wonder why my Summary template doesn't give that error even though it have the exact same fields and same if/else construct?