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 8570305
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T18:31:41+00:00 2026-06-11T18:31:41+00:00

I am designing a Mail Template editor in my application. I need an idea

  • 0

I am designing a Mail Template editor in my application. I need an idea to find the occurance of specific variables to be able to convert them using preg_replace or preg_match in my code.

For example, my template looks like this: (Sample only) this is what is returned from the textarea variable.

<p>Thank you for your order at <a href="{site_url}" style="color:#ea6ea0">{site_name}</a>.</p>

In this example, I would like to replace the {site_url} with a specific variable or code from PHP since I can’t parse PHP directly into the textarea.

Hope my question was clear, any help appreciated.

Edit: Is my question clear? I need to replace the {} strings using my own php code. The php code cann’t be used in textarea directly. That is why i need to find a templating system that replace predefined variables {… } but convert them using php when interpreting the template.

  • 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-11T18:31:42+00:00Added an answer on June 11, 2026 at 6:31 pm

    Do you mean something like this?

    <p>Thank you for your order at <a href="<?=$site_url?>" style="color:#ea6ea0"><?=$site_name?></a>.</p>
    

    or

    <p>Thank you for your order at <a href="<?php echo $site_url?>" style="color:#ea6ea0"><?php echo $site_name?></a>.</p>
    

    edited:

    Ahhh, do you mean something like this then:

    $html = '<p>Thank you for your order at <a href="{site_url}" style="color:#ea6ea0">{site_name}</a>.</p>';
    
    $php_variables_array = array(
      "site_url" => "http://www.google.co.uk",
      "site_name" => "Google",
    );
    
    foreach ($php_variables_array as $key => $value)
    {
      $html = str_replace("{" . $key . "}", $value, $html);
    }
    
    echo $html;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am designing a database structure for a mail list The data i need
Designing a generative music system for iOS, using OpenFrameworks, I'd need to provide a
Designing forms has always been fun, but getting them to send email on the
Im designing a website, and often I need to present information in a nice
While designing a new WPF application I noticed exceptions not being thrown during data
When designing an distributed application in Java there seem to be a few technologies
for designing purposes i need to truncate all DB which has lots of FK's.
I designing an programming a website using Symfony2. I completed some parts and checked
Is designing for Google Tv is different from tablet. What should I need to
Im designing a dialerPad form using Windows form, there is a textbox which should

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.