Results 1 to 2 of 2

Thread: [RESOLVED] Inserting PHP variables into imported HTML template

  1. #1
    Join Date
    Dec 2013
    Melbourne, Australia

    resolved [RESOLVED] Inserting PHP variables into imported HTML template

    Not sure if this is possible but I will give an overview of what I'm trying to achieve.

    I am building a notification email - basically it is just going to send a notification email to the administrator indicating whether the process was successful or unsuccessful.

    The email is the same every time except I will change the following values:
    - Customer Name
    - File Name
    - File Details
    - Time of Day

    What I was hoping to do was build the HTML template and simply include it in the PHP class, replacing the place holder with the actual variable information I generate when processing a file.

    Is this possible or will it require a custom built script to do a find and replace?

  2. #2
    Join Date
    Aug 2004
    I would just make the template PHP code itself.
    PHP Code:
    function getEmailText($custName$fileName$fileDetails$time)
    $text = <<<EOD
    Blah blah blah $custName.

    Yadda yadda 
    $fileName yadda $fileDetails yadda yadda.

    Et cetera, et cetera, and so forth at 

    The end.

    Then just call that function in your email script wherever you need that text, supplying the 4 parameters that change for each message.
    "Well done....Consciousness to sarcasm in five seconds!" ~ Terry Pratchett, Night Watch

    How to Ask Questions the Smart Way (not affiliated with this site, but well worth reading)

    My Blog
    cwrBlog: simple, no-database PHP blogging framework

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center