Those tables are related to MView from Magento 2. It's the indexer that runs in cron every minute by...">
+1 vote
2.1k views
asked in Frameworks by (480 points)
closed by

Hi,

I need to call homepost.phtml file in front page,

My file is located in app/code/FishPig/WordPress/view/frontend/templets/sidebar/widget/homepost.phtml.

I wrote code in this file to call 5 recent post. But I don't know way to call this file or display this on front page of my website?

I am trying to call it by below given code but maybe its not display anything

{{block class="FishPig\WordPress\Block\Post" template="FishPig_WordPress::sidebar/homepost.phtml"}}

Please help me. Thanks,

closed with the note: Trying for backlinks.

2 Answers

+1 vote
answered by (260 points)

Those tables are related to MView from Magento 2. It's the indexer that runs in cron every minute by default. MView is used if you set the indexer mode to 'Index by Schedule'.

Magento checks if the _cl tables exist, if not, are created every time the indexer/MView runs. The code related to these table creation is in \Magento\Framework\Mview\View::subscribe().

The insertions in these tables are done by MySQL triggers. All triggers in Magento 2 database are used to update _cl tables: SHOW TRIGGERS. If admin changes the price of the product than it will insert rows in some of the tables. When cron runs after 1 minute, it will trigger indexing on those entities for each involved indexer. After each indexer run, if there are entities affected/cache tags (catalog_product_123), it triggers full page cache/Varnish type cleaning.

_cl tables rows are deleted if are old, like every hour. There is a cron job for this.

// Magento_Indexer/etc/crontab.xml
<job name="indexer_clean_all_changelogs" instance="Magento\Indexer\Cron\ClearChangelog" method="execute">
<schedule>0 * * * *</schedule>
</job>

0 votes
answered by (580 points)
Seems like you have missed the widget folder in the path. It should look like
FishPig_WordPress::sidebar/widget/homepost.phtml
instead of
FishPig_WordPress::sidebar/homepost.phtml
And the shortcode should read like
{{block class="FishPig\WordPress\Block\Post" template="FishPig_WordPress::sidebar/widget/homepost.phtml"}}
Dont forget to clear cache before checking.

Related questions

0 votes
3 answers 901 views
0 votes
1 answer 433 views
+1 vote
1 answer 292 views
+1 vote
1 answer 1.8k views
asked Feb 1 in Zend by Edward121 (260 points)
+1 vote
1 answer 1.8k views
+2 votes
1 answer 142 views
asked Jun 12, 2016 in Magento by Arton
...