4images Forum & Community

General / Allgemeines => Programming => Topic started by: Peaces on June 02, 2009, 04:31:35 PM

Title: Add Contact Page
Post by: Peaces on June 02, 2009, 04:31:35 PM
I have read through the posts and watched the video as to creating a new Template page. I have successfully done so. I am wanting to make that additional page into a Contact page. The Contact scripting that I have requires the page to be .php.

When I create the new Template page it is .html. I have tried pasting the form contents from the Contact script into the html Template page but this obviously does not work.

Any suggestions as to how I need to make this work? Or other suggestions for creating a Contact page that has spam security and not use the one I have?

I am open to any suggestions.
Title: Re: Add Contact Page
Post by: V@no on June 02, 2009, 04:44:24 PM
.php file can contain HTML, as long as it's outside <?php and ?> tags.
i.e.

Code: [Select]
<head>
  <title>mixed html with php</title
</head>
<body>
  <div>pure html output</div>
  <div>
<?php
    
echo "and some php output";
?>

  </div>
</body>
Title: Re: Add Contact Page
Post by: bergblume on June 02, 2009, 04:45:46 PM
hi,

yes, your templates are in .html - but you have to call these site via ./index.php?template=YOURSITENAME  (e.g. index.php?template=contact)

BR, bergblume
Title: Re: Add Contact Page
Post by: Peaces on June 02, 2009, 04:50:22 PM
Thanks!

Now off to give it a try....
Title: Re: Add Contact Page
Post by: Peaces on June 02, 2009, 05:30:29 PM
Sorry for the immaturity here.

I have created a contact.php  -  I have created a contact.html (Template)
The contact.php does call the Template and views properly.

Do I apply the Contact Form script to the Template page or the .php page?

I have tried applying the script to either page. When I apply it to the .html, the form works but it takes away the fonts and other formatting from the Template. When applying to the .php page, I get a Fatal error for the line I added the Form script.

Here is the Form script.

Code: [Select]
<form action="" method="post" name="emailContact" onsubmit="WAValidateRQ(document.emailContact.Contact_Name,'- Please enter your name',document.emailContact.Contact_Name,0,false,'text');WAValidateEM(document.emailContact.Email_address,document.emailContact.Email_address.value,'- Please enter your email address',document.emailContact.Email_address,0,true);WAValidateRQ(document.emailContact.Comments,'- Please provide a comment so that we know how best to assist you',document.emailContact.Comments,0,true,'textarea');WAValidateRQ(document.emailContact.Security_code,'- Please enter the text as it appears in the image above',document.emailContact.Security_code,0,false,'text');WAValidateRQ(document.emailContact.Security_question,'- Please answer the question to ensure a human is filling out this form.',document.emailContact.Security_question,0,false,'text');WAAlertErrors('The following errors were found','Correct invalid entries to continue',true,false);return document.MM_returnValue">
        <div style="width:100%">
          <label for="Contact_Name" >Your name:</label>
          <br />
          <input name="Contact_Name" type="text" id="Contact_Name" class="inputValue" value="<?php echo(ValidatedField("contact","Contact_Name")) ?>" />
          <input name="addblock" type="text" id="addblock" style="display:none" value="" />
          <br />
            <?php
if (ValidatedField("contact","contact"))  {
  if ((
strpos((",".ValidatedField("contact","contact").","), "," "1" ",") !== false || "1" == ""))  {
    if (!(
false))  {
?>

             
          <p class="emailFormError">* Please provide your name.</p>
          <?php //WAFV_Conditional contact.php contact(1:)
    
}
  }
}
?>

          <br />
          <label for="Email_address" >E-mail address:</label>
          <br />
          <input name="Email_address" type="text" class="inputValue" id="Email_address" value="<?php echo(ValidatedField("contact","Email_address")) ?>" />
          <input name="seconddblock" id="seconddblock" type="text" style="display:none" value="">
          <br />
            <?php
