1
Cozzie
Where is the html template? Please help
  • 2007/9/19 9:57

  • Cozzie

  • Not too shy to talk

  • Posts: 133

  • Since: 2007/7/13


I trying to update the contact form on the module mxdirectory. I can change the contact.php page, no problems - but I can't find a contact.html template anywhere!!!

There's gotta be one right?? But there isn't in the templates folder of the module.

Contact.php is the page to send an email to a company in the directory. There is the same problem for submit.php which is the page to add a listing - there's no html template page anywhere.

I've really, really gotta change the page layout asap - can someody help me please!!!!!

Thanks!

2
zyspec
Re: Where is the html template? Please help
  • 2007/9/19 12:06

  • zyspec

  • Module Developer

  • Posts: 1095

  • Since: 2004/9/21


Both submit.php and contact.php use the XoopsForm class. This class takes care of creating and displaying the actual html.

In submit.php (MX-Directory ver 3.01) you'll find most of the form creation code starts at around line 210.

In contact.php it starts around line 46...

3
Cozzie
Re: Where is the html template? Please help
  • 2007/9/21 10:43

  • Cozzie

  • Not too shy to talk

  • Posts: 133

  • Since: 2007/7/13


Thanks a lot zyspec! That clarifies things.

But I'm still stuck!!

I'm trying to put a contact form on each article of the smartsection module.

As smart section doesn't have this I'm trying to adapt the contact form on mxdirectory (the business listing module).

But every time I submit the contact form I get this message:

Error: Number %s, please contact the site administrator

This may be a bit vague, but do you know what I'm doing wrong?

I've changed the $result to get the relevant values from the smartsection database and I've changed $lid to $itemid (as used by smartsection) - but its not working.

Is it possible to set up a contact form in this way?

Thanks a lot for any suggestions

4
Cozzie
Re: Where is the html template? Please help
  • 2007/9/22 8:48

  • Cozzie

  • Not too shy to talk

  • Posts: 133

  • Since: 2007/7/13


Mmmmm, can't get the form to work. So I have adapted the much simpler contact.php form of xdirectory.

Now, when I submit a message its says it has now been sent successfully, but no email arrives (I'm trying to send to myself).

Is anyone able to take a quick look at the code I'm using and tell me why its not working???


Quote:

if ($submit) {
include("header.php");
global $xoopsConfig, $xoopsDB, $myts, $meta;

$result = $xoopsDB->query("SELECT title, email FROM ".$xoopsDB->prefix("coursesearch_items")." WHERE itemid = '$id'");
while(list($title, $email) = $xoopsDB->fetchRow($result)) {


if ($tele) {
$teles = "Phone: $tele";
} else {
$teles = "";
}

$message .= "Message from $namep\ne-Mail: $post ".$meta['title']."\n$teles\n\n";
$message .= "$namep wrote:\n";
$message .= "$messtext\n\n\n";
$message .= "This message was sent by $namep using the e-Mail form on {X_SITENAME}. \n\n\n";

$subject = "Email Submission from {X_SITENAME}";
$mail =& getMailer();
$mail->useMail();
$mail->setFromEmail($post);
$mail->setToEmails($email);
$mail->setSubject($subject);
$mail->setBody($message);
$mail->send();
echo $mail->getErrors();
}
redirect_header("index.php",1,_CLA_MESSEND);
exit();

} else {

include("header.php");
include(XOOPS_ROOT_PATH."/header.php");
OpenTable();

$result = $xoopsDB->query("SELECT title, email FROM ".$xoopsDB->prefix("coursesearch_items")." WHERE itemid = '$id'");
while(list($title, $email) = $xoopsDB->fetchRow($result)) {

echo "<script>
function verify() {
var msg = \"Errors were found during the validation of this form!\\n__________________________________________________\\n\\n\";
var errors = \"FALSE\";


if (document.Cont.namep.value == \"\") {
errors = \"TRUE\";
msg += \"The Name field is a required field.\\n\";
}

if (document.Cont.post.value == \"\") {
errors = \"TRUE\";
msg += \"The e-Mail field is a required field.\\n\";
}

if (document.Cont.messtext.value == \"\") {
errors = \"TRUE\";
msg += \"The Message field is a required field.\\n\";
}


if (errors == \"TRUE\") {
msg += \"__________________________________________________\\n\\nPlease correct the errors listed above before submitting this form.\\n\";
alert(msg);
return false;
}
}
</script>";


echo "<B></B><BR><BR>";
echo "Send a message to:<br><font size=4>$title</font><BR>";
echo "<form onSubmit=\"return verify();\" method=\"post\" action=\"contact.php\" NAME=\"Cont\">";
echo "<INPUT TYPE=\"hidden\" NAME=\"id\" VALUE=\"$id\">";
echo "<INPUT TYPE=\"hidden\" NAME=\"submit\" VALUE=\"1\">";

if($xoopsUser) {
$idd =$xoopsUser->getVar("name", "E");
$idde =$xoopsUser->getVar("email", "E");
}

echo "<TABLE WIDTH=100% BORDER=0 CELLSPACING=1>
<TR>
<TD>Your Name: </TD>
<TD><input type=\"text\" name=\"namep\" size=\"42\" value=\"$idd\"></TD>
</TR>
<TR>
<TD>Your e-Mail: </TD>
<TD><input type=\"text\" name=\"post\" size=\"42\" value=\"$idde\"></font></TD>
</TR>
<TR>
<TD>Your Phone: </TD>
<TD><input type=\"text\" name=\"tele\" size=\"42\"></font></TD>
</TR>
<TR>
<TD>Message: </TD>
<TD><textarea rows=\"5\" name=\"messtext\" cols=\"40\"></textarea></TD>
</TR>
</TABLE>
<p><INPUT TYPE=\"submit\" VALUE=\"Send\">
</form>";

CloseTable();
include(XOOPS_ROOT_PATH."/footer.php");
}
}
?>


Thanks a lot for any help, its really appreciated (and needed!)

5
kodepree
Re: Where is the html template? Please help
  • 2008/4/15 21:04

  • kodepree

  • Just popping in

  • Posts: 2

  • Since: 2005/3/8 2


Hi Cozzie,

I had the same problem with sending e-mail from MX-directory version 3.01. I just could'nt fix it and stopped searching.

As you supposed I took the contact.php from X-directory and without any change, it worked just fine! I translated the English descriptions in the file and that was it. I hope you succeeded too ;)

Ko de Pree