Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get block with name from a variable #221

Closed
zoriax opened this issue Apr 22, 2016 · 4 comments
Closed

Get block with name from a variable #221

zoriax opened this issue Apr 22, 2016 · 4 comments

Comments

@zoriax
Copy link

zoriax commented Apr 22, 2016

Hello there !

Is it possible to get a {block} with name issue fromw a vairable ?

{assign var="name" value="block_name"}
{block name=$name}{/block}

Thanks !

@zoriax
Copy link
Author

zoriax commented Apr 22, 2016

Sorry it work perfectly like that

{assign var="name" value="block_name"}
{block name="$name"}{/block}

@uwetews uwetews closed this as completed Apr 23, 2016
@uwetews uwetews reopened this Apr 24, 2016
@uwetews
Copy link
Contributor

uwetews commented Apr 24, 2016

Variable name attribute of {block} tags are not supported.

{assign var="name" value="block_name"}
{block name="$name"}{/block}

Must have worked only by chance in the Smarty version you have used. Which one?

Why you need to use a variable name? Looks like a wrong approach.

@zoriax
Copy link
Author

zoriax commented Apr 25, 2016

What I need with variable name is to load a specific block from a template file with a lot of block. For example : I have a template file which contains blocks with different . Some of them need to be loaded by Ajax dynamically. It'as why I need to use name as variable. Maybe you have a better approach for that ?
Thanks

@uwetews
Copy link
Contributor

uwetews commented May 1, 2016

Variable {block} tag names are now supported.
The change is in the master branch and will later be included in 3.1.30

@uwetews uwetews closed this as completed May 1, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants