[SOLVED] Smarty scope of variables CMSMS after 1.12.1 -> 2.0

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
pjb
Forum Members
Forum Members
Posts: 27
Joined: Wed Feb 02, 2011 11:04 pm

[SOLVED] Smarty scope of variables CMSMS after 1.12.1 -> 2.0

Post by pjb »

It looks like I'm running into a Smarty scope of variables problem after a CMSMS 2.0 upgrade.

I've attached my template file, and the UDT {mobile} it calls.

It looks to me like the template, at line 5, is trying to capture the value of $mobile_detect, which appears to be assigned in line 150 of the UDT {mobile}:

$smarty->assign('mobile_detect',false);

But this isn't working.

The template relies on the value of $mobile_detect to trigger the display of page content, and that isn't happening. Though of course it did work in CMSMS 1.12.1.

I've tried using the {share_data} tag, but with no luck. Nor do I know how to make $mobile_detect assigned as global in scope.

For what it is worth, both the template and the UDT are from a site created with the Foundation 5 responsive framework. That is, I did not -- and could not -- write this from scratch.

Thanks for your help.

============


----------------------------------------------

Cms Version: 2.0

Installed Modules:

CMSMailer: 5.2.4
FileManager: 1.5
MenuManager: 1.50
ModuleManager: 2.0
News: 2.50
Printing: 1.1.1
Search: 1.50
ThemeManager: 1.1.8
TinyMCE: 2.9.12
FormBuilder: 0.8.1.1
Captcha: 0.5.2
FormBrowser: 0.4.2
AdminSearch: 1.0
MicroTiny: 2.0
CGExtensions: 1.49.7
JQueryTools: 1.3.7
CMSContentManager: 1.0
CMSFoundation: 1.5.1
CGSmartImage: 1.20.3
DesignManager: 1.0
Navigator: 1.0


Config Information:

php_memory_limit:
max_upload_size: 2000000
url_rewriting: none
page_extension:
query_var: page
auto_alias_content: true
locale:
set_names: true
timezone: America/Chicago
permissive_smarty: false


Php Information:

phpversion: 5.4.45
md5_function: On (True)
json_function: On (True)
gd_version: 2
tempnam_function: On (True)
magic_quotes_runtime: Off (False)
E_STRICT: 0
E_DEPRECATED: 0
test_file_timedifference:
test_db_timedifference:
memory_limit: 128M
max_execution_time: 30
output_buffering: 0
file_uploads: On (True)
post_max_size: 8M
upload_max_filesize: 2M
session_save_path: /tmp (1777)
session_use_cookies: On (True)
xml_function: On (True)
xmlreader_class: On (True)


Performance Information:

allow_browser_cache: Off (False)
browser_cache_expiry: 60
php_opcache: Off (False)
smarty_cache: Off (False)
smarty_compilecheck: Off (False)
smarty_cache_udt: Off (False)
auto_clear_cache_age: Off (False)

Server Information:

Server Api: cgi-fcgi
Server Db Type: MySQL (mysql)
Server Db Version: 5.5.40
Server Db Grants: Found a "GRANT ALL" statement that appears to be suitable
Server Time Diff: No file system time difference found


----------------------------------------------
Attachments

[The extension txt has been deactivated and can no longer be displayed.]

[The extension txt has been deactivated and can no longer be displayed.]

Last edited by pjb on Thu Oct 01, 2015 12:16 pm, edited 1 time in total.
User avatar
Jo Morg
Dev Team Member
Dev Team Member
Posts: 1967
Joined: Mon Jan 29, 2007 4:47 pm

Re: Smarty scope of variables problem after CMSMS 1.12.1 ->

Post by Jo Morg »

Try replacing

Code: Select all

$smarty->assign(...
by

Code: Select all

$smarty->assignGlobal(...
There are at least 2 instances of assign so you should try to replace them both. Untested though...
"There are 10 types of people in this world, those who understand binary... and those who don't."
* by the way: English is NOT my native language (sorry for any mistakes...).
Code of Condut | CMSMS Docs | Help Support CMSMS
My developer Page on the Forge
GeekMoot 2015 in Ghent, Belgium: I was there!
GeekMoot 2016 in Leicester, UK: I was there!
DevMoot 2023 in Cynwyd, Wales: I was there!
pjb
Forum Members
Forum Members
Posts: 27
Joined: Wed Feb 02, 2011 11:04 pm

Re: Smarty scope of variables problem after CMSMS 1.12.1 ->

Post by pjb »

Jo,

Replacing assign with assignGlobal provided the fix, though I ended up having to make that edit to a variable assignment in the page template as well as the UDT. Thanks for the prompt and useful help!!
Locked

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