[solved]Front end editor

roberto.c87
Phoca Member
Phoca Member
Posts: 10
Joined: 31 May 2017, 13:58

[solved]Front end editor

Post by roberto.c87 » 06 Oct 2017, 08:59

Hi, I would use the editor in the front(jce or tinyMCE or others) end where you insert a description of a file when uploading. The user has enabled the editor but can not see it. Where am I wrong?
Last edited by roberto.c87 on 28 Oct 2017, 11:02, edited 1 time in total.


roberto.c87
Phoca Member
Phoca Member
Posts: 10
Joined: 31 May 2017, 13:58

Re: Front end editor

Post by roberto.c87 » 06 Oct 2017, 09:47

In an old topic I read that for security reasons you can not use the front end editor. has something changed? Which code can i place and where to use the editor?

User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 39060
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Front end editor

Post by Jan » 06 Oct 2017, 16:21

Hi, it is not about can or cannot, it is not recommended to use it but of course if your users use it e.g. for articles, etc. then it can be extended to downloads, etc. but this needs to be customized. Instead of displaying the textarea form, the Joomla! editor needs to be set - plus additional check, etc. So for some examples, just take a look at frontend article edit, or for Phoca Guestbook, etc. :idea:

Jan
If you find Phoca extensions useful, please support the project

roberto.c87
Phoca Member
Phoca Member
Posts: 10
Joined: 31 May 2017, 13:58

Re: Front end editor

Post by roberto.c87 » 09 Oct 2017, 07:21

Thank you for the reply. My intention is to enter the default text in the description using a editor plugin button (regular template). what file generates the frontend page for uploading the files? in which folder is it?

User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 39060
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Front end editor

Post by Jan » 12 Oct 2017, 15:06

Hi, see:
components\com_phocadownload\views\user\view.html.php
components\com_phocadownload\views\user\tmpl

Jan
If you find Phoca extensions useful, please support the project

roberto.c87
Phoca Member
Phoca Member
Posts: 10
Joined: 31 May 2017, 13:58

Re: Front end editor

Post by roberto.c87 » 13 Oct 2017, 09:05

Thank you for the reply. I do not understand, by going to modify the files you have indicated to me, I do not see the edits in the frontend even by cleaning the cache. I tried to edit all the files in the tmpl folder but nothing happens. the html code generated by the php pages you have shown me coincides with what I see when I look at the page with firebug. So where am I wrong?

roberto.c87
Phoca Member
Phoca Member
Posts: 10
Joined: 31 May 2017, 13:58

Re: Front end editor

Post by roberto.c87 » 13 Oct 2017, 10:04

also by deleting all the files in the folder \ components \ com_phocadownload \ views \ user \ tmpl all continues to work, so I think some other files

User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 39060
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Front end editor

Post by Jan » 13 Oct 2017, 14:55

Hi, maybe your template override the component output, try to check your template if it does not override component output :idea:

Jan
If you find Phoca extensions useful, please support the project

roberto.c87
Phoca Member
Phoca Member
Posts: 10
Joined: 31 May 2017, 13:58

Re: Front end editor

Post by roberto.c87 » 25 Oct 2017, 15:11

thanks for the answer, you were right was a component override issue. I used the following code and the editor is now shown, the problem I'm left behind is that I write is not then recorded, so if I access the file from the backend file the description field is empty.

Code: Select all

jimport( 'joomla.html.editor' );

// GET EDITOR SELECTED IN GLOBAL SETTINGS
$config = JFactory::getConfig();
$global_editor = $config->get( 'editor' );

// GET USER'S DEFAULT EDITOR
$user_editor = JFactory::getUser()->getParam("editor");

if($user_editor && $user_editor !== 'JEditor') {
    $selected_editor = $user_editor;
} else {
    $selected_editor = $global_editor;
}

// INSTANTIATE THE EDITOR
$editor = JEditor::getInstance($selected_editor);

// SET EDITOR PARAMS
$params = array( 'smilies'=> '0' ,
    'style'  => '1' ,
    'layer'  => '0' ,
    'table'  => '0' ,
    'clear_entities'=>'0'
);
........

<tr>
			<td><strong><?php echo JText::_( 'COM_PHOCADOWNLOAD_DESCRIPTION' ); ?>:</strong></td>
			<td><textarea id="phocadownload-upload-description" name="phocadownloaduploaddescription" 
                         onkeyup="countCharsUpload();" cols="30" rows="10" class="comment-input">
			<?php echo $editor->display('content', '', '400', '400', '20', '20', true, null, null, null, $params);?>
			<?php  $this->formdata->description ?>
			</textarea></td>
		</tr>

can you help me?

roberto.c87
Phoca Member
Phoca Member
Posts: 10
Joined: 31 May 2017, 13:58

Re: Front end editor

Post by roberto.c87 » 25 Oct 2017, 16:48

I noticed that the editor is shown out of the textarea, I tried inserting it inside by moving the echo and I get the editor not showing but the following html code:

Code: Select all

	<div class="js-editor-tinymce"><textarea
	name="description"
	id="description"
	cols="20"
	rows="20"
	style="width: 400px; height: 400px;"
	class="mce_editable joomla-editor-tinymce"
	>
this is the content of description field in front end.

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest