This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.

MonikaGross
MonikaGross

Hi! I need to insert partials anywhere in the post. For example on this page https://fation.club/blog/post/best-cute-summer-dresses-sleeves-2020 in the end of the page Virtual hairstyle frame. I tried to insert <?php include(''page.php) ?> but it doesn't work. Now I insert frame on the page, but in future I will past not only frame and it will repeat on other pages in different places.

mjauvin
mjauvin

do you want to to that in the markup or from php?

mjauvin
mjauvin

from cms markup/partials you use twig partial tag like:

{% partial "partial_name" %} 

from controller partials you use:

<?= $this->makePartial('partial_name'); ?>

from php code you use:

$this->makePartial('partial_name') ;

Last updated

mjauvin
MonikaGross
MonikaGross

yes, I tried this, but it doesn't work from blog>post, I wrote in post {% partial "partial_name" %} and <?= $this->makePartial('partial_name'); ?> but it render in the text {% partial "partial_name" %} and <?= $this->makePartial('partial_name'); ?>

mjauvin
mjauvin

If you mean from the actual post CONTENT, no, it's not possible.

You could try this trick which MIGHT allow you to do this, not sure:

https://octobertricks.com/tricks/render-twig-content-from-a-string

MonikaGross
MonikaGross

Thanks mjauvin!

1-7 of 7

You cannot edit posts or make replies: the forum has moved to talk.octobercms.com.