lukgoh |
|
---|---|
Hey guys! I'm writing a new module for my website and it requires user input via the text editor (I am using CKEditor) the text it outputs shows html, for example <p> the paragraph tags. I was wondering how to fix this. Thanks in advance, Luke. |
ez |
|
---|---|
You cannot this is default ck.... I think you can prevent it using shift enter in stead of enter this thing really bugs me too, i always tend to edit in pure html when ck is used but other less skillfull users cannot do this, i never give my clients ck unless they really really ask for it ==- I say: Keep it EZ -==
|
lukgoh |
|
---|---|
Yeah, I couldnt get the other editors working at all for some reason. Followed all the instructions but CKEditor is the only one that will work. I guess I want to use it exactly how it used in the forums here, just not for the forums. Added 1 minute later: I am assigning it to a tag by the way, like this: cot_textarea('jobs_info', $form['jobs_info'], 24, 120, '', 'input_textarea_editor'), |
Trustmaster |
|
---|---|
If the problem is that it shows you page source after you submit it, it might be because of 2 things. First, make sure you allow HTML upon variable import, so use HTM filter instead of TXT: $form['jobs_info'] = cot_import('jobs_info', 'P', 'HTM'); Then, make sure you don't apply htmlspecialchars to it. So the output is something like this: 'MY_TEXT' => cot_parse($form['jobs_info']), About the editor selection question, that is done by site administrator, not by user. Administrator picks a default parser and associates an editor with it. It is Cotonti's duty then to display that editor in modules. You can use a different parser in your module though, that is achieved by setting $sys['parser'] variable and passing it as a 3rd parameter to cot_parse(). May the Source be with you!
|
|
This post was edited by Trustmaster (2012-01-26 06:34, 13 years ago) |
lukgoh |
|
---|---|
Thank you Trustmaster, seems to of fixed it! I have another question, about how Cotonti uploads files to the avatar folder. I need something similar for my module. I am trying to see how I can upload images to a certain folder the same way Cotonti does. I have been looking through the core files but I cant seem to find where this happens. Luke. |
Trustmaster |
|
---|---|
That's in userimages.profile.update.php May the Source be with you!
|
lukgoh |
|
---|---|
Was looking in completely the wrong place, thanks once again Trustmaster. Added 5 minutes later: Although, this is a little over my head as I am knew to php, everything I have learnt so far is from backwards engineering what I can understand from the core files... |
|
This post was edited by lukgoh (2012-01-26 13:47, 13 years ago) |
Trustmaster |
|
---|---|
Basicly it's just old plain PHP file uploads. May the Source be with you!
|
lukgoh |
|
---|---|
Oh, okay and then checks to make sure the uploaded file is supported as an image file? |
Trustmaster |
|
---|---|
This piece of code checks file extension, runs cot_file_check() to check if file contents is secure and uses cot_safename() to generate safe filename for storage: $gd_supported = array('jpg', 'jpeg', 'png', 'gif'); $file_ext = strtolower(end(explode(".", $file['name']))); $fcheck = cot_file_check($file['tmp_name'], $file['name'], $file_ext); if(in_array($file_ext, $gd_supported) && $fcheck == 1) { $file['name']= cot_safename($file['name'], true); $filename_full = $usr['id'].'-'.strtolower($file['name']); May the Source be with you!
|
lukgoh |
|
---|---|
I have a new question: I am trying to set a start and end date for a page in my custom module (not an actual page in the page module). To set the date the page is submitted I am using this: (int)$sys['now'] which is working just fine. What I would like to know is how to automatically add 1 week to that value and set it as the end date? Thanks, Luke. Added 8 minutes later: Is this a safe method: 604800 + time() |
|
This post was edited by lukgoh (2012-02-02 19:28, 13 years ago) |
Xerora |
|
---|---|
Yup, that's exactly it |
lukgoh |
|
---|---|
Thanks Xerora! |