hello,

i'm working on drupal to prepare a website for a literature magazine. i have a few questions to ask:

1. we add poems, but as you know some line of poems has many spaces in front of them. in our old page we used to use this functions for making spaces:

function forma_poem($cumle)
{
// $cumle=str_replace("\t","   ",str_replace(" "," ",$cumle));
$cumle=str_replace("\n","
",$cumle);
$cumle=wordwrap($cumle);
$cumle=str_replace(" "," ",$cumle);
$cumle=str_replace("img src","img src",$cumle);
$cumle=str_replace("\t","   ",$cumle);
// $cumle=wordwrap($cumle,10);
return $cumle;
}

function forma_story($cumle)
{
$cumle=str_replace(" ","     ",$cumle);
$cumle=str_replace("\n","
",$cumle);
$cumle=str_replace(" ","     ",$cumle);
return $cumle;
}

I can add this &nbsp instead of tabs and spaces but most of our users don't know html. how can i use this function for nodes? is it related with filters? and also is there a chance to add a checkbox while writing a node to use this function/filter? i need this function in only a few nodes.

2. when i add a book node, if i don't use html on it, it makes auto-breaks. but if i use any tags i must add < br / > to all node. is it possible for auto-breaks in html too? and if you see all node (show more) line breaks can be see if you don't use text, but in summery it doesn't uses auto-breaks. is this things enabled in themes?

3. and turkish users of drupal can share their translations?

thank you so much for your great work.

best regars,
vedat kamer

Comments

Kjartan’s picture

Yes, this would be filter related. You need to either add it to an existing _filter hook, or make your own module. For example poem.module, and put it in your modules directory in your Drupal installation. It would look something like:

function poem_filter($text) {
// Your code here

  return $text;
}

It is possible to make a checkbox for this using the _nodeapi() hook.

--

Kjartan

JonBob’s picture

Alternately, instead of adding a checkbox for whether to apply a filter, you could make a new node module (say poem.module) that defines a poem as a node type, and do the transformation on all nodes of that type in poem_view.