Created
June 11, 2019 13:29
-
-
Save bastianallgeier/69b7cdac9295fab2021c1a2e3d8077a8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some Text with the product (product: test) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// site/plugins/products/index.php | |
Kirby::plugin('dantz/products', [ | |
'tags' => [ | |
'product' => [ | |
'html' => function ($tag) { | |
if ($product = page('products/' . $tag->value())) { | |
return snippet('product', ['product' => $product], true); | |
} | |
return ''; | |
} | |
] | |
] | |
]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- site/snippets/product.php --> | |
<article class="product"> | |
<!-- image and stuff --> | |
<?= $product->title() ?> | |
</article> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment