Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8009423
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T18:26:45+00:00 2026-06-04T18:26:45+00:00

i was programming a mail templatingsystem. The user should be able to use markers

  • 0

i was programming a mail templatingsystem. The user should be able to use markers in there, they will be replaced by the actual data. The problem ist, my function to replace the markers works just fine, but i need to do a recursiv call of that function, that will only run once, and this is what i came up with:

public function replace_placeholders($content, $recipient, $settings, $interface, $recommendation, $format, $recursion = false) {
    $content = $this->replace_ph('briefanrede'  , $recipient['id']          , $content);
    $content = $this->replace_ph('anrede'       , $recipient['title']       , $content);
    $content = $this->replace_ph('email'        , $recipient['email']       , $content);
    $content = $this->replace_ph('kundennummer' , $recipient['kdnumber']    , $content);
    $content = $this->replace_ph('briefanrede'  , $recipient['briefanrede'] , $content);

    if($recipient['title'] == $settings['anrede_w'] || $recipient['title'] == $settings['anrede_m']) {
        $content = $this->replace_ph('vorname'  , $recipient['forename']    , $content);
        $content = $this->replace_ph('nachname' , $recipient['surename']    , $content);
    } else {
        $content = $this->replace_ph('vorname'  , ""    , $content, true);
        $content = $this->replace_ph('nachname' , ""    , $content, true);
    }

    $content = $this->replace_salutation($recipient, $settings, $content);

    //Recommendation    
    if($this->need_replacement($content, 'weiterempfehlung') === false && $recursion === false) {
        if($recommendation['own_page'] == 1) {
            $baseurl = $recommendation['location'];
        }  else {
            $baseurl = $recommendation['link'];
        }
        $pattern = ($format == "html") ? '<a href="%s">%s</a>' : '%s';
        $url = $this->replace_placeholders($baseurl, $recipient, $settings, $interface, $recommendation, true);
        $content = $this->replace_ph('weiterempfehlung' , (($format == "html") ? sprintf($pattern, $url, $settings['text_weiterempfehlung']): sprinf($pattern, $url)), $content);

    }

    return $content;
}

The recursiv call in this line

$url = $this->replace_placeholders($baseurl, $recipient, $settings, $interface, $recommendation, true);

is causing a 500 internal server error. I dont know why, because i think that i limited the recursion to run once. Can you help me out?

Sorry for my bad english i try hard to write clear sentences.

//EDIT:

Apache log:

[Wed May 30 15:31:56 2012] [warn] [client xx.xxx.xx.xxx] (104)Connection reset by peer: mod_fcgid: error reading data from FastCGI server
[Wed May 30 15:31:56 2012] [warn] [client xx.xxx.xx.xxx] (104)Connection reset by peer: mod_fcgid: ap_pass_brigade failed in handle_request_ipc function
[Wed May 30 15:31:56 2012] [error] [client xx.xxx.xx.xxx] File does not exist: /var/www/web80/html/web80-newsletter/favicon.ico
[Wed May 30 15:31:58 2012] [error] mod_fcgid: process /var/www/php-fcgi/web80.php53/php-fcgi(21975) exit(communication error), get unexpected signal 11 

the php errorlog is empty.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T18:26:48+00:00Added an answer on June 4, 2026 at 6:26 pm

    It would seem you miss one argument in your recursive call, making the $recursive = false continue being false all the time, which in turn makes your if statement

    if($this->need_replacement($content, 'weiterempfehlung') === false && $recursion === false)
    

    always return true.
    Try adding one last variable to your recursive call instead and you should be able to properly execute your script, ie:

    $url = $this->replace_placeholders($baseurl, $recipient, $settings, $interface, 
    $recommendation, true, true);
                         ^ added one true
    

    What i think you want to add instead of the first true is $format.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I would like to use Calendar by programming in honeycomb emulator. However, there is
In iPhone programming, there are two ways to send mail. 1. openURL 2. In-App
I am programming something like e-mail for my users. I want to allow people
When programming for the iPhone, I find that I often need to use the
Programming novice here. I'm trying to allow a user to enter their name, firstName
I recently integrated base64-encoded embedded images as attachments for an e-mail system I'm programming
I am trying to add alert for loging user using programming. It is giving
I need a db to store, i.e. user records. Regular stuff: name, e-mail, address,
Programming with C++, once we get the context device by GetDC to use. What
Programming language: Ruby 1.9 Problem String: C:/Test/blah.txt to C:/Test/ I know it's an easy

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.