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: Diacritics script  (Read 1470 times)

marcos

  • Guest
Diacritics script
« on: November 02, 2007, 04:25:54 am »

Hello.

I am wondering how can i insert a "diacritics help section/characters" for admin fields like: TITLE and TEXT

For example:

Code: [Select]
<form action="">
<textarea id="tf"></textarea>
<input type="button" value="&#258;" onClick="javascript:document.getElementById('tf').value=document.getElementById('tf').value+'&#258;';">
<input type="button" value="&#259;" onClick="javascript:document.getElementById('tf').value=document.getElementById('tf').value+'&#259;';">
<input type="button" value="&#260;" onClick="javascript:document.getElementById('tf').value=document.getElementById('tf').value+'&#260;';">
</form>

So this characters with diacritics can appear next to the TITLE and TEXT fields in the admin panel. So when the editor needs to enter such a character, he just click on the desired character and it's ok.
Logged

Keyrocks

  • Doug
  • ULTIMATE member
  • ******
  • Karma: 449
  • Posts: 6020
  • Semantically Challenged
    • snews.ca
Re: Diacritics script
« Reply #1 on: November 02, 2007, 01:43:28 pm »

The standard, default issue of sNews 1.6 provides a set of Editor buttons under the main content textarea. They insert HTML tags for bold text, italic text and strike-through text, as well as tag-sets to wrap a paragrah, do a line-return, create a break-point, create an image file-path, create a hyperlink, and for including a file. The strings for these are all located within the // ARTICLES FORM function in the snews.php file. In a 'virgin' snews.php file, they begin around line # 1310.

For each Editor function button, sNews provides a tag generator, and these are all located in function tag(tag) which is in the javascript function group at the end of snews.php, which begins around line # 1936. This function contains a switch script, and within it a case statement-set for each of the editor buttons.

So... to insert anything into the main textarea with a button, we create a new button string in the articles form, and we create a new case statement-set within the tag function to go with it. Cicking the button activates the tag generator and inserts what it generates.

However, this system will only insert tags (content) into the main content text area. It will not insert anything into the title field.

If I wanted a character insertion script, I would probably want to have it as an addon. I would then try creating new functions, using the ones currently used by sNews, that would specifically generate those characters and insert them into the main textarea. I am not sure how we would go about making it insert characters into the title field as well... that would take some serious exploration... and I am not sure how that would affect the auto-generation of the SEF title... which must be structured only with lower-case text with words separated by hyphens with no spaces.

Logged
Do it now... later may not come.
-------------------------------------------------------------------------------------------------
sNews 1.6 MESU | sNews 1.6 MEMU

marcos

  • Guest
Re: Diacritics script
« Reply #2 on: November 05, 2007, 02:55:49 am »

Thank you Keyrocks!

I saw on some sites where webmasters have used diacritics in the titles, the letters with diacritics have been lost in the sef titles :|

I just wonder if someone know more about .htaccess files, if diacritic letter rules can be added here?
Logged