Enable template path hint in admin pages - Magento

倾然丶 夕夏残阳落幕 提交于 2019-12-28 08:02:16

问题


I want to enable template path hints in admin panel. I know how to do it for the front end, but for back end?? I actually want to edit the admin panel .

Thanks in advance..


回答1:


You can do it by changing the database directly. If you have something like phpMyAdmin that is a good way to gain access. Enter this SQL.

INSERT INTO `core_config_data` (`scope`, `scope_id`, `path`, `value`)
       VALUES ('websites', '0', 'dev/debug/template_hints', '1');

When you are done with path hints just delete the matching record from core_config_data Or update the value field to 0 instead of deleting the whole record, it will probably be the last one since you've just added it.




回答2:


You can enable template and block path hints in every store (including the admin store) by setting them in the Magento configuration. To do this, simply edit your module's configuration file config.xml (which gets injected into Magento's global configuration).

To enable template and block path hints in the admin area add this to your config.xml file

<config>

    ...

    <stores>
        <admin>
            <dev>
                <debug>
                    <template_hints>1</template_hints>
                    <template_hints_blocks>1</template_hints_blocks>
                </debug>
            </dev>
        </admin>
    </stores>

</config>

To disable path hints simply change to 0, or delete the node.




回答3:


open /app/etc/local.xml and add the follow code

<config>

    ...

    <websites>
        <admin>
            <dev>
                <debug>
                    <template_hints>1</template_hints>
                    <template_hints_blocks>1</template_hints_blocks>
                </debug>
            </dev>
        </admin>
    </websites>
</config>



回答4:


The feature wasn't designed to be used on the admin. Its system config is explicitly set to only allow you to se this at the website or store level, not the global level.

Assuming this is just for work in a development environment, the approach I'd take would be to override the class

Mage_Core_Block_Template

and override (with a class alias override, or a local/Mage replacement) the getShowTemplateHints method hints.

public function getShowTemplateHints()
{
     //return false
     return true; 
}

//     old method, here for demo purposes only.  Don't hack the core
//     public function getShowTemplateHints()
//     {
//         if (is_null(self::$_showTemplateHints)) {
//             self::$_showTemplateHints = Mage::getStoreConfig('dev/debug/template_hints')
//                 && Mage::helper('core')->isDevAllowed();
//             self::$_showTemplateHintsBlocks = Mage::getStoreConfig('dev/debug/template_hints_blocks')
//                 && Mage::helper('core')->isDevAllowed();
//         }
//         return self::$_showTemplateHints;
//     }

You can then manually change getShowTemplateHints to return true or false if you want the feature on or off, or add whatever additional logic you wanted.

I would not recommend you push this change to the production server.




回答5:


You can use the following extension in order to enable the template path hints for frontend & backend easily & securly in a joomla way:
http://www.magepsycho.com/easy-template-path-hints.html




回答6:


A quite handy solution: Modify getShowTemplateHints() function defined in \app\code\core\Mage\Adminhtml\Block\Template.php file as below:

To run below function: In your browser type, http://www.mymagentosite.com/?th=1&token=PHP

You can see template hints and added Block Names.

public function getShowTemplateHints()
{
    if (is_null(self::$_showTemplateHints))
    {
        self::$_showTemplateHints = Mage::getStoreConfig('dev/debug/template_hints')
            && Mage::helper('core')->isDevAllowed();
        self::$_showTemplateHintsBlocks = Mage::getStoreConfig('dev/debug/template_hints_blocks')
            && Mage::helper('core')->isDevAllowed();
    }

    // overwrite the template hint [SPECIALLY FOR SHOWING TEMPLATE PATH HINTS IN ADMIN]
    $th     = Mage::app()->getRequest()->getParam('th', false);
    $token  = Mage::app()->getRequest()->getParam('token', false);
    if($th == 1 && $token == 'PHP'){
        self::$_showTemplateHints = true; // for template path
        self::$_showTemplateHintsBlocks = true; // block names
    }

    return self::$_showTemplateHints;
}



回答7:


I know it's late but you can do it easily this way: Just change settings in the configuration file www/app/code/core/Mage/Core/etc/system.xml

Set sections>dev>debug>fields>template_hints>show_in_default to 1 and set sections>dev>debug>fields>template_hints_blocks>show_in_default to 1 too




回答8:


Go to your Database and Just run this query:

INSERT INTO core_config_data (scope, scope_id, path, value)
VALUES ('default', 0, 'dev/debug/template_hints', 1),
('default', 0, 'dev/debug/template_hints_blocks', 1);

To disable them again, run this query:

UPDATE core_config_data set value = 0 where scope = 'default' and scope_id = 0 and path ='dev/debug/template_hints'

To enable again run this query:

UPDATE core_config_data set value = 1 where scope = 'default' and scope_id = 0 and path ='dev/debug/template_hints'



回答9:


I don't think you should make it too difficult, let 's make it easy by easy steps. You can look at the instruction here about How to turn on template path hints in Magento



来源:https://stackoverflow.com/questions/4373481/enable-template-path-hint-in-admin-pages-magento

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!