Page 1 of 1

Preventing MicroTiny corrupting smarty tags

Posted: Fri Feb 08, 2019 5:08 am
by MantaPro
Been hunting around the forums; docs and google to see if there is a setting somewhere that will prevent MicroTiny putting <p>...</p> around smarty comments that are in the main {content_en} block. In this instance it rarely breaks anything but it is adding invalid html depending upon what is rendered by the smarty command.

But it is a bigger problem if there are any "{* " smarty comments within the content

If not, I guess a fudge would be to do something like this for every text area content block

Code: Select all

{content|replace:"<p>{* </p>":"{* " assign=pagecontent}

or regex_replace; to fix anything MicroTiny breaks

But I would have thought that having smarty within a content block edited by a admin editor is quite common (I have already relocated 90% of any scripting (UDTs; Smarty rendering logic; jquery/.js) out of the page content in to templates but still left with "{include file='cms_template:.......}" and using {* *} to temporarily hide content or temporarily disable a smarty command is useful - and disabling MicroTiny for Admin used editors defeats the object of a CMS

Code: Select all


----------------------------------------------

Cms Version: 2.2.9

Installed Modules:

    AdminSearch: 1.0.4
    CGBetterForms: 1.9
    CGBlog: 1.15.8
    CGExtensions: 1.61.4
    CGFBPost: 1.1.3
    CGGoogleMaps2: 1.1.1
    CGSimpleSmarty: 2.2.1
    CGSocialBlaster: 1.1
    CGTweet: 1.3.2
    CMSContentManager: 1.1.7
    Captcha: 1.0
    CmsJobManager: 0.1.3
    DesignManager: 1.1.5
    FileManager: 1.6.8
    FilePicker: 1.0.3
    FrontEndUsers: 2.12.6
    JMFilePicker: 1.0.1
    JQueryTools: 1.4.0.4
    LISE: 1.3.1
    MicroTiny: 2.2.3
    ModuleManager: 2.1.5
    Navigator: 1.0.9
    News: 2.51.4
    Search: 1.51.6


Config Information:

    php_memory_limit:
    max_upload_size: 10000000
    url_rewriting: mod_rewrite
    page_extension: .htm
    query_var: page
    auto_alias_content: true
    locale:
    set_names: true
    timezone: Europe/London
    permissive_smarty: true


Php Information:

    phpversion: 7.3.1
    md5_function: On (True)
    json_function: On (True)
    gd_version: 2
    tempnam_function: On (True)
    magic_quotes_runtime: Off (False)
    E_ALL: 22519
    E_STRICT: 0
    E_DEPRECATED: 0
    test_file_timedifference: No time difference found
    test_db_timedifference: No time difference found
    create_dir_and_file: 1
    memory_limit: 32M
    max_execution_time: 60
    register_globals: Off (False)
    output_buffering: 1
    disable_functions:
    open_basedir:
    test_remote_url: Success
    file_uploads: On (True)
    post_max_size: 10M
    upload_max_filesize: 10M
    session_save_path: /tmp (1777)
    session_use_cookies: On (True)
    xml_function: On (True)
    xmlreader_class: On (True)
    check_ini_set: On (True)
    curl: On


Performance Information:

    allow_browser_cache: On (True)
    browser_cache_expiry: 60
    php_opcache: Off (False)
    smarty_cache: Off (False)
    smarty_compilecheck: Off (False)
    auto_clear_cache_age: On (True)

Server Information:

    Server Software: Apache
    Server Api: cgi-fcgi
    Server Os: Linux 3.16.0-ui18276.29-uiabi1-infong-amd64 On x86_64
    Server Db Type: MySQL (mysqli)
    Server Db Version: 5.5.60
    Server Db Grants: Found a "GRANT ALL" statement that appears to be suitable


Permission Information:

    tmp: /homepages/38/d242029264/htdocs/ablecare_cmsms2/tmp (0705)
    tmp_cache: /homepages/38/d242029264/htdocs/ablecare_cmsms2/tmp/cache (0705)
    templates_c: /homepages/38/d242029264/htdocs/ablecare_cmsms2/tmp/templates_c (0705)
    modules: /homepages/38/d242029264/htdocs/ablecare_cmsms2/modules (0705)
    uploads: /homepages/38/d242029264/htdocs/ablecare_cmsms2/uploads (0705)
    File Creation Mask (umask): /homepages/38/d242029264/htdocs/ablecare_cmsms2/tmp/cache (0705)
    config_file: 0644

----------------------------------------------

Re: Preventing MicroTiny corrupting smarty tags

Posted: Sat Feb 09, 2019 11:23 pm
by MantaPro
I note reading the MicroTiny module help text it advocates excluding all smarty for content text areas edited by user-editors who need WYSIWYG.

With some thought if I can make the templates currently in use more sophisticated by replacing each content block with a "club sandwich" of content blocks

Code: Select all

Smarty - top
Content  - top filling
Smarty Middle
Content - bottom filling
Smarty Bottom
Which will allow almost every combination of positioning user-content and smarty rendered UDT; included-template-content; or CGSharedContent; Maps; Blog; News etc etc

And I can use the wysiwyg=false and also possibly the adminonly=true on the smarty content blocks so that a user-editor editing their content doesn't break the smarty commands

Also to avoid repeating the code to achieve the above across numerous (2 col; 3 column; sidebar-left type) templates I'm sure I can use a single template nested in to my existing ones and simply inherit some naming from the parent template to keep the name of content blocks unique.

I am sure I've seen questions before similar to my original post - so I've explained my approach here so that others with the same question may find this "answer"

Re: Preventing MicroTiny corrupting smarty tags

Posted: Sat Feb 09, 2019 11:42 pm
by DIGI3
Other considerations:

-use template inheritance, so you can have page templates featuring different Smarty functionality without having to maintain multiple full templates.

-use modules such as CGContentUtilities to offer your users dropdowns, multiselects, etc so they can choose from your pre-determined list of tags/plugins/etc (saves them having to write out the Smarty tag). You can also use this to create Gallery selectors, LISE instance selectors, etc.

You're definitely on the right track. Try to keep wysiwyg blocks for text content. There's always exceptions - you may wish to write a simple plugin to echo a button or other reusable piece of code, but the default should generally be to include code in templates, and content in content blocks.