solved List_Module

nate
@nate
8 years ago
917 posts
My new skin uses icons on the header. I do this by passing the module name to a smarty function. I am just about finished but I have one last problem.

When using site builder, I can get $_widget.widget_module, but in the case of a list, the module is jrCore.

Doing a debug I can see the info I need is in $_widget.widget_data.list_module but this dot syntax only returns {

What's the proper syntax to get the list module name?
updated by @nate: 07/20/16 03:50:03PM
brian
@brian
8 years ago
10,148 posts
you can try it like:

{$_widget['widget_data']['list_module']}

The bracket syntax works in Smarty.


--
Brian Johnson
Founder and Lead Developer - Jamroom
https://www.jamroom.net
nate
@nate
8 years ago
917 posts
brian:The bracket syntax works in Smarty.

I think I saw this once. That just opened many doors. Thanks.
nate
@nate
8 years ago
917 posts
Still returns the same thing tho.
nate
@nate
8 years ago
917 posts
Here's a look. This is a site builder page. I did the following code

{$_widget['widget_data']['list_module']}
Untitled-1.jpg
Untitled-1.jpg  •  255KB


updated by @nate: 04/11/16 05:47:16PM
michael
@michael
8 years ago
7,715 posts
can I have a look at the screenshot for the {debug}.

Could be a nested array, so maybe:
{$_widget['widget_data'][0]['list_module']}
nate
@nate
8 years ago
917 posts
It's a json object.
Untitled-1.jpg
Untitled-1.jpg  •  46KB

michael
@michael
8 years ago
7,715 posts
you're not going to be able to get that directly then, need to decode it:
{$decoded = json_decode($_widget['widget_data'], true)}
{$list_module = $decoded['list_module']}

updated by @michael: 04/12/16 01:32:49AM
nate
@nate
8 years ago
917 posts
I did this.
{$data = $_widget.widget_data|json_decode:1}
And then used
$data.list_module

It works
michael
@michael
8 years ago
7,715 posts
yup, same thing.
nate
@nate
8 years ago
917 posts
Thanks.

Tags