4images Forum & Community
4images Issues / Ausgaben => Installation, Update & Configuration => Topic started by: uksoreeyes on April 12, 2003, 07:06:53 PM
-
Hi have created a template called contact.html and link to it via index.php?template=contact
Now when a user is logged in I would like his/her username and email address placed in the appropriate fields. I have got the name printed ok but the email address doesn't want to work. Here is my code.
<form method=post action="thanks.php">
<table width="300" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="108">Your Name:</td>
<td width="192">
<input type="text" name="name" value="{user_name}">
</td>
</tr>
<tr>
<td width="108">Your E-mail:</td>
<td width="192">
<input type="text" name="email" value="{user_email}">
</td>
</tr>
<tr>
<td width="108" valign="top">Your Message:</td>
<td width="192">
<textarea name="message"></textarea>
</td>
</tr>
<tr>
<td width="108"> </td>
<td width="192">
<input type="submit" name="Submit" value="Send Form">
</td>
</tr>
</table>
</form>
As you can see I have put {user_email} in the value part of the form, but it returns nothing. Anyone know what I can do?
Carl
-
Try this.
Open index.php and locate this near the top:
if (!empty($template)) {
$clickstream = "<a href=\"".$site_sess->url(ROOT_PATH."index.php")."\">".$lang['home']."</a>".$config['category_separator'].str_replace("_", " ", ucfirst($template));
$site_template->register_vars("clickstream", $clickstream);
$site_template->print_template($site_template->parse_template($main_template));
include(ROOT_PATH.'includes/page_footer.php');
}
Change it to:
if (!empty($template)) {
$clickstream = "<a href=\"".$site_sess->url(ROOT_PATH."index.php")."\">".$lang['home']."</a>".$config['category_separator'].str_replace("_", " ", ucfirst($template));
$sender_name = ($user_info['user_level'] != GUEST) ? $user_info['user_name'] : "";
$sender_email = ($user_info['user_level'] != GUEST) ? $user_info['user_email'] : "";
$site_template->register_vars(array(
"sender_name" => $sender_name,
"sender_email" => $sender_email,
"clickstream" => $clickstream
));
$site_template->print_template($site_template->parse_template($main_template));
include(ROOT_PATH.'includes/page_footer.php');
}
Now you can use {sender_name} and {sender_email} in your template.
-
Thanks for the help worked perfect.