Magento getIsAnchor()在模板文件中

I am trying to call $this->getIsAnchor() from a category template file to show certain information if the category has layered navigation. The function is always returning false, even when it should be true.

Is there a problem with calling the function from a template file this way? If so, what is the proper way to call this function?

You need to make this call against the category instead:

$_category->getIsAnchor();

Depending on what you are trying to achieve, you may find using layout.xml a cleaner option. There are different handles for layered and non layered categories:

Non Layered Categroy Handle

<catalog_category_default>

Layered Category Handle

<catalog_category_layered>