3

In Magento 1.9, I am creating CMS pages. I have a CMS page that fires an external template:

{{block type="core/template" template="/modules/storelocator/storelocator.phtml"}}

However, this page has this code

Hello World

When Magento is accessed this page, it fires and nests

tags inside everything. Can this be removed?

4

You need to turn the static block WYSIWYG editor off-by-default.

Content Management tab in system configuration.

Then edit your static blocks carefully - use the WYSIWYG but check your HTML afterwards.

for detail you can see answer here

| improve this answer | |
1

This

possible to removed,just click on and remove predefined p tag and put code your code.

{{block type="core/template" template="/modules/storelocator/storelocator.phtml"}}

Better to use layout handler

Better idea to go design tab of that Cms pages and put your block as your content block of this page:

<reference name="content">
<block type="core/template" template="/modules/storelocator/storelocator.phtml" />
</reference>
| improve this answer | |
1

This is actually easy to do, I just implemented it in my own custom module without modifying any core js files.

In the layout xml file for my module, I added this:

<reference name="js">
  <block type="adminhtml/template" name="js.wysiwyg.setup" template="inventory/js/wysiwyg/setup.phtml" />
</reference>

My module is named Inventory so i added the folder to my module's admin template file structure at inventory/js/wysiwyg/setup.phtml

In this file, I simply copied the "getSettings" method from js/mage/adminhtml/wysiwyg/tiny_mce/setup.js and redefined that method in my newly created file at inventory/js/wysiwyg/setup.phtml. Like so:

<script>
 // THIS IS HOW WE OVERRIDE MAGENTO'S WYSIWYG SETTINGS 
 // ADVICE FOR THE ACTUAL SETTINGS THAT I CHANGED BELOW CAME FROM 
 // http://www.pixafy.com/blog/2013/06/overcoming-magentos-wysiwyg-part-2-customizing-tinymce-settings

 // THIS IS A SIMPLE REDEFINING OF THE FUNCTION. SEE MY COMMENT BELOW TO SEE THE ONLY 3 LINES I HAD TO ADD

 tinyMceWysiwygSetup.prototype.getSettings = function(mode){
        var plugins = 'safari,pagebreak,style,layer,table,advhr,advimage,emotions,iespell,media,searchreplace,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras';

        if (this.config.widget_plugin_src) {
            plugins = 'magentowidget,' + plugins;
        }

        var magentoPluginsOptions = $H({});
        var magentoPlugins = '';

        if (this.config.plugins) {
            (this.config.plugins).each(function(plugin){
                magentoPlugins = plugin.name + ',' + magentoPlugins;
                magentoPluginsOptions.set(plugin.name, plugin.options);
            });
            if (magentoPlugins) {
                plugins = '-' + magentoPlugins + plugins;
            }
        }

        var settings = {
            mode : (mode != undefined ? mode : 'none'),
            elements : this.id,
            theme : 'advanced',
            plugins : plugins,
            theme_advanced_buttons1 : magentoPlugins + 'magentowidget,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,styleselect,formatselect,fontselect,fontsizeselect',
            theme_advanced_buttons2 : 'cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code,|,forecolor,backcolor',
            theme_advanced_buttons3 : 'tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,iespell,media,advhr,|,ltr,rtl,|,fullscreen',
            theme_advanced_buttons4 : 'insertlayer,moveforward,movebackward,absolute,|,styleprops,|,cite,abbr,acronym,del,ins,attribs,|,visualchars,nonbreaking,pagebreak',
            theme_advanced_toolbar_location : 'top',
            theme_advanced_toolbar_align : 'left',
            theme_advanced_statusbar_location : 'bottom',
            theme_advanced_resizing : true,

            // THESE 3 LINES ARE ALL I ADDED TO THE FUNCTION
            extended_valid_elements : '+div[*],+span[*],+a[*],+link[*],+script[*]',
            valid_children : '+a[h1|h2|h3|h4|h5|h6|p|span|div|img]',
            forced_root_block : false,

            convert_urls : false,
            relative_urls : false,
            content_css: this.config.content_css,
            custom_popup_css: this.config.popup_css,
            magentowidget_url: this.config.widget_window_url,
            magentoPluginsOptions: magentoPluginsOptions,
            doctype : '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">',

            setup : function(ed) {
                ed.onSubmit.add(function(ed, e) {
                    varienGlobalEvents.fireEvent('tinymceSubmit', e);
                });

                ed.onPaste.add(function(ed, e, o) {
                    varienGlobalEvents.fireEvent('tinymcePaste', o);
                });

                ed.onBeforeSetContent.add(function(ed, o) {
                    varienGlobalEvents.fireEvent('tinymceBeforeSetContent', o);
                });

                ed.onSetContent.add(function(ed, o) {
                    varienGlobalEvents.fireEvent('tinymceSetContent', o);
                });

                ed.onSaveContent.add(function(ed, o) {
                    varienGlobalEvents.fireEvent('tinymceSaveContent', o);
                });

                ed.onChange.add(function(ed, l) {
                    varienGlobalEvents.fireEvent('tinymceChange', l);
                });

                ed.onExecCommand.add(function(ed, cmd, ui, val) {
                    varienGlobalEvents.fireEvent('tinymceExecCommand', cmd);
                });
            }
        };

        // Set the document base URL
        if (this.config.document_base_url) {
            settings.document_base_url = this.config.document_base_url;
        }

        if (this.config.files_browser_window_url) {
            settings.file_browser_callback = function(fieldName, url, objectType, w) {
                varienGlobalEvents.fireEvent("open_browser_callback", {win:w, type:objectType, field:fieldName});
            };
        }

        if (this.config.width) {
            settings.width = this.config.width;
        }

        if (this.config.height) {
            settings.height = this.config.height;
        }

        return settings;     
 };
</script>
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.