Disable wysiwyg editor when editing embeded php entrie/page

Get help with installation and running PivotX 2.0.x here. Please do not post Extension or Theme related questions here.

Disable wysiwyg editor when editing embeded php entrie/page

Postby jsge » Thu May 10, 2012 9:03 pm

Hi,
I am using pivotx for a good week now, this is to replace a joomla/mysql solution.
I need to run some internal reoprts that are dispalyed by openflashchart2. Teh script used to generate the report are in php and need some user input as well.
I also use entries and pages in the website.

Problem is if the editor is set to wysiwyg and you save the entry with embeded php, this is all messing up around.

Is there an easy way or kind of mod that could disable the editor in case the entry or page as php tag in it?
jsge
 
Posts: 4
Joined: Thu May 10, 2012 5:31 pm

Re: Disable wysiwyg editor when editing embeded php entrie/p

Postby Harm10 » Fri May 11, 2012 5:38 am

The easiest way to put non html in the editor is to create a separate file containing it and using [[ include ]] to include it. http://book.pivotx.net/index.php?page=app-b#anchor-include
Quality is in the detail of things............
Harm10
Developer
 
Posts: 1625
Joined: Wed Jun 17, 2009 9:37 am
Location: Somewhere in The Netherlands (aka Holland)

Re: Disable wysiwyg editor when editing embeded php entrie/p

Postby jsge » Fri May 11, 2012 7:02 am

Yes, I could do that but it means using an external editor, save the file and upload it to the server for every change.
Editing the php code directly using the pivotx editor field is more comfortable.
jsge
 
Posts: 4
Joined: Thu May 10, 2012 5:31 pm

Re: Disable wysiwyg editor when editing embeded php entrie/p

Postby hansfn » Fri May 11, 2012 9:35 am

Yes, I could do that but it means using an external editor, save the file and upload it to the server for every change.

No, it wouldn't. If you put the file in the templates folder, you can open it and edit directly from PivotX (using the Media browser). And that editor isn't Wysiwyg ;-)

I think your idea about checking if the content contains "[[php]]" and turning off Wysiwyg is doable. There is a hook named "entry_edit_beforeedit" which has the entry (array) as input. In that hook you probably could change the text_processing setting for the Smarty $user array. Yes, it's a little bit complicated and not documented. I don't have time to do it myself now.
hansfn
Developer
 
Posts: 3087
Joined: Sun Nov 25, 2007 7:48 pm
Location: Molde, Norway

Re: Disable wysiwyg editor when editing embeded php entrie/p

Postby jsge » Fri May 11, 2012 8:42 pm

Thanks for the tips, I will have a look. ;)
jsge
 
Posts: 4
Joined: Thu May 10, 2012 5:31 pm

Re: Disable wysiwyg editor when editing embeded php entrie/p

Postby hansfn » Sat May 12, 2012 5:31 am

Just two more hints:

1) If I'm not wrong, you can access to the already assigned Smarty variables (in PHP) through
Code: Select all
$PIVOTX['template']->_tpl_vars

2) There is an example hook in the hello_world extension. There are of course hooks in many more extensions.

If you make something that works, please post the code here (or send it to me at hansfn@pivotx.net).
hansfn
Developer
 
Posts: 3087
Joined: Sun Nov 25, 2007 7:48 pm
Location: Molde, Norway

Re: Disable wysiwyg editor when editing embeded php entrie/p

Postby jsge » Mon May 14, 2012 8:41 pm

hmmm , ok. I had a look but I will need sometime to get familiar with all this.
Looks powerful thought ...
jsge
 
Posts: 4
Joined: Thu May 10, 2012 5:31 pm


Return to 2.x Support Forum

Who is online

Users browsing this forum: Google [Bot] and 2 guests

cron