[SOLVED] Problem with UDT upgrading from 1.9.4.3 to 1.11.4

Help with getting the CMS CORE package up and running. This does not include 3rd party modules, PHP scripts, anything downloaded via module manager or from any external source.
Locked
dbuenzli
Forum Members
Forum Members
Posts: 12
Joined: Sat Nov 12, 2011 6:07 pm

[SOLVED] Problem with UDT upgrading from 1.9.4.3 to 1.11.4

Post by dbuenzli »

Hello,

I have the blank editing page/cannot save template problem. It seems it is due to the following UDT:

Code: Select all

$gCms = cmsms ();

// Sets the smarty variable $wsite_lang
// The root of the hierarchy path of the current page defines the language.

$lang = explode ("/", $gCms->variables['content_obj']->HierarchyPath(), 2);
$gCms->GetSmarty ()->assign('wsite_lang', $lang[0]);
I tried to replace the $lang line with the seemingly more reliable:

Code: Select all

$lang = explode("/", cms_utils::get_current_content()->HierarchyPath(), 2);
But it still doesn't work (it does work if I set $lang to a static string). Any hints of what I'm doing wrong ?

Thanks for your answers.
Last edited by dbuenzli on Mon Jan 14, 2013 4:52 pm, edited 1 time in total.
TheLastLegion
Forum Members
Forum Members
Posts: 54
Joined: Sun Dec 21, 2008 4:01 am

Re: Problem with UDT upgrading from 1.9.4.3 to 1.11.4

Post by TheLastLegion »

1. Make sure menu is not cachable in menu manager
2. Update site template, to see what you need to update, create new template and default code will be generated for you, integrate the missing parts from the template into your site template
3. Read similar threads, lots of people with upgrade problem from your version to 1.11.4 all had their problem solved. Please use search
dbuenzli
Forum Members
Forum Members
Posts: 12
Joined: Sat Nov 12, 2011 6:07 pm

Re: Problem with UDT upgrading from 1.9.4.3 to 1.11.4

Post by dbuenzli »

Thanks but that doesn't really help, I already mostly did that.

The problem lies in this UDT. If I remove the call to it in the template I can edit my pages.
User avatar
Rolf
Power Poster
Power Poster
Posts: 7825
Joined: Wed Apr 23, 2008 7:53 am
Location: The Netherlands
Contact:

Re: Problem with UDT upgrading from 1.9.4.3 to 1.11.4

Post by Rolf »

$gCms = cmsms_();

$gCms = cmsms();
- + - + - + - + - + - + -
LATEST TUTORIAL AT CMS CAN BE SIMPLE:
Migrating Company Directory module to LISE
- + - + - + - + - + - + -
Image
dbuenzli
Forum Members
Forum Members
Posts: 12
Joined: Sat Nov 12, 2011 6:07 pm

Re: Problem with UDT upgrading from 1.9.4.3 to 1.11.4

Post by dbuenzli »

Thanks Rolf but removing these spaces don't change anything. As I said in my first post the problem specifically lies on the $lang line. If I change it to a constant string everything works fine.
dbuenzli
Forum Members
Forum Members
Posts: 12
Joined: Sat Nov 12, 2011 6:07 pm

Re: Problem with UDT upgrading from 1.9.4.3 to 1.11.4

Post by dbuenzli »

Not sure exactly why (I'll gladly take an explanation) but replacing the $lang line with the following solves the blank editing page/inability to save template problem.

Code: Select all

$c = cms_utils::get_current_content();
if (isset($c)) { $lang = explode('/', $c->HierarchyPath(), 2); }
Cannot check right now if the code still works since I have other template compilation problems. Will report later.
dbuenzli
Forum Members
Forum Members
Posts: 12
Joined: Sat Nov 12, 2011 6:07 pm

[SOLVED] Re: Problem with UDT upgrading from 1.9.4.3 to 1.11

Post by dbuenzli »

The fix works, I got the hint from here. I'm still taking any better explanation on why this is needed, somehow I don't fully grasp what's written there ("smarty cannot properly trap (?) a template"). Thanks.
calguy1000
Support Guru
Support Guru
Posts: 8169
Joined: Tue Oct 19, 2004 6:44 pm
Location: Fernie British Columbia, Canada

Re: [SOLVED] Problem with UDT upgrading from 1.9.4.3 to 1.11

Post by calguy1000 »

because $gCms->variables is internal data, not for public use, deprecated and subject to change. And it probably has changed.
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
dbuenzli
Forum Members
Forum Members
Posts: 12
Joined: Sat Nov 12, 2011 6:07 pm

Re: [SOLVED] Problem with UDT upgrading from 1.9.4.3 to 1.11

Post by dbuenzli »

But it didn't work even when I did not use $gCms->variables. That is:

Code: Select all

$lang = explode("/", cms_utils::get_current_content()->HierarchyPath(), 2);
didn't work either. It only worked when I added the isset condition to test the result of cms_utils::get_current_content().

My (wild) guess is that when you try to save a template it tries to compile it in an incomplete context compared to when it is invoked with data and that may fail, preventing you from saving the the template.
calguy1000
Support Guru
Support Guru
Posts: 8169
Joined: Tue Oct 19, 2004 6:44 pm
Location: Fernie British Columbia, Canada

Re: [SOLVED] Problem with UDT upgrading from 1.9.4.3 to 1.11

Post by calguy1000 »

correct.... and you should prolly use is_object instead of isset().

There is no 'current frontend page' when editing content or editing templates from the admin.
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
dbuenzli
Forum Members
Forum Members
Posts: 12
Joined: Sat Nov 12, 2011 6:07 pm

Re: [SOLVED] Problem with UDT upgrading from 1.9.4.3 to 1.11

Post by dbuenzli »

Ok, thanks for the tip.
Locked

Return to “[locked] Installation, Setup and Upgrade”