Page 2 of 3 FirstFirst 123 LastLast
Results 11 to 20 of 21

Thread: Templatedir Help!

  1. #11
    Join Date
    Mar 2004
    Posts
    2,224

    Default Re: Templatedir Help!

    Quote Originally Posted by Dubbarob View Post
    Would the absence of "TemplateMissing=" from mail_options cause the template to be ignored?
    yes, formmail seems to reject the template if theres an error and any missing fields mean an error. Templatemissing fixes that.

    personally i think the behavior could be better....

    Russ: care to comment?

  2. #12
    Join Date
    Apr 2007
    Posts
    28

    Default Re: Templatedir Help!

    Quote Originally Posted by crabtree View Post
    yes, formmail seems to reject the template if theres an error and any missing fields mean an error. Templatemissing fixes that.

    personally i think the behavior could be better....

    Russ: care to comment?
    Wow, is that in the info for doing templates? I don't recall seeing it. I didn't add that in the beginning because I didn't know these consequences. Thank you.

  3. #13
    Join Date
    Dec 2003
    Posts
    3,980

    Default Re: Templatedir Help!

    Hi,

    personally i think the behavior could be better....

    Russ: care to comment?
    Yes, you're right. The template fails if any fields are missing, unless TemplateMissing is specified in mail_options.

    The template failure causes it to generate an error and for the template to be ignored.

    In hindsight, I think this was a bad design decision.

    I've slated an improvement for the next version of FormMail.

    The default operation for templates will be to allow a field to be missing without generating an error. This is backwards compatible and still allows you to set TemplateMissing to another value if you want.
    Russell Robinson - Author of Tectite FormMail and FormMailDecoder
    http://www.tectite.com/

  4. #14
    Join Date
    Dec 2003
    Posts
    3,980

    Default Re: Templatedir Help!

    Hi,

    Quote Originally Posted by Dubbarob View Post
    Wow, is that in the info for doing templates? I don't recall seeing it. I didn't add that in the beginning because I didn't know these consequences. Thank you.
    Yes, it's in the section called "Missing Fields" in the HOW TO guide:
    http://www.tectite.com/fmhowto/plaintmplt.php

    I might make some bad design decisions, but at least I document them.
    Russell Robinson - Author of Tectite FormMail and FormMailDecoder
    http://www.tectite.com/

  5. #15
    Join Date
    Feb 2009
    Posts
    4

    Unhappy Re: Templatedir Help!

    I am having a similar problem. I tried using $TEMPLATEDIR and $TEMPLATEURL and neither seem to work in getting PlainTemplate to work.

    I checked the DOCUMENT_ROOT using the alert test, and compared to what I set in $TEMPLATEDIR and all looks good. Are there any permission that need to be set on the template directory?

    Note: I'm using FormMail version 8.12.

  6. #16
    Join Date
    May 2008
    Posts
    1,291

    Default Re: Templatedir Help!

    Permissions are probably fine.

    Did you set TemplateMissing in mail_options? Any error messages sent to the address set in $DEF_ALERT?

    ginger

  7. #17
    Join Date
    Feb 2009
    Posts
    4

    Default Re: Templatedir Help!

    Yes, I have set TemplateMissing. I didn't at first, and thought that would solve it, but still no luck. Below are the various bits of info:

    Alert Check Gives me:

    DOCUMENT_ROOT: /home/ewer1852/public_html
    SCRIPT_FILENAME: /home/ewer1852/public_html/test/assets/php/formmail.php
    PATH_TRANSLATED: -not set-
    REAL_DOCUMENT_ROOT: /home/ewer1852/public_html

    In formmail.php I have:

    $TEMPLATEDIR = "/home/ewer1852/public_html/assets/templates";


    Below is my form:

    <form id="contact_us" method="post" action="assets/php/formmail.php">
    <input type="hidden" name="env_report" value="REMOTE_HOST,REMOTE_ADDR,HTTP_USER_AGENT,AUTH_TYPE,REMOTE_USER" />
    <input type="hidden" name="recipients" value="info22*22ewert-technologies.ca" />
    <input type="hidden" name="required" value="email:Your email address,realname:Your name" />
    <input type="hidden" name="mail_options" value="PlainTemplate=plain.txt,TemplateMissing=" />
    <input type="hidden" name="good_url" value="http://www.ewert-technologies.ca/contact_us_succeed.html" />
    <input type="hidden" name="logfile" value="formmail.log" />
    <table class="form_table">
    <tr>
    <td>Your Name:<span class="required">*</span></td>
    <td><input type="text" name="realname" size="40" maxlength="40" /> </td>
    </tr>
    <tr>
    <td>Email Address:<span class="required">*</span></td>
    <td><input type="text" name="email" size="40" maxlength="40" /></td>
    </tr>
    <tr>
    <td>Subject:<span class="required">*</span></td>
    <td><input type="text" name="subject" size="40" maxlength="40" /></td>
    </tr>
    <tr>
    <td>Your Message:</td>
    <td><textarea name="mesg" rows="4" cols="40"</textarea></td>
    </tr>
    <tr>
    <td />
    <td><input type="submit" value="Submit" /></td>
    </tr>
    </table>
    </form>
    My plain.txt template is as follows:

    Name: $realname
    Email Address: $email
    Subject: $subject
    Message: $mesg


    I'm thinking the problem lies in TEMPLATEDIR not be found, although it did a test, and set

    $LOGDIR = "/home/ewer1852/logs";

    and then set up a log name in the form, and that works fine.

  8. #18
    Join Date
    Feb 2009
    Posts
    4

    Default Re: Templatedir Help!

    OK, I've been playing around a little. I have now set up good_template, and created an html template that contains $realname. I placed this template html into the same location as I have put the email template.

    I gave this a try, and it works. This tells me that TEMPLATEDIR, is working! So, that seems to narrow it down to either the input field in in form is incorrect, or there is a problem with my plain.txt template.

    I've looked at both of them, and can't spot an error. Does the template text file, have any encoding or line ending issues? Currently it is encoded in ANSI and I have used both UNIX and WINDOWS line endings, with no luck.

  9. #19
    Join Date
    May 2008
    Posts
    1,291

    Default Re: Templatedir Help!

    This might be one of those issues where it's not working since the only fields you have are email and realname. There are threads in the forums about problems with forms that only have the email and realname fields. Try entering something in the message field as well. However, you'll first need to edit your plain.txt template because it only has $email and $realname in it.

    ginger

  10. #20
    Join Date
    Feb 2009
    Posts
    4

    Smile Re: Templatedir Help!

    Ah, yes, I think that solved it. I added an extra 'dummy' hidden field to my form as follows:

    <input type="hidden" name="form_name" value="contact_us" />

    and then included $form_name into plain.txt and that seemed to do the trick.

    So basically, in order to get the template to work, your template must include at least one field other than $realname, $email, $subject and $mesg.

    Thank-you so much for your help!

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Defining your TEMPLATEDIR path with Godaddy (Linux)
    By JacobF in forum HOWTO Guides and Tips
    Replies: 0
    Last Post: 02-May-2008, 02:19 AM
  2. No email delivery after $TEMPLATEDIR config
    By gofreeserve in forum Community Support
    Replies: 1
    Last Post: 08-Jan-2008, 07:02 AM
  3. Templatedir
    By cesar in forum FormMail Subscription Support
    Replies: 2
    Last Post: 14-Jun-2006, 10:32 PM
  4. error using $templatedir
    By smartie91 in forum Community Support
    Replies: 13
    Last Post: 11-Apr-2006, 03:49 PM

Bookmarks

Posting Permissions

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