Is there a simple placeholder functionality?

Get help with installation and running phpwcms here. Please do not post bug reports or feature requests here.
Post Reply
lupo
Posts: 10
Joined: Mon 5. Dec 2005, 12:26
Location: Brugg, Switzerland

Is there a simple placeholder functionality?

Post by lupo »

On my website are references to names or email addresses. Unfortunately, these data are changing often and it's annoying to search for all occurances and change them.
Thus, I would like to work with placeholders and use just a symbolic name in the article text like e.g.
{email_address(Peter Muster)}
Is there a simple solution for that?

btw.: thanks to all the persons that give so much answers in this forum!

----

Auf meiner Website sind Namen und eMail Adressen von Personen erwähnt. Leider wechseln diese Daten oft und es ist mühsam, diese in allen Seiten zu suchen und anzupassen.
Ich würde deshalb gerne mit Platzhaltern arbeiten, so dass im Artikeltext nur der symbolische Name, z.B.
{email_address:(Peter Muster)}
erscheint. Gibt es hier eine einfache Lösung?

An dieser Stelle übrigens mal ein herzliches Dankeschön für diejenigen, die fast keine Frage in diesem Forum unbeantwortet lassen!
lupo
Posts: 10
Joined: Mon 5. Dec 2005, 12:26
Location: Brugg, Switzerland

Post by lupo »

Neelix solved my problem:

A little script in ...\phpwcms_template\inc_script\frontend_render\ does the work (qtrans.php)

Code: Select all

<?php

/* quick trans: v0.002 (original by neelix) */ 
function getQTrans($sWhat="") 
{ 
/* 
   example: {QTrans:mail_abc} => a.bc@luspix.ch 
*/
 
   $aRealAddi=array('mail_abc'  => 'a.bc@luspix.ch',
                    'mail_def'  => 'de.f@aargaufire.ch',
                    'mail_hij'  => 'hij@fwbrugg.ch'); 

   return $aRealAddi[$sWhat]; 
} 

if (!strpos($content['all'],'{QTrans:')===false) 
{ 
   $content['all'] = preg_replace('/\{QTrans:(\w+)\}/ie', 'getQTrans("$1")', $content['all']); 
}
?>
Thanks, Neelix! :D
Pappnase

Post by Pappnase »

hallo

wäre es nicht sogar möglich auf ein kontaktformular zu verlinken. ;-) man müßte zwar für jede mail addy in forumalr anlegen aber das wäre ja nicht das schlimmste! :-)
Post Reply