Problem with my custom plugin

The place to talk about things that are related to CMS Made simple, but don't fit anywhere else.
Post Reply
tomgal001
New Member
New Member
Posts: 2
Joined: Wed Dec 11, 2013 2:55 pm

Problem with my custom plugin

Post by tomgal001 »

Hi i wrote simple plugin with params containig javascript arrays in arguments. For example:
users="[['Adam'm 25], [John, 23]]" // this is string which plugin parse

I have problem with smarty and TinyMce editor when i put this args arrays in new lines tiny editor adds new lines in html:

{MyPlugin users="[<br/>['Adam'm 25],<br/> [John, 23]]"}

and smarty show me error page :(

I don't want to clean this html tags in html view.
I think that buttons in editor (clean formating, paste as raw text) do this job but they don't work in wersion 1.11.9

Please help me ...
Jos
Support Guru
Support Guru
Posts: 4020
Joined: Wed Sep 05, 2007 8:03 pm

Re: Problem with my custom plugin

Post by Jos »

Is it an idea to just use comma separated parametervalues like
{MyPlugin users='Adam,John'}

And convert it to a javascript array in your script like this:

Code: Select all

$userarray = explode(',', $params['users']);
$javascriptarray = implode('],[', $userarray);
$javascriptarray = '[[' . $javascriptarray . ']]';
or simply

Code: Select all

$javascriptarray = '[[' . str_replace(',', '],[', $params['users']) . ']]';
calguy1000
Support Guru
Support Guru
Posts: 8169
Joined: Tue Oct 19, 2004 6:44 pm

Re: Problem with my custom plugin

Post by calguy1000 »

You CANNOT mix code like that in a WYSIWYG area.

i.e:

some marked up text with bold and stuff in it
{some_plugin foo='<br/>'}
some more marked up text.

TinyMCE and MicroTiny are not built for that. Period. I will not go into the how or why.
And it goes to the separation of concerns. Don't mix business logic with content or design.

You should disable the wysiwyg on the pages and/or content blocks using these business logic plugins. And don't allow your users to edit those pages or GCB's.
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
tomgal001
New Member
New Member
Posts: 2
Joined: Wed Dec 11, 2013 2:55 pm

Re: Problem with my custom plugin

Post by tomgal001 »

Thanks for your responses.

On the other hand coud you tell my why icons to copy/paste/clean formatting not working in version 1.11.9 ?
If will by some solutions in higher releases ? :)
Post Reply

Return to “The Lounge”