Home · sNews Development · [mod] Text Direction Update

CMS-ZEN.COM

online web development :: art and design :: fun stuff
best budd
Home •sNews Development cms road trip PHP Scripts Photoshop Guides Css Guides Music and video clips Art Gallery Low Light Photography Impression Photography

sNews 17 released

NEW: sNewsCMS v1.7 Release has been made available for download.
Get it while it's hot!

[mod] Text Direction Update

rtl
just a small JS addon i use, for changing elements direction on the fly this is an upgrade to the one i posted for 1.5 can change direction for any element #id.

can be added in index.php within the head tags, or added to the JS function in snews.php



ADD the JS PART // TOGGLE DIRECTION FOR ELEMENTS ID //
function dircng(drc) {
var dr = document.getElementById(drc);
var dc = dr.style.direction;
if(dc=='ltr') {
dr.style.direction = 'rtl';
} else if (dc=='rtl') {
dr.style.direction = 'ltr';
} else if (dc=='') {
dr.style.direction = 'ltr';
} }
//#######################//

 

   <?php

    
# OPTIONAL USE:
    # for snews text editor:
    # in snews.php
    # find function form_articles

    # Code:
    
    
echo html_input('textarea''text''txt'$frm_textl('text'), '''''''''''2''100''''''');
    echo 
'<p>';


    
# ADD after the opening P tag
    # Code:
    
echo html_input('button''dirt''''DIR''''button''onclick="dircng('txt')"''''''''''''''''');

?>  

 

can change other elements by adding:

	onclick="dircng('ELEMENT #ID')" 
         to any toggler element you want 
         ( P, H1-6 span, div, etc...)

 

 

e.g: use in index.php
toggler element - add style="cursor: pointer;" onclick="dircng('mydiv')"
- >    will change the content direction for Div with id=mydiv
target div - add id=mydiv
	

 

22.04.2008. 12:20

This article hasn't been commented yet.

Write a comment

* = required field

:

:

:


4 + 2 =