Please login or register.

Login with username, password and session length
Advanced search  

News:

You need/want an older version of sNews ? Download an older/unsupported version here.

Author Topic: Textarea class  (Read 2577 times)

ens

  • Sr. Member
  • ****
  • Karma: 12
  • Posts: 279
    • http://www.meatysite.info
Textarea class
« on: June 22, 2007, 12:56:45 am »

Hey

How do I change/add a class name of the textarea in the admin section (article/page editor)?

For example, adding class="namehere"

Thanks guys.
Logged

Keyrocks

  • Doug
  • ULTIMATE member
  • ******
  • Karma: 449
  • Posts: 6020
  • Semantically Challenged
    • snews.ca
Textarea class
« Reply #1 on: June 22, 2007, 03:56:33 am »

Looking through the Mods & Addons forums really helps... Here ya are.
Logged
Do it now... later may not come.
-------------------------------------------------------------------------------------------------
sNews 1.6 MESU | sNews 1.6 MEMU

ens

  • Sr. Member
  • ****
  • Karma: 12
  • Posts: 279
    • http://www.meatysite.info
Textarea class
« Reply #2 on: June 22, 2007, 04:07:02 am »

Thanks, I didnt think to look there. That will take my exisitng textarea and add a division name to it? Oh.
Logged

Keyrocks

  • Doug
  • ULTIMATE member
  • ******
  • Karma: 449
  • Posts: 6020
  • Semantically Challenged
    • snews.ca
Textarea class
« Reply #3 on: June 22, 2007, 04:16:52 am »

You can create any number of special purpose buttons to wrap text with tags. If you look closely, you will see that each of the 3 strings that create the buttons... and their corresponding case string-sets... follow a certain structure. Basically, once you have created a style declaration in your .css stylesheet for something, you can then create a button and case string-set to wrap whatever tags you want around the text in the textarea.

As an example... you can also use this method to generate a larger block of HTML code and have pop-up prompts that tell you what to put in so it will display within the HTML block. See the bottom half of this post - Additional Editor Functions.
Logged
Do it now... later may not come.
-------------------------------------------------------------------------------------------------
sNews 1.6 MESU | sNews 1.6 MEMU

ens

  • Sr. Member
  • ****
  • Karma: 12
  • Posts: 279
    • http://www.meatysite.info
Textarea class
« Reply #4 on: June 22, 2007, 01:17:35 pm »

Quote from: keyrocksaround
the text in the textarea.
Ah, but I want to wrap the textarea itself in a tag, so that it may be changed to however I see fit. What I really want to do is by giving it a div class, an included javascript file will transform that, and only that, textarea into a wysiwyg editor. Is that what you're saying or am I missing something?
Logged

Keyrocks

  • Doug
  • ULTIMATE member
  • ******
  • Karma: 449
  • Posts: 6020
  • Semantically Challenged
    • snews.ca
Textarea class
« Reply #5 on: June 22, 2007, 02:47:27 pm »

Styling the Textareas Themselves:
Layout of the forms elements are somewhat controlled in the // FORM GENERATOR function, which starts around line 1120 in the snews.php file of sNews 1.6. Several lines down in the function...  (about 11)... you'll see the line that starts a set of case strings within a switch-group - switch($type). Scroll down to the last "case" string in the function - case 'textarea': and, as you can see by the red-colored parts below, most of the string is wrapped in

-tags.

Quote
case 'textarea': $output = '

'.$lbl.':

'; break;
Now... if you want to change styling that affects the textarea only, you can change the style declaration applied to textareas in the default style.css file, which is:
Quote
textarea { width: 90%; height: 20em; padding: 3px;}
Just keep in mind that the above only applies to the textarea itself... not the content you put into it.

Styling content within textareas:
This only applies within textareas that have Editor buttons under them... the ones in the Admin Panels. I refer you again to my post above. If you want to style all of the content within the textarea... from the first word to the last... all you need to do is create a new Editor button that generates the division class tag you want applied. Then you highlight everything in the textarea, click the button, and the tags get added to the start and end of the highlighted block. Then you save it and the styling will apply as you have applied it.

I hope this makes sense for you.
Logged
Do it now... later may not come.
-------------------------------------------------------------------------------------------------
sNews 1.6 MESU | sNews 1.6 MEMU

ens

  • Sr. Member
  • ****
  • Karma: 12
  • Posts: 279
    • http://www.meatysite.info
Textarea class
« Reply #6 on: June 22, 2007, 11:09:50 pm »

Keyrocks,

I don't believe you understand me fully, but I think I've found my answer in this post: http://www.solucija.com/forum/viewtopic.php?pid=14820#p14820
I have done what it says, (to the first textarea in the //ARTICLES FORM function... see the red
Quote
echo html_input('textarea', 'text', 'txt', $frm_text, l('text'), 'classname', '', '', '', '', '2', '100', '', '', '');
) and it works, but the textarea is now non-usable (text will not appear in the box, or will not be posted when the article is submitted. Any reason?

Lastly, please excuse my incompetence as I have no experience whatsoever in php, but I am learning slowly.
Logged