Page 1 of 2

[solved]Front end editor

Posted: 06 Oct 2017, 08:59
by roberto.c87
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?

Re: Front end editor

Posted: 06 Oct 2017, 09:47
by roberto.c87
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?

Re: Front end editor

Posted: 06 Oct 2017, 16:21
by Jan
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

Re: Front end editor

Posted: 09 Oct 2017, 07:21
by roberto.c87
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?

Re: Front end editor

Posted: 12 Oct 2017, 15:06
by Jan
Hi, see:
components\com_phocadownload\views\user\view.html.php
components\com_phocadownload\views\user\tmpl

Jan

Re: Front end editor

Posted: 13 Oct 2017, 09:05
by roberto.c87
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?

Re: Front end editor

Posted: 13 Oct 2017, 10:04
by roberto.c87
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

Re: Front end editor

Posted: 13 Oct 2017, 14:55
by Jan
Hi, maybe your template override the component output, try to check your template if it does not override component output :idea:

Jan

Re: Front end editor

Posted: 25 Oct 2017, 15:11
by roberto.c87
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?

Re: Front end editor

Posted: 25 Oct 2017, 16:48
by roberto.c87
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.