Jump to content


  • Content count

  • Joined

  • Last visited

  • Days Won


dsonesuk last won the day on January 22

dsonesuk had the most liked content!

Community Reputation

743 Excellent


About dsonesuk

Recent Profile Visitors

86,904 profile views
  1. Eloquent way to vertically align text and images

    You don't need flex or table styling, vertical-align will achieve that on its own, but you do require container that will use display: inline-block around title(h4?) and paragraph for stacking, which I think is what you meant. With max-width to prevent text extending beyond that of container boundary width. <!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <meta name="viewport" id="viewport" content="target-densitydpi=high-dpi,initial-scale=1.0" /> <title>Document Title</title> <script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script> <script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jqueryui/1.10.4/jquery-ui.min.js"></script> <script type="text/javascript"> </script> <style type="text/css"> .vert-align { text-align: center; } .vert-align > * {vertical-align: middle; display: inline-block; padding: 0 1%; text-align: left; max-width: 73%;} .vert-align img:first-child {max-width: 23%; min-width: 290px; } </style> </head> <body> <div class="vert-align"><img src="https://www.w3schools.com/html/pulpitrock.jpg"/><div><h4>Header TODO write content</h4><p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. </p></div></div> </body> </html>
  2. Blogger HTML posts problem

    This is really messed up, you have menu html content between closing </head> and <body> tags, you have either removed or misplaced closing </div> tag, you also have misplaced closing </a> tag. You should validate at https://validator.w3.org/ to validate your html, at each stage. Also using 0 on its own is perfectly valid and requires no unit after it, if zeroing height, width etc. It look as though the first is the problem section, as the other posts are nested as siblings as they should and not nesting into each other, but this could be how the browser interprets how the code should be, because of any misplaced closing elements
  3. Normalize / @media

    Order is important! What order did you use it? remember styles in stylesheet will normally override styles in previous stylesheets.
  4. W3 Cards Responsive Center Align

    It never loads fully, I get error 400 bad request for ads, it should fully load by 5sec. You should never use full size large images never mind animated large images on website for thumbnails, use smaller sized image thumbnails, then when selected load larger image as pop-up. The larger images can be preloaded using JavaScript AFTER html and thumbnail images, css etc has finished, making it load much quicker especially for mobile devices.
  5. PHP error

    <?php $now = time(); // current time $mailbox = '{your-mailserver-here/imap/novalidate-cert}INBOX'; // see http://www.php.net/manual/en/function.imap-open.php $mbox = imap_open($mailbox, 'email-address-here', 'password-here'); // log in to mail server if (!$mbox) echo ('Failed opening mailbox<br>' . print_r(imap_errors(), true)); // remove the print_r for production use else { $box = imap_check($mbox); // get the inbox for ($imap_idx = 1; $imap_idx <= $box->Nmsgs; $imap_idx++) { // loop through the messages $headers = imap_headerinfo($mbox, $imap_idx); // http://www.php.net/manual/en/function.imap-headerinfo.php $raw_headers = imap_fetchheader($mbox, $imap_idx); // http://www.php.net/manual/en/function.imap-fetchheader.php $selected_headers = ''; $text_part = ''; $html_part = ''; $original_message = imap_body($mbox, $imap_idx); // save the copy of the entire thing, attachments and all // build selected headers string for ($ii = 0; $ii < count($headers->from); $ii++) $selected_headers .= 'From: ' . $headers->from[$ii]->mailbox . '@' . $headers->from[$ii]->host . "\n"; for ($ii = 0; $ii < count($headers->to); $ii++) $selected_headers .= 'To: ' . $headers->to[$ii]->mailbox . '@' . $headers->to[$ii]->host . "\n"; for ($ii = 0; $ii < count($headers->cc); $ii++) $selected_headers .= 'Cc: ' . $headers->cc[$ii]->mailbox . '@' . $headers->cc[$ii]->host . "\n"; for ($ii = 0; $ii < count($headers->bcc); $ii++) $selected_headers .= 'Bcc: ' . $headers->bcc[$ii]->mailbox . '@' . $headers->bcc[$ii]->host . "\n"; if (!empty($headers->date)) $selected_headers .= 'Date: ' . $headers->date . "\n"; if (!empty($headers->subject)) $selected_headers .= 'Subject: ' . $headers->subject . "\n"; // see below; getMsg uses global variables getMsg($mbox, $imap_idx); $text_part = $plainmsg; // text portion of the email $html_part = $htmlmsg; // html portion of the email // check for text portion first $msg_text = trim(strip_tags($plainmsg, '<a>')); if ($msg_text == '') { // text portion is empty, check html portion $msg_text = trim($htmlmsg); if ($msg_text == '') { // no text or html portion auto-detected, check manually $msg_text = imap_body($mbox, $imap_idx); // get the entire raw message // check for quoted-printable encoding with possible boundary markers and headers at the top $chunks = explode("\n", trim($msg_text)); if (count($chunks) > 1) { // if there are multiple lines $quoted_printable = false; if (strpos($chunks[0], '--') === 0) { // if the first line is a boundary marker (starts with '--') array_shift($chunks); // remove the first line if (strpos($chunks[count($chunks) - 1], '--') === 0) { // check the last line array_pop($chunks); // remove that too } } if (strpos(strtolower($chunks[0]), 'content-type') === 0) array_shift($chunks); // remove the first line if it's a content-type header if (strpos(strtolower($chunks[0]), 'content-transfer-encoding') === 0) { if (strpos(strtolower($chunks[0]), 'quoted-printable')) $quoted_printable = true; // this email was sent using quoted-printable encoding array_shift($chunks); // remove the content-transfer-encoding header } $msg_text = implode("\n", $chunks); // put the remaining lines back together if ($quoted_printable) $msg_text = quoted_printable_decode($msg_text); $msg_text = utf8_decode($msg_text); } } } $from = trim($headers->from[0]->mailbox . '@' . $headers->from[0]->host); $msgId = isset($headers->message_id) ? trim($headers->message_id) : ''; $time = strtotime($headers->date); if ($time == 0) $time = $now; /* * **************************************************** At this point: $headers: the object returned from imap_headerinfo $selected_headers: text of some headers to display to a user checking mail (subject, from, etc) $text_part: the text portion, if found $html_part: the html portion, if found $msg_text: either the text part, html part, or manually-decoded part (this is the variable to use as email body) $original_message: the entire unprocessed email body, includingall parts and any attachments $from: From address $msgId: message ID from the headers $time: email delivery time, as a Unix timestamp $attachments: array of attachments (see below) ***************************************************** */ // process attachments foreach ($attachments as $filename => $data) { // e.g. file_put_contents('attachments/' . $filename, $data); } // flag the email for deletion imap_delete($mbox, $imap_idx); } // delete emails and close the mailbox imap_expunge($mbox); imap_close($mbox); } function getMsg($mbox, $mid) { // input $mbox = IMAP stream, $mid = message id // output all the following: global $htmlmsg, $plainmsg, $charset, $attachments; // the message may in $htmlmsg, $plainmsg, or both $htmlmsg = $plainmsg = $charset = ''; $attachments = array(); // HEADER $h = imap_header($mbox, $mid); // add code here to get date, from, to, cc, subject... // BODY $s = imap_fetchstructure($mbox, $mid); if (empty($s->parts)) // not multipart getMsgPart($mbox, $mid, $s, 0); // no part-number, so pass 0 else { // multipart: iterate through each part foreach ($s->parts as $partno0 => $p) getMsgPart($mbox, $mid, $p, $partno0 + 1); } } function getMsgPart($mbox, $mid, $p, $partno) { // $partno = '1', '2', '2.1', '2.1.3', etc if multipart, 0 if not multipart global $htmlmsg, $plainmsg, $charset, $attachments; // DECODE DATA $data = ($partno) ? imap_fetchbody($mbox, $mid, $partno) : // multipart imap_body($mbox, $mid); // not multipart // Any part may be encoded, even plain text messages, so check everything. if ($p->encoding == 4) $data = quoted_printable_decode($data); elseif ($p->encoding == 3) $data = base64_decode($data); // no need to decode 7-bit, 8-bit, or binary // PARAMETERS // get all parameters, like charset, filenames of attachments, etc. $params = array(); if ($p->ifparameters) foreach ($p->parameters as $x) $params[strtolower($x->attribute)] = $x->value; if ($p->ifdparameters) foreach ($p->dparameters as $x) $params[strtolower($x->attribute)] = $x->value; // ATTACHMENT // Any part with a filename is an attachment, // so an attached text file (type 0) is not mistaken as the message. if (!empty($params['filename']) || !empty($params['name'])) { // filename may be given as 'Filename' or 'Name' or both $filename = (!empty($params['filename'])) ? $params['filename'] : $params['name']; // filename may be encoded, so see imap_mime_header_decode() $attachments[$filename] = $data; // this is a problem if two files have same name } // TEXT elseif ($p->type == 0 && $data) { // Messages may be split in different parts because of inline attachments, // so append parts together with blank row. if ($p->ifsubtype && strtolower($p->subtype) == 'plain') $plainmsg .= trim($data) . "\n\n"; else $htmlmsg .= $data . "<br><br>"; $charset = $params['charset']; // assume all parts are same charset } // EMBEDDED MESSAGE // Many bounce notifications embed the original message as type 2, // but AOL uses type 1 (multipart), which is not handled here. // There are no PHP functions to parse embedded messages, // so this just appends the raw source to the main message. elseif ($p->type == 2 && $data) { $plainmsg .= trim($data) . "\n\n"; } // SUBPART RECURSION if (!empty($p->parts)) { foreach ($p->parts as $partno0 => $p2) getMsgPart($mbox, $mid, $p2, $partno . '.' . ($partno0 + 1)); // 1.2, 1.2.1, etc. } } ?>
  6. PHP error

    No! it highlights error caused by missing '{' saying unexpected elseif, and suggest possible syntax error with preceding error '{'. which turns out to be correct, so working way down I found '}' embedded in comment.
  7. PHP error

    its a comment should have // at beginning; This // assume all parts are same charset } // EMBEDDED MESSAGE the curly bracket at end is part of elseif condition should be // assume all parts are same charset } // EMBEDDED MESSAGE
  8. W3 Cards Responsive Center Align

    I had a hard job loading on desktop, god knows what it will be like for smaller devices. All these cards use float left, they won't centre while float: left; is used.
  9. How to get an iframe with no borders ?

    Get rid misplaced '}', double quote after width. Height with percentage value unit won't work, it has to be unit of 'px' or 'vh'.
  10. meaning of *{

  11. meaning of *{

    Universal selector for all element whatever they are.
  12. margin-right in my body

    First off, don't use container class on body, without it it will be 100% width, by default, also don't use deprecated center tags. If you want a element to be full width use container-fluid class, these container classes have padding either side of 15px, with a .row class within them, which has a -15px margin either side it will make this .row container same width as .container class, but! content will not go beyond padding. IF you don't use .container classes without this padding and you use row class, because it does not have the same padding width to counteract -15px margin, these margin will extend beyond the 100% container width, larger than the browser width, so scrollbars will appear. So like I mentioned before, use bootstrap as intended container classes outside, .row classes inside, OR create custommized .gutterless class (not part of bootstrap) .gutterless, .gutterless > .row { margin: 0; padding: 0; } element texto-h2, and div elements without any class or container class with direct child elements using .row are the problem.
  13. margin-right in my body

    If you use width: 100% on block elements with margin or padding, the total width will be 100% of parent element available width + margin and padding of this element. Without access to this site, there's not much more we can suggest.
  14. How to position elements correctly

    ??????????? 1) row1 one column 2) row2 three columns 3) row3 two columns Using margins, float or display: block/inline-block
  15. margin-right in my body

    Its a 15px padding and margin gutter, on each side, if you do not follow the way bootstrap uses these correctly spaces will appear because -15px margins make container wider than intended. The other option is to produce a '.gutterless' class specifically for removing these when required.