JAGeZe - Some Programming Tips

Beware Using UTF8-BOM Encoding in PHP Code
What it might do and how to change it - Press for more details...

Beware Using UTF8-BOM Encoding in PHP Code

Beware Using UTF8-BOM Encoding in PHP Code

Some months ago I wrote a PHP program to send out a mailshot from  a list of email addresses and names...

Somehow my source code on my PC became corrupted so I copied it all from my server using Windows Notepad.

This program would produce a PowerShell script from the data provided, then download it. When testing, the download just didn't work - message "Warning: cannot modify header information - headers already sent by..."! Try as I might, I just kept getting this error... This comes from using the PHP command header() after something has been sent for display! I went through my code line by line and just could not see where this was occurring. After much trawling I came across a suggestion on stackoverflow.com - UTF8-BOM encoding can cause blank lines to be displayed...

So, I looked at my code and yes, the encoding was UTF8-BOM (apparently Windows Notepad does this!). I converted the source using Notepad++ to just UTF8 and lo and behold, all worked as it should work!

A big "Thank You" to stackoverflow.com for the tips - useful in lots of cases I might add but you do have to sort through some of the BS posted by a small number of idiots...



Screen Chopped in Google Blogger?
See how to tweek the blogger template - Press for more details...

Web Page Comments Tip
An idea for some perhaps? - Press for more details...

Web Page Comments Tip

Web Page Comments/Suggestions Tip

So you've produced a really nice web page to be proud of but would like to add something so that your audience can send in feedback - comments, suggestions etc?
I use my blog here to do it - see here for an example! As can be seen, there's a button that opens a popup window containing the relevant blog entry where comments etc can be added.
Doing it this way of course saves all the time and effort in designing, building and testing your own software!

Blogger Share Buttons
Might be useful for some... - Press for more details...

Blogger Share Buttons

For those interested in putting "share" buttons in their Blogger/Blogspot blog, this is what I do, the code below being inserted after the "<body..." tag:-

<div>
<a class='xosocial' href='https://jagjag.biz'><img ALT='JAGeZe' border='0' height='22' src='https://jagjag.biz/JAG.gif' width='22'/></a>
Share with:
<a class='xosocial' expr:href='&quot;https://twitter.com/share?url=&quot; + data:post.url + &quot;&amp;title=&quot; + data:post.title' rel='nofollow' target='_blank' title='Tweet This'><img alt='Twitter' height='22' src='https://jagjag.biz/SWtwitter.png' width='22'/></a>
<a class='xosocial' href='javascript:void((function()%7Bvar%20e=document.createElement(&apos;script&apos;);e.setAttribute(&apos;type&apos;,&apos;text/javascript&apos;);e.setAttribute(&apos;charset&apos;,&apos;UTF-8&apos;);e.setAttribute(&apos;src&apos;,&apos;http://assets.pinterest.com/js/pinmarklet.js?r=&apos;+Math.random()*99999999);document.body.appendChild(e)%7D)());'><img alt='Pinterest' height='22' src='https://jagjag.biz/SWpinterest.png' width='22'/></a>
<a class='xosocial' expr:href='&quot;mailto:?subject=&quot; + data:post.title + &quot;&amp;body=&quot; + data:post.url'><img alt='Email' height='22' src='https://jagjag.biz/SWemail.png' width='22'/></a>
<a class='xosocial' expr:href='&quot;http://www.linkedin.com/shareArticle?mini=true&amp;url=&quot;  + data:post.url' rel='nofollow' target='_blank'><img alt='LinkedIn' height='22' src='https://jagjag.biz/SWlinkedin.png' width='22'/></a>
<a class='xosocial' expr:href='&quot;http://digg.com/submit?phase=2&amp;url=&quot;  + data:post.url' rel='nofollow' target='_blank' title='Digg This'><img alt='Digg' height='22' src='https://jagjag.biz/SWdiggit.png' width='22'/></a>

<a class='xosocial' expr:href='&quot;http://www.stumbleupon.com/submit?url=&quot; + data:post.url + &quot;&amp;title=&quot; + data:post.title' rel='nofollow' target='_blank' title='Stumble this'><img alt='StumbleUpon' height='22' src='https://jagjag.biz/SWstumbleupon.png' width='22'/></a>
<script src='http://static.addtoany.com/menu/page.js' type='text/javascript'/>
<a href='javascript:;' onclick='window.print()'><img alt='Print' height='22' src='https://jagjag.biz/SWprint.png' width='22'/></a>
<a class='xosocial' expr:href='&quot;https://bufferapp.com/add?url=&quot;  + data:post.url' rel='nofollow' target='_blank'><img alt='Bufferapp' height='22' src='https://jagjag.biz/SWbuffer.png' width='22'/></a>
<a class='xosocial' expr:href='&quot;http://reddit.com/submit?url=&quot;  + data:post.url' rel='nofollow' target='_blank'><img alt='LinkedIn' height='22' src='https://jagjag.biz/SWreddit.png' width='22'/></a>
<a class='xosocial' expr:href='&quot;http://www.tumblr.com/share/link?url=&quot;  + data:post.url' rel='nofollow' target='_blank'><img alt='LinkedIn' height='22' src='https://jagjag.biz/SWtumblr.png' width='22'/></a>
<a class='xosocial' expr:href='&quot;http://vkontakte.ru/share.php?url=&quot;  + data:post.url' rel='nofollow' target='_blank'><img alt='LinkedIn' height='22' src='https://jagjag.biz/SWvk.png' width='22'/></a>
<a class='xosocial' expr:href='&quot;http://www.yummly.com/urb/verify?url=&quot;  + data:post.url' rel='nofollow' target='_blank'><img alt='LinkedIn' height='22' src='https://jagjag.biz/SWyummly.png' width='22'/></a>
<a class='xosocial' expr:href='&quot;https://wa.me?text==Check Out  + data:post.url + &quot;' rel='nofollow' target='_blank'><img alt='WhatsApp' height='22' src='https://jagjag.biz/SWWhatsApp.png' width='22'/></a>
<b:if cond='data:post.isFirstPost'>
<script>(function(d){
  var js, id = &#39;facebook-jssdk&#39;; if (d.getElementById(id)) {return;}
  js = d.createElement(&#39;script&#39;); js.id = id; js.async = true;
  js.src = &quot;//connect.facebook.net/en_US/all.js#xfbml=1&quot;;
  d.getElementsByTagName(&#39;head&#39;)[0].appendChild(js);
}(document));</script>
</b:if>
<fb:like action='like' colorscheme='light' expr:href='data:post.canonicalUrl' font='arial' layout='standard' send='true' show_faces='false'/>
</div>

This is probably not the best way to achieve this but it works for me and should work in other blogs as long as there is a method to allow for insertion of HTML! You are welcome to use this if you find it useful but I do ask that you copy the img *.png files to your own server!
ENJOY!


©2002-2020 JAGeZe JAG  Contact Hits:261