solved smarty scope=parent

SteveX
SteveX
@ultrajam
11 years ago
2,584 posts
I'm trying to use smarty scope=parent in an assign in an included template. It seems to be working up to a point - I can see the assigned value in the debug window when debug is triggered after the include. But I can't use the actual variable, {$testthing} is empty although it shows as having the correct value in the debug window.

The including template (the parent):
{jrCore_include template=$_scroll.scroll_section_template}
{if $_scroll.scroll_section_template == "testchild.tpl"} 
    {debug}
    testthing is {$testthing}
{/if}

The included testchild.tpl template:
{capture name="testthing_capture" assign="testthing_assigned"}ROCKON{/capture}
{assign var="testthing" value=$testthing_assigned scope="parent"}

Should $testthing be available in the parent template since it's in the debug window? (it is null in the debug window if scope is not set in the assign)
Example 7.11. {assign} in the scope of calling template
http://www.smarty.net/docs/en/language.function.assign.tpl?#idp7975424

Thanks


--
¯\_(ツ)_/¯ Education, learning resources, TEL, AR/VR/MR, CC licensed content, panoramas, interactive narrative, sectional modules (like jrDocs), lunch at Uni of Bristol. Get in touch if you share my current interests or can suggest better :)

updated by @ultrajam: 06/28/14 05:26:06PM
brian
@brian
11 years ago
10,149 posts
jrCore_include works a little different then the regular smarty include, as it checks for templates that have been overridden in the ACP. Switch to the regular smarty include and see if it works.

Hope this helps!


--
Brian Johnson
Founder and Lead Developer - Jamroom
https://www.jamroom.net
SteveX
SteveX
@ultrajam
11 years ago
2,584 posts
Yes, that does work :)

I'm using a skin dir template, so no overrides needed: the perfect solution.

Thanks Brian!


--
¯\_(ツ)_/¯ Education, learning resources, TEL, AR/VR/MR, CC licensed content, panoramas, interactive narrative, sectional modules (like jrDocs), lunch at Uni of Bristol. Get in touch if you share my current interests or can suggest better :)
brian
@brian
11 years ago
10,149 posts
SteveX:
Yes, that does work :)

I'm using a skin dir template, so no overrides needed: the perfect solution.

Thanks Brian!

Thanks Steve - I will check this out however and see if I can spot why it's not working with the core jrCore_include - it would be nice if it did.

Thanks!


--
Brian Johnson
Founder and Lead Developer - Jamroom
https://www.jamroom.net

Tags