How can i get this "cat" parameter from my cms page block
{{block class="Magento\Framework\View\Element\Template" template="Altravista_Carousel::product/carousel.phtml" cat="3"}}
in my Block Class?
Altravista\Carousel\Block\Product.php;
Magento Stack Exchange is a question and answer site for users of the Magento e-Commerce platform. It only takes a minute to sign up.
Sign up to join this communityYou can use in like this
{{block class="Magento\Framework\View\Element\Template" template="Altravista_Carousel::product/carousel.phtml" cat="3"}}
Now you can get the data by calling:
$myVar = $block->getData('cat');
OR
$myVar = $block->getMyCat();
Note : You should use $block.
If you want to access the parameter in your block class, you should use something like this.
{{block class="Altravista\Carousel\Block\Product" template="Altravista_Carousel::product/carousel.phtml" cat="3"}}
Where Altravista\Carousel\Block\Product extends Magento\Framework\View\Element\Template.
{{block class="Magento\Framework\View\Element\Template" template="Altravista_Carousel::product/carousel.phtml" cat="3"}}
code in CMS > Page OR CMS > Block?