Context
# Context
When blocks are used inside a loop (for example, a Query block), the block is executed once for each iteration of the loop. Blockstudio provides handy shortcuts for accessing the current loop and outer context.
```php
```
```twig
```
This is the data of current element inside the loop:
This is the data the current post:
This is the data of current element inside the loop: {{ block.context.postId }} {{ block.context.postType }}
This is the data the current post: {{ block.postId }} {{ block.postType }}
When blocks are used inside a loop (for example, a Query block), the block is executed once for each iteration of the loop. Blockstudio provides handy shortcuts for accessing the current loop and outer context.
<div>
<h1>
This is the data of current
element inside the loop:
<?php echo $block['context']['postId'] ?>
<?php echo $block['context']['postType'] ?>
</h1>
<h1>
This is the data the current post:
<?php echo $block['postId'] ?>
<?php echo $block['postType'] ?>
</h1>
</div>
Copy
<div>
<h1>
This is the data of current
element inside the loop:
<?php echo $block['context']['postId'] ?>
<?php echo $block['context']['postType'] ?>
</h1>
<h1>
This is the data the current post:
<?php echo $block['postId'] ?>
<?php echo $block['postType'] ?>
</h1>
</div>
<div>
<h1>
This is the data of current
element inside the loop:
{{ block.context.postId }}
{{ block.context.postType }}
</h1>
<h1>
This is the data the current post:
{{ block.postId }}
{{ block.postType }}
</h1>
</div>
Copy
<div>
<h1>
This is the data of current
element inside the loop:
{{ block.context.postId }}
{{ block.context.postType }}
</h1>
<h1>
This is the data the current post:
{{ block.postId }}
{{ block.postType }}
</h1>
</div>