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

Multiple blocks with same name... override them all #3

Open
arshaw opened this issue Apr 11, 2010 · 1 comment
Open

Multiple blocks with same name... override them all #3

arshaw opened this issue Apr 11, 2010 · 1 comment

Comments

@arshaw
Copy link
Owner

arshaw commented Apr 11, 2010

so you can do something like this...

parent.php:

<title>My Website Title | <?php emptyblock('title') ?></title>
<h1><?php emptyblock('title') ?></h1>

child.php:

<?php startblock('title') ?>Contact<?php endblock() ?>

however, there is an issue when superblock() is called and there are multiple parents (which superblock should it use?) but this feature might be worth it (maybe just choose the first superblock).

@JeyDotC
Copy link

JeyDotC commented Dec 1, 2012

A way to do this is to render the content of the parent block at the specific overriden block, like happens with smarty:

parent.tpl

AAAA
{block "repeated"}
BBBB
{/block}
CCCCC
{block "repeated"}
DDDD
{/block}
EEEE

child.tpl

{block "repeated"}
Overriding <strong>{$smarty.block.parent}</strong> with FFFF
{/block}

The result would be:

AAAA
Overriding BBBB FFFF
CCCCC
Overriding DDDD with FFFF
EEEE

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