if (ValidatedField("contact","contact"))  {
  if ((
strpos((",".ValidatedField("contact","contact").","), "," "2" ",") !== false || "2" == ""))  {
    if (!(
false))  {
?>

             
          <p class="emailFormError">* Please provide your email addess so we can get back in touch with you.</p>
  <?php //WAFV_Conditional contact.php contact(2:)
    
}
  }
}
?>

          <br />
         
          <label for="Comments" >Comments:</label>
          <br />
          <textarea name="Comments" id="Comments" class="inputText" ><?php echo(ValidatedField("contact","Comments")) ?></textarea>
          <br />
          <?php
if (ValidatedField("contact","contact"))  {
  if ((
strpos((",".ValidatedField("contact","contact").","), "," "3" ",") !== false || "3" == ""))  {
    if (!(
false))  {
?>

            <p class="emailFormError">* Please let us know how we can assist you.</p>
            <br />
            <?php //WAFV_Conditional contact.php contact(3:)
    
}
  }
}
?>

           
            <br />
            <input name="addblock2" type="text" id="addblock2" style="display:none" value="" />
          <br />
          <label for="Security_code" >type this Security code in the box below:</label>
          <br />
          <img src="WA_ValidationToolkit/WAVT_CaptchaSecurityImages.php?noisecolor=<?php echo $WAGLOBAL_Captcha_Noise?>&bgcolor=<?php echo $WAGLOBAL_Captcha_BG?>" alt="security code" /> <span class="style1"> NOT case sensitive.</span> <br  />
          <input name="Security_code" type="text" id="Security_code" class="inputValue" maxlength="40" />
          <br />
          <?php
if (ValidatedField("contact","contact"))  {
  if ((
strpos((",".ValidatedField("contact","contact").","), "," "4" ",") !== false || "4" == ""))  {
    if (!(
false))  {
?>

            <p class="emailFormError">* Your security code entry did not match the image.</p>
            <?php //WAFV_Conditional contact.php contact(4:)
    
}
  }
}
?>

          <br />
          <label for="Security_code" ><br />
          <label for="Security_question" >Please answer:</label>
          <?php require_once("WA_ValidationToolkit/WAVT_CaptchaSecurityQuestion.php"); ?></label>
          <br />
          <input name="Security_question" type="text" id="Security_question" class="inputValue" maxlength="40" />
          <br />
            <?php
if (ValidatedField("contact","contact"))  {
  if ((
strpos((",".ValidatedField("contact","contact").","), "," "5" ",") !== false || "5" == ""))  {
    if (!(
false))  {
?>

            <p class="emailFormError">* Your answer was not correct.</p>
            <?php //WAFV_Conditional contact.php contact(4:)
    
}
  }
}
?>

<br />
          <input type="submit" value="Submit" class="inputButton"/>
        </div>
      </form>
Title: Re: Add Contact Page
Post by: V@no on June 03, 2009, 03:32:48 AM
It's hard to follow your description without visual examples and without knowing exactly what you did and how your script works.

Perhaps if you provide your contact.php and contact.html template we can help you out.

P.S.
use [code][/code] tags when posting code.

[Moving to programming discussion, as it doesn't seems to be related much to 4images itself]
Title: Re: Add Contact Page
Post by: Peaces on June 04, 2009, 05:00:24 PM
Thanks for your willingness to try and help me.

Here is the contact page (contact scripting)... http://PhotoPeaces.com/contactus.php
Here is the Template page... http://www.photopeaces.com/templates/default/contact.html

I would like the contact page to show up in the body of the Template when opening contactus.php.

My attempts so far have failed.

If you have a simpler contact script that I should be using, that's fine as well. I have been using this contact scripting for my other websites.
Title: Re: Add Contact Page
Post by: mawenzi on June 04, 2009, 05:09:07 PM
... and why you don't use ...
... [MOD] Contact Form : http://www.4homepages.de/forum/index.php?topic=8987.msg41855#msg41855 ...
... ? ...