I recently installed (fresh) OpenCart version 1.5.6.1.
I have been following the advice given at this post: http://forum.opencart.com/viewtopic.php?t=11056 about how to add links directly to the items to be downloaded from OpenCart.
I have updated order.tpl so that it now looks like this (below). When I create a new order, the order confirmation email is not going out at all after I add the code recommended by the post above. When I use the original version of the order.tpl file the email goes out with no problems. I am new to OpenCart and php, so can't see why this is not working. Can anyone give me any hints as to what I might need to look at to get this working? Any help appreciated.
Thanks!
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title><?php echo $title; ?></title>
</head>
<body style="font-family: Arial, Helvetica, sans-serif; font-size: 12px; color: #000000;">
<div style="width: 680px;"><img src="<?php echo $logo; ?>" alt="<?php echo $store_name; ?>" style="margin-bottom: 20px; border: none;" />
<p style="margin-top: 0px; margin-bottom: 20px;"><?php echo $text_greeting; ?></p>
<?php if ($customer_id) { ?>
<p style="margin-top: 0px; margin-bottom: 20px;"><?php echo $text_link; ?></p>
<p style="margin-top: 0px; margin-bottom: 20px;"><?php echo $link; ?></p>
<?php } ?>
<?php if ($download) { ?>
<p style="margin-top: 0px; margin-bottom: 20px;"><?php echo $text_download; ?></p>
<p style="margin-top: 0px; margin-bottom: 20px;"><?php echo $download; ?></p>
<?php } ?>
<table style="border-collapse: collapse; width: 100%; border-top: 1px solid #DDDDDD; border-left: 1px solid #DDDDDD; margin-bottom: 20px;">
<thead>
<tr>
<td style="font-size: 12px; border-right: 1px solid #DDDDDD; border-bottom: 1px solid #DDDDDD; background-color: #EFEFEF; font-weight: bold; text-align: left; padding: 7px; color: #222222;" colspan="2"><?php echo $text_order_detail; ?></td>
</tr>
</thead>
<tbody>
<tr>
<td style="font-size: 12px; border-right: 1px solid #DDDDDD; border-bottom: 1px solid #DDDDDD; text-align: left; padding: 7px;"><b><?php echo $text_order_id; ?></b> <?php echo $order_id; ?><br />
<b><?php echo $text_date_added; ?></b> <?php echo $date_added; ?><br />
<b><?php echo $text_payment_method; ?></b> <?php echo $payment_method; ?><br />
<?php if ($shipping_method) { ?>
<b><?php echo $text_shipping_method; ?></b> <?php echo $shipping_method; ?>
<?php } ?></td>
<td style="font-size: 12px; border-right: 1px solid #DDDDDD; border-bottom: 1px solid #DDDDDD; text-align: left; padding: 7px;"><b><?php echo $text_email; ?></b> <?php echo $email; ?><br />
<b><?php echo $text_telephone; ?></b> <?php echo $telephone; ?><br />
<b><?php echo $text_ip; ?></b> <?php echo $ip; ?><br /></td>
</tr>
</tbody>
</table>
<?php if ($comment) { ?>
<table style="border-collapse: collapse; width: 100%; border-top: 1px solid #DDDDDD; border-left: 1px solid #DDDDDD; margin-bottom: 20px;">
<thead>
<tr>
<td style="font-size: 12px; border-right: 1px solid #DDDDDD; border-bottom: 1px solid #DDDDDD; background-color: #EFEFEF; font-weight: bold; text-align: left; padding: 7px; color: #222222;"><?php echo $text_instruction; ?></td>
</tr>
</thead>
<tbody>
<tr>
<td style="font-size: 12px; border-right: 1px solid #DDDDDD; border-bottom: 1px solid #DDDDDD; text-align: left; padding: 7px;"><?php echo $comment; ?></td>
</tr>
</tbody>
</table>
<?php } ?>
<table style="border-collapse: collapse; width: 100%; border-top: 1px solid #DDDDDD; border-left: 1px solid #DDDDDD; margin-bottom: 20px;">
<thead>
<tr>
<td style="font-size: 12px; border-right: 1px solid #DDDDDD; border-bottom: 1px solid #DDDDDD; background-color: #EFEFEF; font-weight: bold; text-align: left; padding: 7px; color: #222222;"><?php echo $text_payment_address; ?></td>
<?php if ($shipping_address) { ?>
<td style="font-size: 12px; border-right: 1px solid #DDDDDD; border-bottom: 1px solid #DDDDDD; background-color: #EFEFEF; font-weight: bold; text-align: left; padding: 7px; color: #222222;"><?php echo $text_shipping_address; ?></td>
<?php } ?>
</tr>
</thead>
<tbody>
<tr>
<td style="font-size: 12px; border-right: 1px solid #DDDDDD; border-bottom: 1px solid #DDDDDD; text-align: left; padding: 7px;"><?php echo $payment_address; ?></td>
<?php if ($shipping_address) { ?>
<td style="font-size: 12px; border-right: 1px solid #DDDDDD; border-bottom: 1px solid #DDDDDD; text-align: left; padding: 7px;"><?php echo $shipping_address; ?></td>
<?php } ?>
</tr>
</tbody>
</table>
<table style="border-collapse: collapse; width: 100%; border-top: 1px solid #DDDDDD; border-left: 1px solid #DDDDDD; margin-bottom: 20px;">
<thead>
<tr>
<td style="font-size: 12px; border-right: 1px solid #DDDDDD; border-bottom: 1px solid #DDDDDD; background-color: #EFEFEF; font-weight: bold; text-align: left; padding: 7px; color: #222222;"><?php echo $text_product; ?></td>
<td style="font-size: 12px; border-right: 1px solid #DDDDDD; border-bottom: 1px solid #DDDDDD; background-color: #EFEFEF; font-weight: bold; text-align: left; padding: 7px; color: #222222;"><?php echo $text_model; ?></td>
<td style="font-size: 12px; border-right: 1px solid #DDDDDD; border-bottom: 1px solid #DDDDDD; background-color: #EFEFEF; font-weight: bold; text-align: right; padding: 7px; color: #222222;"><?php echo $text_quantity; ?></td>
<td style="font-size: 12px; border-right: 1px solid #DDDDDD; border-bottom: 1px solid #DDDDDD; background-color: #EFEFEF; font-weight: bold; text-align: right; padding: 7px; color: #222222;"><?php echo $text_price; ?></td>
<td style="font-size: 12px; border-right: 1px solid #DDDDDD; border-bottom: 1px solid #DDDDDD; background-color: #EFEFEF; font-weight: bold; text-align: right; padding: 7px; color: #222222;"><?php echo $text_total; ?></td>
</tr>
</thead>
<tbody>
<?php foreach ($products as $product) { ?>
<tr>
<td style="font-size: 12px; border-right: 1px solid #DDDDDD; border-bottom: 1px solid #DDDDDD; text-align: left; padding: 7px;"><?php echo $product['name']; ?>
<?php foreach ($product['option'] as $option) { ?>
<br />
<small> - <?php echo $option['name']; ?>: <?php echo $option['value']; ?></small>
<?php } ?></td>
<td style="font-size: 12px; border-right: 1px solid #DDDDDD; border-bottom: 1px solid #DDDDDD; text-align: left; padding: 7px;"><?php echo $product['model']; ?></td>
<td style="font-size: 12px; border-right: 1px solid #DDDDDD; border-bottom: 1px solid #DDDDDD; text-align: right; padding: 7px;"><?php echo $product['quantity']; ?></td>
<td style="font-size: 12px; border-right: 1px solid #DDDDDD; border-bottom: 1px solid #DDDDDD; text-align: right; padding: 7px;"><?php echo $product['price']; ?></td>
<td style="font-size: 12px; border-right: 1px solid #DDDDDD; border-bottom: 1px solid #DDDDDD; text-align: right; padding: 7px;"><?php echo $product['total']; ?></td>
</tr>
<?php } ?>
<?php foreach ($vouchers as $voucher) { ?>
<tr>
<td style="font-size: 12px; border-right: 1px solid #DDDDDD; border-bottom: 1px solid #DDDDDD; text-align: left; padding: 7px;"><?php echo $voucher['description']; ?></td>
<td style="font-size: 12px; border-right: 1px solid #DDDDDD; border-bottom: 1px solid #DDDDDD; text-align: left; padding: 7px;"></td>
<td style="font-size: 12px; border-right: 1px solid #DDDDDD; border-bottom: 1px solid #DDDDDD; text-align: right; padding: 7px;">1</td>
<td style="font-size: 12px; border-right: 1px solid #DDDDDD; border-bottom: 1px solid #DDDDDD; text-align: right; padding: 7px;"><?php echo $voucher['amount']; ?></td>
<td style="font-size: 12px; border-right: 1px solid #DDDDDD; border-bottom: 1px solid #DDDDDD; text-align: right; padding: 7px;"><?php echo $voucher['amount']; ?></td>
</tr>
<?php } ?>
</tbody>
<tfoot>
<?php foreach ($totals as $total) { ?>
<tr>
<td style="font-size: 12px; border-right: 1px solid #DDDDDD; border-bottom: 1px solid #DDDDDD; text-align: right; padding: 7px;" colspan="4"><b><?php echo $total['title']; ?>:</b></td>
<td style="font-size: 12px; border-right: 1px solid #DDDDDD; border-bottom: 1px solid #DDDDDD; text-align: right; padding: 7px;"><?php echo $total['text']; ?></td>
</tr>
<!--//Q: BOF Add download links to email -->
<?php
global $db, $language, $loader;
$loader->language('account/download');
$query = $db->query("SELECT order_download_id, name FROM " . DB_PREFIX . "order_download WHERE order_id = '" . $order_id . "'");
?>
<?php if ($query->num_rows) { ?>
<tr>
<td align="left" style="background-color: #069; color: #FFF; font-size: 12px; font-weight: bold; padding: 0.5em 1em;"><?php echo $language->get('text_downloads'); ?></td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td align="left">
<?php foreach ($query->rows as $download) { ?>
<?php echo $download['name']; ?><br/>
<?php } ?>
</td>
</tr>
<tr>
<td> </td>
</tr>
<?php } ?>
<!--//Q: EOF Add download links to email -->
<?php } ?>
</tfoot>
</table>
<p style="margin-top: 0px; margin-bottom: 20px;"><?php echo $text_footer; ?></p>
</div>
</body>
</html>
This is the part I added per the forum post mentioned above:
enter code <!--//Q: BOF Add download links to email -->
<?php
global $db, $language, $loader;
$loader->language('account/download');
$query = $db->query("SELECT order_download_id, name FROM " . DB_PREFIX . "order_download WHERE order_id = '" . $order_id . "'");
?>
<?php if ($query->num_rows) { ?>
<tr>
<td align="left" style="background-color: #069; color: #FFF; font-size: 12px; font-weight: bold; padding: 0.5em 1em;"><?php echo $language->get('text_downloads'); ?></td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td align="left">
<?php foreach ($query->rows as $download) { ?>
<?php echo $download['name']; ?><br/>
<?php } ?>
</td>
</tr>
<tr>
<td> </td>
</tr>
<?php } ?>
<!--//Q: EOF Add download links to email -->
<!--//Q: BOF Add download links to email -->
<?php
global $db, $language, $loader;
$loader->language('account/download');
$query = $db->query("SELECT order_download_id, name FROM " . DB_PREFIX . "order_download WHERE order_id = '" . $order_id . "'");
?>
<?php if ($query->num_rows) { ?>
<tr>
<td align="left" style="background-color: #069; color: #FFF; font-size: 12px; font-weight: bold; padding: 0.5em 1em;"><?php echo $language->get('text_downloads'); ?></td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td align="left">
<?php foreach ($query->rows as $download) { ?>
<?php echo $download['name']; ?><br/>
<?php } ?>
</td>
</tr>
<tr>
<td> </td>
</tr>
<?php } ?>
<!--//Q: EOF Add download links to email -->
This is about as simple as you can get it.
<?php
$query = $db->query("SELECT order_download_id, name FROM " . DB_PREFIX . "order_download WHERE order_id = '" . $order_id . "'");
?>
header(‘Content-Type: text/plain’);
header("Content-Disposition: attachment; filename=orderConfirmation.txt");
foreach ($query->rows as $temp) {
echo $temp['order_download_id'];
echo $temp['name'];
}
?>
Related
mostly trying to modify the email verification that is sent on sign-up following the allauth documentation the sent email is modified when i change email_confirmation_message.txt but when i want to use an html representaion the documentation says to use email_confirmation_message.html but it is not recognized and instead it sends the default email or if i include both it only sneds the text one and ignores the html
email_confirmation_message.html :
{% extends "account/email/base_message.txt" %}
{% load account %}
{% load i18n %}
{% block content %}{% autoescape off %}{% user_display user as user_display %}{% blocktrans with site_name=current_site.name site_domain=current_site.domain %}
<!doctype html>
<html>
<head>
<meta charset='utf-8'>
<meta name='viewport' content='width=device-width, initial-scale=1'>
<title>Snippet - GoSNippets</title>
<link href='https://stackpath.bootstrapcdn.com/bootstrap/5.0.0-alpha1/css/bootstrap.min.css' rel='stylesheet'>
<link href='' rel='stylesheet'>
<script type='text/javascript' src=''></script>
<script type='text/javascript' src='https://cdn.jsdelivr.net/npm/popper.js#1.16.0/dist/umd/popper.min.js'></script>
<script type='text/javascript' src='https://stackpath.bootstrapcdn.com/bootstrap/5.0.0-alpha1/js/bootstrap.min.js'></script>
</head>
<body oncontextmenu='return false' class='snippet-body'>
<div style="display: none; font-size: 1px; color: #fefefe; line-height: 1px; font-family: 'Lato', Helvetica, Arial, sans-serif; max-height: 0px; max-width: 0px; opacity: 0; overflow: hidden;"> We're thrilled to have you here! Get ready to dive into your new account. </div>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<table border="0" cellpadding="0" cellspacing="0" width="100%" style="max-width: 600px;">
<tr>
<td bgcolor="#ffffff" align="left" style="padding: 20px 30px 40px 30px; color: #666666; font-family: 'Lato', Helvetica, Arial, sans-serif; font-size: 18px; font-weight: 400; line-height: 25px;">
<p style="margin: 0;">We're excited to have you get started on {{ site_domain }}. First, you need to confirm your account. Just press the button below.</p>
</td>
</tr>
<tr>
<td bgcolor="#ffffff" align="left">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td bgcolor="#ffffff" align="center" style="padding: 20px 30px 60px 30px;">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="center" style="border-radius: 3px;" bgcolor="#FFA73B">Confirm Account</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr> <!-- COPY -->
<tr>
<td bgcolor="#ffffff" align="left" style="padding: 0px 30px 0px 30px; color: #666666; font-family: 'Lato', Helvetica, Arial, sans-serif; font-size: 18px; font-weight: 400; line-height: 25px;">
<p style="margin: 0;">If that doesn't work, copy and paste the following link in your browser:</p>
</td>
</tr> <!-- COPY -->
</table>
<script type='text/javascript'></script>
</body>
</html>
{% endblocktrans %}{% endautoescape %}{% endblock %}
ok,so i figured it out. you have to also change email_confirmation_signup_message.txt
to email_confirmation_signup_message.html and inside it change {% include "account/email/email_confirmation_message.txt" %} to {% include "account/email/email_confirmation_message.html" %}
The email sent for resetting password are being displayed as raw HTML content. This is not the case for every users but for significant number of users, this problem arrives.
This is my url for password reset:
from django.contrib.auth.views import password_reset
url(r'^accounts/password/reset/', password_reset, {'template_name':'users/login.html','html_email_template_name':'registration/password_reset_email.html', 'post_reset_redirect':'/users/accounts/login/?reset=1', 'extra_context':{'reset':'1'}}, name='password_reset'),
These are my password reset email templates:
registration/password_reset_email.html
{% extends 'users/email_base.html' %}
{% block content %}
{% load i18n %}
<table width="100%" cellspacing="0" cellpadding="0" border="0" bgcolor="#f0f0f0" align="center">
<tbody>
<tr>
<td style="font-size:0;" align="center">
<div style="display:inline-block;width:100%;max-width:800px;vertical-align:top;" class="width800 mrt-30">
<!-- ID:BG SECTION-1 -->
<table class="display-width" style="max-width:800px;" width="100%" cellspacing="0" cellpadding="0" border="0" bgcolor="#ffffff" align="center">
<tbody>
<tr>
<td class="padding" align="center">
<div style="display:inline-block;width:100%;max-width:600px;vertical-align:top;font-family:Ubuntu, sans-serif;" class="main-width">
<table class="display-width-inner" style="max-width:600px;" width="100%" cellspacing="0" cellpadding="0" border="0" align="center">
<tbody>
<tr>
<td style="mso-line-height-rule:exactly;line-height:30px;font-size:0;" height="30">
</td>
</tr>
<tr>
<td style="mso-line-height-rule:exactly;line-height:10px;font-size:0;" height="10">
</td>
</tr>
<tr>
<td style="color:#666666;font-family:Ubuntu, sans-serif;font-weight:400;font-size:14px;line-height:24px; text-align:justify;">
{% blocktrans %}
You're receiving this email because you requested a password reset for your user account at {{ site_name }}.
{% endblocktrans %}
</td>
</tr>
<tr>
<td style="color:#666666;font-family:Ubuntu, sans-serif;font-weight:400;font-size:14px;line-height:24px; text-align:justify;">
Please go to the following page and choose a new password:
{% block reset_link %}
https://{{ domain }}{% url 'auth_password_reset_confirm' uidb64=uid token=token %}
{% endblock %}
Your username, in case you've forgotten: {{ user.get_username }}
</td>
</tr>
<tr>
<td style="color:#666666;font-family:Ubuntu, sans-serif;font-weight:400;font-size:14px;line-height:24px; text-align:justify;">
{% trans "Thanks for using our Application!" %}
The {{ site_name }} team
</td>
</tr>
</tbody>
</table>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</td>
</tr>
</tbody>
</table>
{% endblock %}
users/email_base.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Fieldsight</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=display-width, initial-scale=1.0, maximum-scale=1.0,">
<!-- OUR PACKAGES-1 TITLE STARTS -->
<style type="text/css">
#import url('https://fonts.googleapis.com/css?family=Ubuntu:400,500');
html{
width:100%;
}
body{
margin:0;
padding:0;
width:100%;
-webkit-text-size-adjust:none;
-ms-text-size-adjust:none;
background-color:#f0f0f0;
font-family:'Ubuntu',sans-serif;
}
img{
display:block !important;
border:0;
-ms-interpolation-mode:bicubic;
}
.ReadMsgBody{
width:100%;
}
.ExternalClass{
width:100%;
}
.ExternalClass,.ExternalClass p,.ExternalClass span,.ExternalClass font,.ExternalClass td,.ExternalClass div{
line-height:100%;
}
.images{
display:block !important;
width:100% !important;
}
p{
margin:0 !important;
padding:0 !important;
}
.display-button a:hover{
text-decoration:none !important;
}
#media only screen and (min-width:799px){
.saf-table{
display:table !important;
}
} #media only screen and (min-width:799px){
.main-width{
width:600px;
}
} #media only screen and (min-width:799px){
.width800{
width:800px !important;
max-width:800px !important;
}
} #media only screen and (min-width:799px){
.mrt-30{
margin-top:50px;
}
} #media only screen and (min-width:799px){
.mrb-30{
margin-bottom:50px;
}
} #media only screen and (max-width:799px){
body{
width:auto !important;
}
} #media only screen and (max-width:799px){
.display-width{
width:100% !important;
}
} #media only screen and (max-width:799px){
.display-width-inner{
width:600px !important;
}
} #media only screen and (max-width:799px){
.padding{
padding:0 20px !important;
}
} #media only screen and (max-width:799px){
.res-padding-full{
padding:0 !important;
}
} #media only screen and (max-width:799px){
.res-padding-left{
padding-left:0 !important;
}
} #media only screen and (max-width:799px){
.width800{
width:100% !important;
max-width:100% !important;
}
} #media only screen and (max-width:768px){
.width768{
max-width:684px !important;
}
} #media only screen and (max-width:768px){
.child1-width{
width:50% !important;
max-width:50% !important;
}
} #media only screen and (max-width:768px){
.child2-width{
width:50% !important;
max-width:50% !important;
}
} #media only screen and (max-width:768px){
.full-width-height{
padding-top:40px !important;
padding-bottom:25px !important;
}
} #media only screen and (max-width:680px){
.child1-width{
width:50% !important;
max-width:50% !important;
}
} #media only screen and (max-width:680px){
.child2-width{
width:50% !important;
max-width:50% !important;
}
} #media only screen and (max-width:680px){
.res-padding-left{
padding-left:40px !important;
}
} #media only screen and (max-width:680px){
.padding-hide{
padding-bottom:0 !important;
}
} #media only screen and (max-width:680px){
.res-attract-height{
padding:20px 10px 0 !important;
}
} #media only screen and (max-width:680px){
.full-width-height{
padding-top:50px !important;
padding-bottom:40px !important;
}
} #media only screen and (max-width:660px){
.child1-width{
width:50% !important;
max-width:50% !important;
}
} #media only screen and (max-width:660px){
.child2-width{
width:50% !important;
max-width:50% !important;
}
} #media only screen and (max-width:660px){
.res-padding-left{
padding-left:30px !important;
}
} #media only screen and (max-width:660px){
.res-attract-height{
padding:20px 10px 0 !important;
}
} #media only screen and (max-width:660px){
.full-width-height{
padding-top:45px !important;
padding-bottom:20px !important;
}
} #media only screen and (max-width:640px){
.res-attract-height{
padding:20px 10px 0 !important;
}
} #media only screen and (max-width:640px){
.child1-width,.child2-width{
width:50% !important;
max-width:50% !important;
}
} #media only screen and (max-width:640px){
.res-padding-left{
padding-left:20px !important;
}
} #media only screen and (max-width:640px){
.full-width-height{
padding-top:40px !important;
padding-bottom:30px !important;
}
} #media only screen and (max-width:639px){
body{
width:auto !important;
}
} #media only screen and (max-width:639px){
.display-width{
width:100% !important;
}
} #media only screen and (max-width:639px){
.display-width-inner,.display-width-child{
width:100% !important;
}
} #media only screen and (max-width:639px){
.display-width-child .button-width .display-button{
width:auto !important;
}
} #media only screen and (max-width:639px){
.res-padding-full{
padding:0 20px !important;
}
} #media only screen and (max-width:639px){
.padding-hide{
padding:0 !important;
}
} #media only screen and (max-width:639px){
.padding{
padding:0 20px !important;
}
} #media only screen and (max-width:639px){
.saf-table{
display:block !important;
}
} #media only screen and (max-width:639px){
.width282{
width:282px !important;
}
} #media only screen and (max-width:639px){
.div-width{
display:block !important;
width:100% !important;
max-width:100% !important;
}
} #media only screen and (max-width:639px){
.res-height20-bottom{
padding-bottom:20px !important;
}
} #media only screen and (max-width:639px){
.res-height-top{
padding-top:60px !important;
}
} #media only screen and (max-width:639px){
.full-width-height{
padding-bottom:60px !important;
}
} #media only screen and (max-width:639px){
.footer-width{
width:151px !important;
}
} #media only screen and (max-width:639px){
.height20{
height:20px !important;
}
} #media only screen and (max-width:639px){
.height30{
height:30px !important;
}
} #media only screen and (max-width:639px){
.hide-height,.hide-bar{
display:none !important;
}
} #media only screen and (max-width:639px){
.txt-center{
text-align:center !important;
}
} #media only screen and (max-width:639px){
span.unsub-width{
width:100% !important;
display:block !important;
padding-bottom:10px !important;
}
} #media only screen and (max-width:639px){
.res-center{
margin:0 auto !important;
display:table !important;
}
} #media only screen and (max-width:480px){
.display-width table,.display-width-child2 table{
width:100% !important;
}
.mrbm-30{
margin-bottom: 30px !important;
}
} #media only screen and (max-width:480px){
.display-width .button-width .display-button{
width:auto !important;
}
} #media only screen and (max-width:480px){
.display-width-child .footer-width{
width:151px !important;
}
} #media only screen and (max-width:480px){
.display-width .width282{
width:282px !important;
}
} #media only screen and (max-width:480px){
.div-width{
display:block !important;
width:100% !important;
max-width:100% !important;
}
} #media only screen and (max-width:380px){
.display-width table{
width:100% !important;
}
} #media only screen and (max-width:380px){
.display-width .button-width .display-button{
width:auto !important;
}
} #media only screen and (max-width:380px){
.display-width-child .width282{
width:100% !important;
}
} #media only screen and (max-width:330px){
.res-font{
font-size:33px !important;
}
}</style>
</head>
<body>
{% block content %}
{% endblock %}
<table width="100%" cellspacing="0" cellpadding="0" border="0" bgcolor="#f0f0f0" align="center">
<tbody>
<tr>
<td style="font-size:0;" align="center">
<div style="display:inline-block;width:100%;max-width:800px;vertical-align:top;" class="width800 mrb-30">
<!-- ID:BG FOOTER -->
<table class="display-width" style="max-width:800px;" width="100%" cellspacing="0" cellpadding="0" border="0" bgcolor="#ffffff" align="center">
<tbody>
<tr>
<td class="padding" align="center">
<div style="display:inline-block;width:100%;max-width:600px;vertical-align:top;" class="main-width">
<table class="display-width-inner" style="max-width:600px;" width="100%" cellspacing="0" cellpadding="0" border="0" align="center">
<tbody>
<tr>
<td style="line-height:20px;mso-line-height-rule:exactly;font-size:0;" height="20">
</td>
</tr>
<tr>
<td style="color:#666666;font-family:Ubuntu, sans-serif;font-weight:600;font-size:14px;line-height:24px;" align="left">
<strong style="color:#0488d1;text-decoration:none;text-transform:capitalize;font-weight:500;margin:0 5px 0 0;">Happy FieldSighting!</strong>
</td>
</tr>
<tr>
<td style="line-height:15px;mso-line-height-rule:exactly;font-size:0;" height="15">
</td>
</tr>
<tr>
<!-- ID:BR FOOTER BORDER -->
<td style="line-height:15px;mso-line-height-rule:exactly;border-bottom:1px solid #e5e5e5;font-size:0;" height="15">
</td>
</tr>
<tr>
<td style="line-height:15px;mso-line-height-rule:exactly;font-size:0;" height="15">
</td>
</tr>
<!-- SOCIAL ICONS -->
<tr>
<td align="center">
<table style="border-collapse:collapse;mso-table-lspace:0pt;mso-table-rspace:0pt;" width="100%" cellspacing="0" cellpadding="0" border="0" align="center">
<tbody>
<tr>
<td class="div-width mrbm-30" align="center">
<table>
<tbody>
<tr>
<td style="border-collapse:collapse;color:#333333;" align="center">
<img src="https://gallery.mailchimp.com/7548f1bce7a62e405ffe789fd/images/8087ebbb-7ee5-4377-9b52-209086142dcf.png" alt="150x50" style="margin:0; border:0; padding:0; display:block;" width="120">
</td>
</tr>
</tbody>
</table>
</td>
<td align="center" class="div-width">
<table style="width:auto !important;" cellspacing="0" cellpadding="0" border="0" align="center">
<tbody>
<tr>
<!-- ID:TXT FOOTER ADDRESS -->
<td width="30" valign="middle" align="left">
<img src="https://gallery.mailchimp.com/7548f1bce7a62e405ffe789fd/images/e0ed2f36-4a6d-449b-a85d-be4ba2bfd1fc.png" alt="48x48x7" style="max-width:30px; width:100%; height:auto; margin:0; border:0; padding:0; display:block;" width="30" height="30">
</td>
<td width="10">
</td>
<td width="30" valign="middle" align="left">
<img src="https://gallery.mailchimp.com/7548f1bce7a62e405ffe789fd/images/fb3992ff-a590-4735-97cd-82e04f9584d3.png" style="max-width:30px; width:100%; height:auto; margin:0; border:0; padding:0; display:block;" width="30" height="30">
</td>
<td width="10">
</td>
<td width="30" valign="middle" align="left">
<img src="https://gallery.mailchimp.com/7548f1bce7a62e405ffe789fd/images/fc20ca4c-0e67-4ed0-9744-631c379ee59f.png" alt="48x48x10" style="max-width:30px; width:100%; height:auto; margin:0; border:0; padding:0; display:block;" width="30" height="30">
</td>
</tr>
</tbody>
</table>
<table style="width:auto !important;" cellspacing="0" cellpadding="0" border="0" align="center">
<tbody>
<tr>
<td style="line-height:5px;mso-line-height-rule:exactly;font-size:0;" height="5">
</td>
</tr>
<tr>
<td style="color:#666666;font-family:Ubuntu, sans-serif;font-weight:600;font-size:14px;line-height:24px;" align="center">
info#fieldsight.org<span style="margin:0 5px; color:#e5e5e5;" >|</span>www.fieldsight.org
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr>
<!-- ID:BR FOOTER BORDER -->
<td style="line-height:30px;mso-line-height-rule:exactly;font-size:0;" height="30">
</td>
</tr>
</tbody>
</table>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</td>
</tr>
</tbody>
</table>
<!-- FOOTER ENDS -->
</body>
</html>
Some of the users are getting the email in raw html format.
Can anyone help me with this? I want to know if there is some way to manage all the users to view the email template rather than raw html.
By default, the plain text email template is called registration/password_reset_email.html (which I personally think is confusing as plaintext is not html).
In your case both the email_template_name (plaintext) and html_email_template (html email) are using the same template this means if a client cannot use html it will fall back to a plaintext email which contains html syntax.
From the docs:
email_template_name: The full name of a template to use for generating the email with the reset password link. Defaults to registration/password_reset_email.html if not supplied.
html_email_template_name: The full name of a template to use for generating a text/html multipart email with the password reset link. By default, HTML email is not sent.
To resolve this:
change the name of the html email template to be: html_password_reset_email.html
Update the keyword args in your urls.py setting the html_email_template_name=registration/html_password_reset_email.html,
This will now send the html email template for clients which can render html and fall back to the plaintext (django default) template for clients which can only render plain text.
Additional information: The source for sending password reset email can be found here: https://github.com/django/django/blob/7f612eda80db1c1c8e502aced54c2062080eae46/django/contrib/auth/forms.py#L247
In short, the variable email_template_name is used to send a plain text version of the email. If you include the html_email_template_name, then an additional payload is added to the email; which includes a html email attachment (html_email_template_name).
Multi-currency REGEXP_SUBSTR Oracle11g
First time posting a question here, so I hope I don't muck it up too badly.
I created a query that pulls various customer order details including charged price, product list price and the big one, the price that was sent to customers via reminder emails.
Using REGEXP_SUBSTR I am able to match all of the prices from the emails HTML content in various currencies but I run into an issue with the output for certain Price currency abbreviation combinations lacking commas or periods: i.e. 123 kr, 999 Pesos or 1 050 Kč.
How can I make this scenario above match the output of the other price formats?
I pulled much of my "inspiration" from Gary's answer here: Regex currency validation.
Datasource HTML
Desired values starting at <!-- START Price Exp.. -->:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Thank you for using us</title>
<style type="text/css">
.ReadMsgBody {
width: 100%;
}
.ExternalClass {
width: 100%;
}
BODY {
font-family: OpenSans, Arial, Helvetica, sans-serif;
font-size:13px;
color:#555555;
}
TD {
font-family: OpenSans, Arial, Helvetica, sans-serif;
font-size:13px;
color:#555555;
vertical-align: top;
}
A {
color: #f48024;
}
IMG {
display:block;
border: none;
}
H1 {
font-size: 18pt;
}
H2 {
font-size: 15pt;
}
H1, H2, H3, P, UL, LI {
margin: 0;
padding: 0;
}
</style>
</head>
<body style="margin: 0; padding: 0; background-color: #eeeeee" bgcolor="#eeeeee">
<table width="100%" border="0" cellpadding="0" cellspacing="0" style="margin: 0; padding: 0; ">
<tbody>
<tr>
<td align="center" width="100%" >
<!-- TOP-->
<table bgcolor="#eeeeee" border="0" cellpadding="0" cellspacing="0" style="background-color: #eeeeee; width:100%; max-width:900px; ">
<tbody>
<tr>
<td height="34" style="font-size: 1px;"><!-- cell --></td>
</tr>
</tbody>
</table>
<!-- END TOP-->
<!-- LOGO -->
<table align="center" cellspacing="0" cellpadding="0" border="0" bgcolor="#fff" style="width:100%; background-color: #fff; max-width:900px;">
<tr>
<td>
<table align="center" cellspacing="0" cellpadding="0" border="0" bgcolor="#fff" style="background-color: #fff; text-align: center; max-width:650px;">
<tr>
<td align="center" height="40" bgcolor="#fff" style="background-color: #fff; vertical-align: middle; text-align: center; ">
<img align="center" style="" src="https://cdn.sstatic.net/Sites/stackoverflow/img/apple-touch-icon#2.png?v=73d79a89bded" style="display:block" alt="" />
</td>
</tr>
</table>
</td>
</tr>
</table>
<!-- END LOGO-->
<table align="center" cellspacing="0" cellpadding="0" border="0" bgcolor="#fff" style="width:100%; max-width:900px; background-color: #fff;">
<tr>
<td>
<table align="center" cellspacing="0" cellpadding="0" border="0" bgcolor="#fff" style="width:100%; background-color: #fff; max-width:800px; padding-left:10px; padding-right:10px;">
<tr>
<td height="30" style="font-size: 1px;"><!-- cell --></td>
</tr>
<tr>
<td>
<p style="text-align: center; margin:0; padding: 0; font-family: Arial, Helvetica, sans-serif; font-size:22px; color:#41424e; line-height: 1.4"><b>Example Template</b></p>
</td>
</tr>
<tr>
<td height="34" style="font-size: 1px;"><!-- cell --></td>
</tr>
<tr>
<td>
<p style="text-align: left; margin:0; padding: 0; font-family: Arial, Helvetica, sans-serif; font-size:16px; color:#767683; line-height: 1.4">Dear customername,</p>
</td>
</tr>
<tr>
<td height="20" style="font-size: 1px;"><!-- cell --></td>
</tr>
<tr>
<td>
<p style="text-align: left; margin:0; padding: 0; font-family: Arial, Helvetica, sans-serif; font-size:16px; color:#767683; line-height: 1.4">Your productname - 1PC has been successfully renewed.</p>
</td>
</tr>
<tr>
<td height="20" style="font-size: 1px;"><!-- cell --></td>
</tr>
<tr>
<td>
<p style="text-align: left; margin:0; padding: 0; font-family: Arial, Helvetica, sans-serif; font-size:16px; color:#767683; line-height: 1.4">Details of your sub below.</p>
</td>
</tr>
<tr>
<td height="40" style="font-size: 1px;"><!-- cell --></td>
</tr>
</table>
</td>
</tr>
</table>
<!-- sum-->
<table align="center" cellspacing="0" cellpadding="0" border="0" bgcolor="#F2F2F6" style="width:100%; background-color: #F2F2F6; max-width:900px;">
<tr>
<td>
<table align="center" cellspacing="0" cellpadding="0" border="0" bgcolor="#F2F2F6" style="width:100%; background-color: #F2F2F6; max-width:800px; padding-left:10px; padding-right:10px;">
<tr>
<td height="34" style="font-size: 1px;"><!-- cell --></td>
</tr>
<tr>
<td>
<p style="text-align: center; margin:0; padding: 0; font-family: Arial, Helvetica, sans-serif; font-size:20px; color:#41424e; line-height: 1.4"><b>Your Auto-Renewal Sub</b></p>
</td>
</tr>
<tr>
<td height="20" style="font-size: 1px;"><!-- cell --></td>
</tr>
<tr>
<td>
<p style="text-align: left; margin:0; padding: 0; font-family: Arial, Helvetica, sans-serif; font-size:16px; color:#42ba8f; line-height: 1.4"><b>Product</b></p>
</td>
</tr>
<tr>
<td height="1" style="font-size: 1px;"><!-- cell --></td>
</tr>
<tr>
<td>
<p style="text-align: left; margin:0; padding: 0; font-family: Arial, Helvetica, sans-serif; font-size:16px; color:#41424e; line-height: 1.4">Productname - 1 PC</p>
</td>
</tr>
<tr>
<td height="20" style="font-size: 1px;"><!-- cell --></td>
</tr>
<tr>
<td>
<p style="text-align: left; margin:0; padding: 0; font-family: Arial, Helvetica, sans-serif; font-size:16px; color:#42ba8f; line-height: 1.4"><b>Order ID</b></p>
</td>
</tr>
<tr>
<td height="1" style="font-size: 1px;"><!-- cell --></td>
</tr>
<tr>
<td>
<p style="text-align: left; margin:0; padding: 0; font-family: Arial, Helvetica, sans-serif; font-size:16px; color:#41424e; line-height: 1.4">12131415161</p>
</td>
</tr>
<tr>
<td height="20" style="font-size: 1px;"><!-- cell --></td>
</tr>
<tr>
<td>
<p style="text-align: left; margin:0; padding: 0; font-family: Arial, Helvetica, sans-serif; font-size:16px; color:#42ba8f; line-height: 1.4"><b>Exp Prices charged</b></p>
</td>
</tr>
<tr>
<td height="1" style="font-size: 1px;"><!-- cell --></td>
</tr>
<!--START Price Exp, templates could be in numerous different languages but info like i.e. customername, productname, Order ID, Tracking IDs will always use the same format. -->
<tr>
<td>
<p style="text-align: left; margin:0; padding: 0; font-family: Arial, Helvetica, sans-serif; font-size:16px; color:#41424e; line-height: 1.4">$69.99 (a tax message)</p>
</td>
</tr>
<tr>
<td height="1" style="font-size: 1px;"><!-- cell --></td>
</tr>
<tr>
<td>
<p style="text-align: left; margin:0; padding: 0; font-family: Arial, Helvetica, sans-serif; font-size:16px; color:#41424e; line-height: 1.4">123 kr (b tax message)</p>
</td>
</tr>
<tr>
<td height="1" style="font-size: 1px;"><!-- cell --></td>
</tr>
<tr>
<td>
<p style="text-align: left; margin:0; padding: 0; font-family: Arial, Helvetica, sans-serif; font-size:16px; color:#41424e; line-height: 1.4">999 Pesos (c tax message)</p>
</td>
</tr>
<!--END Price Exps -->
<tr>
<td height="20" style="font-size: 1px;"><!-- cell --></td>
</tr>
<tr>
<td>
<p style="text-align: left; margin:0; padding: 0; font-family: Arial, Helvetica, sans-serif; font-size:16px; color:#42ba8f; line-height: 1.4"><b>Automatically renewed</b></p>
</td>
</tr>
<tr>
<td height="1" style="font-size: 1px;"><!-- cell --></td>
</tr>
<tr>
<td>
<p style="text-align: left; margin:0; padding: 0; font-family: Arial, Helvetica, sans-serif; font-size:16px; color:#41424e; line-height: 1.4">May 20, 2018</p>
</td>
</tr>
<tr>
<td height="42" style="font-size: 1px;"><!-- cell --></td>
</tr>
</table>
</td>
</tr>
</table>
<!--END sum -->
<!-- white-->
<table align="center" cellspacing="0" cellpadding="0" border="0" bgcolor="#fff" style="width:100%; max-width:900px; background-color: #fff;">
<tr>
<td height="15" style="font-size: 1px;"><!-- cell --></td>
</tr>
<tr>
<td>
<table align="center" cellspacing="0" cellpadding="0" border="0" bgcolor="#fff" style="width:100%; background-color: #fff; max-width:800px; padding-left:10px; padding-right:10px;">
<tr>
<td height="30" style="font-size: 1px;"><!-- cell --></td>
</tr>
<tr>
<td>
<p style="text-align: left; margin:0; padding: 0; font-family: Arial, Helvetica, sans-serif; font-size:16px; color:#41424e; line-height: 1.4">If you’d like to check your order status, please sign in to company.com/orders with the login credentials below.</p>
</td>
</tr>
<tr>
<td height="20" style="font-size: 1px;"><!-- cell --></td>
</tr>
<tr>
<td>
<p style="text-align: left; margin:0; padding: 0; font-family: Arial, Helvetica, sans-serif; font-size:16px; color:#41424e; line-height: 1.4"><b>Order ID:</b> 12131415161</p>
</td>
</tr>
<tr>
<td height="1" style="font-size: 1px;"><!-- cell --></td>
</tr>
<tr>
<td>
<p style="text-align: left; margin:0; padding: 0; font-family: Arial, Helvetica, sans-serif; font-size:16px; color:#41424e; line-height: 1.4"><b>Password:</b> stAcKoverFlOwrocks</p>
</td>
</tr>
<tr>
<td height="20" style="font-size: 1px;"><!-- cell --></td>
</tr>
<tr>
<td>
<p style="text-align: left; margin:0; padding: 0; font-family: Arial, Helvetica, sans-serif; font-size:16px; color:#42ba8f; line-height: 1.4"><b>Your Plan</b></p>
</td>
</tr>
<tr>
<td height="1" style="font-size: 1px;"><!-- cell --></td>
</tr>
<tr>
<td>
<p style="text-align: left; margin:0; padding: 0; font-family: Arial, Helvetica, sans-serif; font-size:16px; color:#41424e; line-height: 1.4"><strong>Auto-Renewal Terms</strong><p>By completing your purchase, you have authorized us to do a bunch of legal stuff.</p>
</td>
</tr>
<tr>
<td height="30" style="font-size: 1px;"><!-- cell --></td>
</tr>
<tr>
<td>
<p style="text-align: left; margin:0; padding: 0; font-family: Arial, Helvetica, sans-serif; font-size:16px; color:#41424e; line-height: 1.4"><b>Need help?</b></p>
</td>
</tr>
<tr>
<td height="1" style="font-size: 1px;"><!-- cell --></td>
</tr>
<tr>
<td style="vertical-align: middle;">
<p style="text-align: left; margin:0; padding: 0; font-family: Arial, Helvetica, sans-serif; font-size:16px; color:#41424e; line-height: 1.4">company.com/help</p>
</td>
</tr>
<tr>
<td height="30" style="font-size: 1px;"><!-- cell --></td>
</tr>
<tr>
<td>
<p style="text-align: left; margin:0; padding: 0; font-family: Arial, Helvetica, sans-serif; font-size:16px; color:#41424e; line-height: 1.4">Thanks for trusting us.</p>
</td>
</tr>
<tr>
<td height="34" style="font-size: 1px;"><!-- cell --></td>
</tr>
</table>
</td>
</tr>
</table>
<!-- END white -->
<!--FOOTER-->
<table align="center" cellspacing="0" cellpadding="0" border="0" bgcolor="#777684" style="width:100%; background-color: #E7E7EF; max-width:900px;">
<tr>
<td height="30" style="font-size: 1px;"><!-- cell --></td>
</tr>
<tr>
<td>
<table align="center" cellspacing="0" cellpadding="0" border="0" bgcolor="#777684" style="width:100%; background-color: #E7E7EF; max-width:900px;">
<tr>
<td>
<table><tr><td>
<p style="text-align: left; margin:0; padding: 0; font-family: Arial, Helvetica, sans-serif; font-size:14px; color:#767683; line-height: 1.4">Trouble installing? <u>Visit FAQ</u></p>
<p style="text-align: left; margin:0; padding: 0; font-family: Arial, Helvetica, sans-serif; font-size:14px; color:#767683; line-height: 1.4">Curious for more? <u>Find more</u></p>
</td></tr></table>
</td>
<td>
<table align="right" >
</tr> </table>
</td>
</tr>
<tr>
<td height="30" style="font-size: 1px;"><!-- cell --></td>
</tr>
</table>
</td>
</tr>
</table>
<!--END FOOTER -->
</td>
</tr>
</tbody>
</table>
</body>
</html>
REGEX
(NT\$|SAR)\s(\d{2,5})|\d{1,4}([.,]\d{3})*([\s.,]\d{2,3}|[^\W]\d+(\d{1,4})*\s(kr|zł|Pesos|Kč|Ft|บาท|SAR|₪))
Matches all
1.4">$19.99 (some random text)
1.4">R$20.00
1.4">20.00€
1.4">€25,99
1.4">£15.99
1.4">123 kr
1.4">1234 Ft
1.4">999 Pesos
Output
19.99
20.00
20.00
25.99
15.99
123 kr
1234 Ft
999 Pesos
The last three examples should not have a space and/or any letters following the numbers.
How can I remove them from the output but retain the numbers?
I realize this is likely due to the multiple capture groups I have, so I see three potential solutions:
Refine the Regex to eliminate the overuse of groups (I am not skilled enough to figure this out)...
Somehow write Regex non-capturing groups that result in the desired output. I have sadly learned that (?:) simply doesn't work.
Utilize the SQL function parameters to select subexpressions from REGEXP_SUBSTR. However, this doesn't appear to allow more than one subexpression in the output.
SQL
SELECT
REPLACE(REPLACE(REGEXP_SUBSTR(nnc.MESSAGE, '(NT\$|SAR)\s(\d{2,5})|\d{1,4}([.,]\d{3})*([\s.,]\d{2,3}|[^\W]\d+(\d{1,4})*\s(kr|zł|Pesos|Kč|Ft|บาท|SAR|₪))'),',','.'),' ','') AS EMAIL_PRICE_SENT
FROM tablename
WHERE clause;
That is the full statement with a couple nested REPLACE functions to format the output to the system format.
See Regex in action here: Regex 101 Link.
I know this is the wrong language so it will not provide a 100% accurate test but I find it very helpful before running it against the DB. I am always open for better tool suggestions!
I have spent too much time than I am proud of on this, so any assistance would be much appreciated.
Thanks,
Nick
I have a HTML table on a webpage and the table is empty. It contains no data as the data has been deleted by a previous test.
For this test I would like to check, verify the html table is empty, it contains no data.
What is the best way to check this? I was thinking of using an Xpath like the following:
//table[#id="data_configuration_edit_data_object_tab_address_rules_tb_level_rules_locality"]//tr//td//div[text()=""]
The HTML snippet is:
<table id="data_configuration_edit_data_object_tab_address_rules_tb_level_rules_locality" class="GFNQNVHJE border" cellspacing="0" __gwtcellbasedwidgetimpldispatchingfocus="true" __gwtcellbasedwidgetimpldispatchingblur="true" style="min-width: 350px;">
<thead aria-hidden="false">
<colgroup>
<tbody style="display: none;"/>
<tbody>
<tr>
<td align="center" colspan="2">
<div>
<div class="" style="width: 100%; height: 100%; padding: 0px; margin: 0px;" aria-hidden="false">
<div class="" style="width: 100%; height: 100%;" aria-hidden="false">
<div class="gwt-Label">No data to display.</div>
</div>
</div>
<div style="width: 100%; height: 100%; padding: 0px; margin: 0px; display: none;" aria-hidden="true">
<div class="GFNQNVHBE" style="width: 100%; height: 100%; display: none;" aria-hidden="true">
<div class="gwt-Label"></div>
</div>
</div>
</div>
</td>
</tr>
</tbody>
<tfoot style="display: none;" aria-hidden="true"/>
</table>
Thanks, Riaz
Assuming that the only visible text in the <table> when it is empty is "No data to display.", then you can simplify the XPath as follow (formatted for readability) :
//table[
#id="data_configuration_edit_data_object_tab_address_rules_tb_level_rules_locality"
and
.='No data to display.'
]
xpatheval demo
I'm trying to generate an HTML/CSS combination to display a contact sheet type view of a bunch of photos, each with some text and a form element or two. I'd like the view to fill available width and wrap as needed, in order to get as many images on screen as the user's display can manage. I think a 'ul' is the right container to use, with display set to inline, and I think it's OK to use tables for each of the elements. What I've got so far looks promising in Safari (images that are under-size in either dimension are centered within their cell, wrapping behaves as intended), but fails in FireFox. It also fails the w3c validator (no doctype), but as soon as I specify a doctype the layout breaks (list goes back to displaying in a single column in both browsers).
This is what I have so far:
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<title>Layout test</title>
<style type="text/css">
#contact_sheet li {
list-style-type: none;
display: inline;
text-align: center;
}
#contact_sheet li table {
width: auto;
border-spacing: 0px;
display: inline;
border: thin solid #202020;
background-color: #404040;
color: white;
}
#contact_sheet li th {
height: 250px;
width: 250px;
text-align: center;
vertical-align: middle;
}
#contact_sheet li td {
text-align: center;
}
th img {
border: thin solid green;
}
</style>
</head>
<body>
<ul id="contact_sheet">
<li>
<table>
<tr>
<th><img src="" width="240" height="120" /></th>
</tr>
<tr>
<td>Some text</td>
</tr>
<tr>
<td><input type="checkbox" />Select</td>
</tr>
</table>
</li>
<li>
<table>
<tr>
<th><img src="" width="120" height="240" /></th>
</tr>
<tr>
<td>Some text</td>
</tr>
<tr>
<td><input type="checkbox" />Select</td>
</tr>
</table>
</li>
<li>
<table>
<tr>
<th><img src="" width="120" height="120" /></th>
</tr>
<tr>
<td>Some text</td>
</tr>
<tr>
<td><input type="checkbox" />Select</td>
</tr>
</table>
</li>
</ul>
</body>
</html>
What am I doing wrong?
This happens because when the specific doctype, tables took up the entire width of the page.
Just make them float:left and it will work:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<title>Layout test</title>
<style type="text/css">
#contact_sheet li {
list-style-type: none;
display: inline;
text-align: center;
}
#contact_sheet li table {
width: auto;
border-spacing: 0px;
display: inline;
border: thin solid #202020;
background-color: #404040;
color: white;
}
#contact_sheet li th {
height: 250px;
width: 250px;
text-align: center;
vertical-align: middle;
}
#contact_sheet li td {
text-align: center;
}
table {
float: left;
}
th img {
border: thin solid green;
}
</style>
</head>
<body>
<ul id="contact_sheet">
<li>
<table>
<tr>
<th><img src="" width="240" alt="" height="120" /></th>
</tr>
<tr>
<td>Some text</td>
</tr>
<tr>
<td><input type="checkbox" />Select</td>
</tr>
</table>
</li>
<li>
<table>
<tr>
<th><img src="" width="120" alt="" height="240" /></th>
</tr>
<tr>
<td>Some text</td>
</tr>
<tr>
<td><input type="checkbox" />Select</td>
</tr>
</table>
</li>
<li>
<table>
<tr>
<th><img src="" width="120" alt="" height="120" /></th>
</tr>
<tr>
<td>Some text</td>
</tr>
<tr>
<td><input type="checkbox" />Select</td>
</tr>
</table>
</li>
</ul>
</body>
Tables are at their best when the width can be predetermined. You may be better off without tables for your desired effect. I would suggest simply wrapping each img in a div. Float all the divs left and you're done. You then eliminate the need to specify new table rows, as each new row will be created when the floated divs wrap.
That also may make it easier to apply class styles to each individual image/form.
The main problem with this approach which may make it unworkable is that your images are of indeterminate size. One div would not affect the width of the div below it, leaving you without the order of a grid