custom RT for german and french quotes

Post custom hacks and enhancements for phpwcms here only. Maybe some of these things will be included in official release later.
Post Reply
User avatar
Cipolla
Posts: 451
Joined: Sat 16. Feb 2008, 20:39
Location: Muppet Show

custom RT for german and french quotes

Post by Cipolla »

Hi!

a customer of mine wanted all normal "quotes" shown as »french« quotes. There are many quotes in the site!

So i wrote a small hack to replace all quotes with the french or the german version. Maybe this is usefull.

The french version:

Code: Select all

<?php
// ==========================================================
// Replace normal quotes with »french« quotes (V 1.0)
// Klaus Winkler alias [Cipolla] http://www.empics24.de

// Create a file like "french_quotes.php" with this script and put it in the
// frontend_render folder
// ==========================================================

// ----------------------------------------------------------------
// obligate check for phpwcms constants
if (!defined('PHPWCMS_ROOT')) {
   die("You Cannot Access This Script Directly, Have a Nice Day.");
}
// ----------------------------------------------------------------

// Replace left quotes after a ending tag
  $content["all"] = str_replace('>"','>&raquo;', $content["all"]);
  
  
// Replace left quotes inside text
  $content["all"] = str_replace(' "',' &raquo;', $content["all"]);
  
  
// Replace right quotes before new tag
  $content["all"] = str_replace('"<','&laquo;<', $content["all"]);
  
  
// Replace right quotes inside text
  $content["all"] = str_replace('" ','&laquo; ', $content["all"]);

?>
The german version:

Code: Select all

<?php
// ==========================================================
// Replace normal quotes with „german“ quotes (V 1.0)
// Klaus Winkler alias [Cipolla] http://www.empics24.de

// Create a file like "german_quotes.php" with this script and put it in the
// frontend_render folder
// ==========================================================

// ----------------------------------------------------------------
// obligate check for phpwcms constants
if (!defined('PHPWCMS_ROOT')) {
   die("You Cannot Access This Script Directly, Have a Nice Day.");
}
// ----------------------------------------------------------------

// Replace left quotes after a ending tag
  $content["all"] = str_replace('>"','>&#132;', $content["all"]);
  
  
// Replace left quotes inside text
  $content["all"] = str_replace(' "',' &#132;', $content["all"]);
  
  
// Replace right quotes before new tag
  $content["all"] = str_replace('"<','&#147;<', $content["all"]);
  
  
// Replace right quotes inside text
  $content["all"] = str_replace('" ','&#147; ', $content["all"]);


?>
Last edited by Cipolla on Wed 14. May 2008, 19:08, edited 1 time in total.
...
User avatar
flip-flop
Moderator
Posts: 8178
Joined: Sat 21. May 2005, 21:25
Location: HAMM (Germany)
Contact:

Re: Hack for german and french quotes

Post by flip-flop »

Very fine work, but it isn´t a hack, it´s a regular custom RT.

Knut :D
>> HowTo | DOCU | FAQ | TEMPLATES/DOCS << ( SITE )
User avatar
Cipolla
Posts: 451
Joined: Sat 16. Feb 2008, 20:39
Location: Muppet Show

Re: Hack for german and french quotes

Post by Cipolla »

hello knut,

thanks for the flowers :D
Very fine work, but it isn´t a hack, it´s a regular custom RT.
i thought the definiton of an RT is ReplacementTAG and i did not write a tag like {FRENCH_QUOTE} but only a frontend render script.

Is it better to change the title to custom RT?
...
User avatar
flip-flop
Moderator
Posts: 8178
Joined: Sat 21. May 2005, 21:25
Location: HAMM (Germany)
Contact:

Re: Hack for german and french quotes

Post by flip-flop »

Is it better to change the title to custom RT?
YES, absolutely.
It is definitely no hack (We named a snippet "hack" if there is a core change). :D
>> HowTo | DOCU | FAQ | TEMPLATES/DOCS << ( SITE )
User avatar
Jensensen
Posts: 3000
Joined: Tue 17. Oct 2006, 21:11
Location: auf der mlauer

Re: custom RT for german and french quotes

Post by Jensensen »

[x]
{so_much} | Knick-Knack. | GitHub
Umlaute im URL sind meistens immer Kacke.
Post Reply