添加动态块至首页后仅保留该块,Lesti FPC缓存异常
Hey there, looks like you ran into a classic layout/cache conflict issue with Lesti FPC on your Magento homepage. Let's break down what's probably going wrong and fix it step by step:
Start by temporarily disabling Lesti FPC entirely, then clear all Magento cache (including var/cache and var/page_cache on your server). If your homepage returns to normal (head, header, footer all visible), the problem is definitely with your Lesti FPC dynamic block setup. If not, the issue lies in your local.xml layout code.
The most common mistake here is adding the wrong block name to the dynamic list:
- You should be adding the specific product slider block's name to Lesti FPC's dynamic list, not the parent container block (
home_page_main_block). - For example, if your
home_page_main_block.phtmluses$this->getChildHtml('product_slider')to render the slider, the block name you need isproduct_slider, nothome_page_main_block. - If you accidentally set the parent container (or worse, a core layout container like
root,header, orcontent) as dynamic, Lesti FPC will only render that dynamic block and skip all statically cached layout components—hence the missing head, header, and footer.
local.xml Check your local.xml snippet for these common mistakes:
- Accidentally replacing the
contentblock instead of referencing it:
Wrong approach (this replaces the entire corecontentblock, wiping out all other content):
Correct approach (reference the existing<cms_index_index> <block name="content"> <block type="core/template" name="home_page_main_block" as="home_page_main_block" cache_lifetime="null" template="page/blocks/home_page_main_block.phtml" before="-" /> </block> </cms_index_index>contentblock and add your block to it):<cms_index_index> <reference name="content"> <block type="core/template" name="home_page_main_block" as="home_page_main_block" cache_lifetime="null" template="page/blocks/home_page_main_block.phtml" before="-" /> <!-- Other existing content blocks should still be present here or inherited from default layout --> </reference> </cms_index_index> - Broken
before/afterattribute: If yourbeforevalue is incomplete (likebefore=...in your snippet), that can corrupt the layout rendering. Make sure it's a valid value (e.g.,before="-"to place it first, or a specific block name).
After fixing either the Lesti FPC config or your local.xml, do a full cache wipe:
- Clear Magento's built-in cache via the admin (
System > Cache Management) - Delete the
var/cacheandvar/page_cachedirectories directly on your server (admin cache clears sometimes miss these) - Re-enable Lesti FPC and load your homepage again
Open page/blocks/home_page_main_block.phtml and make sure there are no accidental exit() or die() statements—these would stop the page rendering immediately after your block, skipping the footer and other elements.
内容的提问来源于stack exchange,提问作者Muhammad Mannan Masood

