PHP https://www.kennycarlile.com/ en Flash Chord - Practice chords, scales, or arpeggios with an endless stream of randomized chords! https://www.kennycarlile.com/blog/2020-07-28/flash-chord-practice-chords-scales-or-arpeggios-with-an-endless-stream-of <span>Flash Chord - Practice chords, scales, or arpeggios with an endless stream of randomized chords!</span> <div class="field field--name-field-blog-body field--type-text-long field--label-hidden field--item"><p><a href="http://www.flashchord.com/"><img alt="Flash Chord - Practice chords, scales, or arpeggios with an endless stream of randomized chords!" src="http://www.flashchord.com/images/flash-chord-logo.png" /></a></p> <p>I've recently published a new project called <a href="http://www.flashchord.com/">Flash Chord (at FlashChord.com)</a>&nbsp;which is a web-based tool for practicing chords, scales, and arpeggios against an endless stream of randomized chords.</p> <p>I've used various backing tracks and other tools, like <a href="https://irealpro.com/">iReal Pro</a>, for practicing chords and scales, but those tools require you to enter the chords ahead of time or use a pre-built track for practicing. This is great, but it allows you to fall into patterns of comfort without really challenging you to learn every part of your instrument. I couldn't find any tools that I thought met all the requirements for which I was looking, so I decided to create Flash Chord as a free web-based tool that would work for any instrument to help musicians practice.</p> <p>Flash Chord is configurable for various difficulty options which makes it usable for all levels of musicians. Configuration options include:</p> <ul> <li>Tempo</li> <li>Bars per chord</li> <li>Time signature</li> <li>Key</li> <li>Chord types</li> <li>Chord extensions</li> <li>Toggle rare enharmonic equivalents&nbsp;(C♭, B♯, F♭, E♯)</li> <li>Toggle next chord</li> <li>Toggle audible metronome</li> <li>Toggle visual metronome</li> </ul> <p><a href="https://github.com/KCarlile/flashchord">Flash Chord is also an open source project on GitHub</a>, so if you'd like to help contribute in any way (code, testing, documentation, etc.), please head over there and get involved.</p> <p>To stay updated on the latest with Flash Chord, be sure to&nbsp;<a href="https://twitter.com/flash_chord">follow us on Twitter&nbsp;<i class="fab fa-twitter" aria-hidden="true"></i>&nbsp;@Flash_Chord</a>.</p> </div> <span><span lang="" about="/user/1" typeof="schema:Person" property="schema:name" datatype="">Kenny</span></span> <span>Tue, 07/28/2020 - 12:32</span> <div class="field field--name-field-blog-category field--type-entity-reference field--label-inline"> <div class="field--label">Category</div> <div class="field--items"> <div class="field--item"><a href="/blog/categories/web-development" hreflang="en">Web Development</a></div> </div> </div> <div class="field field--name-field-tags field--type-entity-reference field--label-above"> <div class="field--label">Tags</div> <div class="field--items"> <div class="field--item"><a href="/taxonomy/term/106" hreflang="en">Music</a></div> <div class="field--item"><a href="/taxonomy/term/331" hreflang="en">Music Theory</a></div> <div class="field--item"><a href="/taxonomy/term/21" hreflang="en">Guitar</a></div> <div class="field--item"><a href="/taxonomy/term/64" hreflang="en">PHP</a></div> <div class="field--item"><a href="/taxonomy/term/336" hreflang="en">JavaScript</a></div> <div class="field--item"><a href="/taxonomy/term/341" hreflang="en">jQuery</a></div> <div class="field--item"><a href="/taxonomy/term/56" hreflang="en">CSS</a></div> <div class="field--item"><a href="/taxonomy/term/346" hreflang="en">Bootstrap</a></div> </div> </div> <section> <h2>Add new comment</h2> <drupal-render-placeholder callback="comment.lazy_builders:renderForm" arguments="0=node&amp;1=1386&amp;2=field_blog_comments&amp;3=comment" token="-cLVq34bS2pjsbVdRCNj_CXZPmjjrnhqv3s_8xIgLHI"></drupal-render-placeholder> </section> Tue, 28 Jul 2020 19:32:36 +0000 Kenny 1386 at https://www.kennycarlile.com Sending Email From PHP On GoDaddy (And Possibly Other Hosts) https://www.kennycarlile.com/blog/2008-06-16/sending-email-from-php-on-godaddy-and-possibly-other-hosts <span>Sending Email From PHP On GoDaddy (And Possibly Other Hosts)</span> <div class="field field--name-field-blog-body field--type-text-long field--label-hidden field--item"><p>Recently, while working on the temporary site for <a href="http://www.moonfar.com/">Moonfar</a>, I wanted to send the user an email as confirmation that they had signed up for email notifications. Essentially, you define the recipient, the subject line, the body, a few headers, and then call the <code class="prettyprint">mail()</code> function while passing those parameters to it. PHP's <code class="prettyprint">mail()</code> function does the rest, provided that your host has PHP configured properly.</p> <p>Let me preface this by saying that I've only tested this on GoDaddy's Linux Deluxe Hosting plan. If you are trying to do this with another web host, you need to make sure that the install of PHP you are using supports the <code class="prettyprint">mail()</code> function.</p> <pre class="prettyprint"> &lt;?php $to = 'user@theirdomain.com'; $subject = 'Your subject line'; // the message here is HTML, but you could // use plain text in the same manner // this could also be pulled from a template file $message = ' &lt;html&gt; &lt;head&gt; &lt;title&gt;Your Title Here&lt;/title&gt; &lt;/head&gt; &lt;body&gt; &lt;p&gt;Your content here...&lt;/p&gt; &lt;/body&gt; &lt;/html&gt;'; // To send HTML mail, the Content-type header must be set $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; // Additional headers // I'm not sure how the To: field in the header functions since it's part // of the function call, so I've commented it out here //$headers .= 'To: ' . $emailAddr . "\r\n"; $headers .= 'From: YourName &lt;you@yourdomain.com&gt;' . "\r\n"; $headers .= 'Cc: ' . "\r\n"; // if you want to receive a copy $headers .= 'Bcc: you@yourdomain.com' . "\r\n"; // Mail it mail($to, $subject, $message, $headers); ?&gt;</pre> <p>It's as easy as that. That said, I read somewhere that there is a 1000 emails per day limit using this method on GoDaddy without paying for outbound emailing services, but I could be mistaken.</p> </div> <span><span lang="" about="/user/1" typeof="schema:Person" property="schema:name" datatype="">Kenny</span></span> <span>Mon, 06/16/2008 - 22:37</span> <div class="field field--name-field-blog-category field--type-entity-reference field--label-inline"> <div class="field--label">Category</div> <div class="field--items"> <div class="field--item"><a href="/blog/categories/web-development" hreflang="en">Web Development</a></div> </div> </div> <div class="field field--name-field-tags field--type-entity-reference field--label-above"> <div class="field--label">Tags</div> <div class="field--items"> <div class="field--item"><a href="/taxonomy/term/17" hreflang="en">Web Development</a></div> <div class="field--item"><a href="/taxonomy/term/19" hreflang="en">GoDaddy</a></div> <div class="field--item"><a href="/taxonomy/term/64" hreflang="en">PHP</a></div> <div class="field--item"><a href="/taxonomy/term/65" hreflang="en">Email</a></div> </div> </div> <section> <h2>Add new comment</h2> <drupal-render-placeholder callback="comment.lazy_builders:renderForm" arguments="0=node&amp;1=17&amp;2=field_blog_comments&amp;3=comment" token="aF_f2aYW3SGRfmrsffb5fOJlN5wEXJibvMUiQKm2VjE"></drupal-render-placeholder> </section> Tue, 17 Jun 2008 05:37:26 +0000 Kenny 17 at https://www.kennycarlile.com Eternally Up To Date Copyrights https://www.kennycarlile.com/blog/2007-07-25/eternally-up-to-date-copyrights <span>Eternally Up To Date Copyrights</span> <div class="field field--name-field-blog-body field--type-text-long field--label-hidden field--item"><p>I can't tell you how many times, both personally and professionally, I've come across web sites that have out of date copyright dates. A living, breathing, up to date site should have a current copyright date somewhere on the page, usually in the footer. Changing the year is easy enough if it's static, but it's one of those things you have to remember to do (and you have to know how to do it). If your code isn't modularized (that is, if every page has the copyright date hard coded), then having to change these dates each year could be a very laborious process, even if you're savvy enough to use a global find and replace.</p> <p>Why should you even have to make this update by hand? The web page should know that the copyright year is always the current year. There are a couple of ways to do this, depending on what you have available on your web server.</p> <h3>Concept</h3> <p>The concept behind this technique is very simple. You simple replace the year with a dynamically written number pulled from the supporting language's date functions. Here is the static code that we will start with:</p> <pre class="prettyprint"> &lt;p&gt;Copyright &amp;#169;2007 Your Web Site&lt;/p&gt;</pre> <p>By the way, &amp;#169; is the © symbol.</p> <h3>Client-side Code Method</h3> <p>If you don't have any access to a dynamic server-side technology such as PHP, Java, Python, Perl, .NET, or some other programming language, then you will need to use Javascript. Here's an example of generating the year dynamically with client-side Javascript:</p> <pre class="prettyprint"> &lt;p&gt;Copyright &amp;#169; &lt;script type="text/javascript"&gt; var date = new Date(); document.write(date.getFullYear()); &lt;/script&gt; Your Web Site&lt;/p&gt;</pre> <p>The downside to this method is that, since the date is rendered by the browser, it is dependent upon the client's environment. If the user has Javascript disabled or if there is just some other unpredictable variable in the client's browser then the copyright year will be completely missing rather than just a year or two out of date. The other problem that arises is this: if the client's computer has the year set to 1963, then the copyright date on the web page will appear as 1963.</p> <h3>Server-side Code Method</h3> <p>If you have the ability to utilize a server-side technology, such as PHP, then you should. This method is preferred because you control the behavior and the date is written to the client as plain text. That is, it is rendered on the server and then streamed to the client as plain text. Here's an example in PHP of server-side dynamic copyright year text:</p> <pre class="prettyprint"> &lt;p&gt;Copyright &amp;#169;&lt;?php echo date('Y'); ?&gt; Your Web Site&lt;/p&gt;</pre> <p>I could list out a dozen examples of how to dynamically generate the year, but I would probably end up leaving out the specific language that you are looking for. You can use this technique with any language. Yes, I know this isn't a ground-breaking technique, it's just printing the year, but I've seen enough examples of people with out of date copyright years that I thought this was a worthwhile tip to share. Good luck.</p> </div> <span><span lang="" about="/user/1" typeof="schema:Person" property="schema:name" datatype="">Kenny</span></span> <span>Wed, 07/25/2007 - 22:48</span> <div class="field field--name-field-blog-category field--type-entity-reference field--label-inline"> <div class="field--label">Category</div> <div class="field--items"> <div class="field--item"><a href="/blog/categories/web-development" hreflang="en">Web Development</a></div> </div> </div> <div class="field field--name-field-tags field--type-entity-reference field--label-above"> <div class="field--label">Tags</div> <div class="field--items"> <div class="field--item"><a href="/taxonomy/term/17" hreflang="en">Web Development</a></div> <div class="field--item"><a href="/taxonomy/term/64" hreflang="en">PHP</a></div> <div class="field--item"><a href="/taxonomy/term/81" hreflang="en">Dates</a></div> </div> </div> <section> <h2>Add new comment</h2> <drupal-render-placeholder callback="comment.lazy_builders:renderForm" arguments="0=node&amp;1=27&amp;2=field_blog_comments&amp;3=comment" token="a3hwmZDJbiAJ569rEIXJYUfTF3BaDQbUaOh1gRHfc5g"></drupal-render-placeholder> </section> Thu, 26 Jul 2007 05:48:38 +0000 Kenny 27 at https://www.kennycarlile.com Spam-proof MailTo Links https://www.kennycarlile.com/blog/2007-07-13/spam-proof-mailto-links <span>Spam-proof MailTo Links</span> <div class="field field--name-field-blog-body field--type-text-long field--label-hidden field--item"><p>I like providing links for e-mail on web pages, but I hate that spam-bots scrape sites looking for e-mail addresses linked in the usual manner. There are many hacks to try to avoid spam-bots</p> <h3>The Cander Method Version 1 (AKA: "Make The User Do The Work")</h3> <p>Named for a friend that I learned this from, one way to avoid this is to use ineffective links that require a person to modify address before sending it. Here's an example:</p> <pre class="prettyprint"> &lt;a href="someuser_AT_somedomain_DOT_com"&gt;someuser_AT_somedomain_DOT_com&lt;/a&gt;</pre> <p>...which appears as...</p> <p><a href="someuser_AT_somedomain_DOT_com">someuser_AT_somedomain_DOT_com</a></p> <p>While this isn't spam-proof, it's spam-resistant. However, as I said, the user would then have to replace <em>_AT_</em> with <em>@</em> and <em>_DOT_</em> with <em>.</em> in order for the e-mail address to be valid.</p> <h3>The Cander Method Version 2 (AKA: "Promiscuous Links, Strong Immune System")</h3> <p>The theory behind this method is "ah, screw it". Well, kinda. This method, also gleamed from the same friend, employs a standard mailto link that is completely vulnerable to spam-bots. Rather than try to trick spam-bots, you just resign yourself to the fact that spam is part of life and it's more important provide users with a good link. The spam protection is then handled by a good spam filter or by redirecting all your e-mail to a Gmail account, which is famously known for it's fantastic spam filtering. While I understand this approach, I still think that a good offense is the best defense.</p> <h3>The Corporate Method</h3> <p>Form e-mail is also a good option if your server supports it. That is, you can setup a script to take text from a standard HTML form and submit it via e-mail to you. This requires a bit more code and monkeying with the server to make sure that the web server is up and functioning and some web hosts may not even allow for this.</p> <h3>The Script-Redirect Method</h3> <p>Another method that I ran across (again, compiled from many sources and some original tinkering) is to provide a redirect that prevents spam-bots from scraping the address. The downside to this method is that you don't display the text of the e-mail address. The upside of this method is that the link works as-is and the user doesn't have to clean up the address before sending the e-mail. Here's how it works:</p> <pre class="prettyprint"> &lt;a href="mailto.php?u=someuser&amp;d=somedomain.com" onclick="target='_blank';" onmouseover="this.style.cursor='pointer';"&gt;E-mail&lt;/a&gt;</pre> <p>Incidentally, the <em>onclick</em> and <em>onmouseover</em> events provide an XHTML Strict method of opening a new window without using extensive Javascript.</p> <p>Place the preceding link wherever you'd like the e-mail link to occur. You'll notice that the link points to another script called <strong>mailto.php</strong> and it has a couple query string parameters. The <em>u</em> parameter refers to the username in the e-mail address (everything before the @) and the <em>d</em> parameter refers to the host (everything after the @).</p> <p>Now that we have the link setup, we need the script that we are actually calling: <strong>mailto.php</strong>. This is the really easy part. It's one single line that pulls the query string parameters, puts them into standard e-mail address form, and redirects the browser to the mailto link. It's as simple as that. Here's the script for <strong>mailto.php</strong>:</p> <pre class="prettyprint"> &lt;?php // pull values from query string and // redirect to a mailto link header("Location: mailto:$_GET[u]@$_GET[d]"); ?&gt;</pre> <p>While this may not fool all of the spam-bots out there, it should hopefully cut down on a significant bulk of spam that you might incur from posting a link to your e-mail address.</p> </div> <span><span lang="" about="/user/1" typeof="schema:Person" property="schema:name" datatype="">Kenny</span></span> <span>Fri, 07/13/2007 - 22:03</span> <div class="field field--name-field-blog-category field--type-entity-reference field--label-inline"> <div class="field--label">Category</div> <div class="field--items"> <div class="field--item"><a href="/blog/categories/web-development" hreflang="en">Web Development</a></div> </div> </div> <div class="field field--name-field-tags field--type-entity-reference field--label-above"> <div class="field--label">Tags</div> <div class="field--items"> <div class="field--item"><a href="/taxonomy/term/17" hreflang="en">Web Development</a></div> <div class="field--item"><a href="/taxonomy/term/65" hreflang="en">Email</a></div> <div class="field--item"><a href="/taxonomy/term/88" hreflang="en">Spam</a></div> <div class="field--item"><a href="/taxonomy/term/64" hreflang="en">PHP</a></div> </div> </div> <section> <h2>Add new comment</h2> <drupal-render-placeholder callback="comment.lazy_builders:renderForm" arguments="0=node&amp;1=30&amp;2=field_blog_comments&amp;3=comment" token="LUsqyib8Nl62guCFKZHLxak9ymOGimis4ahdLWzFAfE"></drupal-render-placeholder> </section> Sat, 14 Jul 2007 05:03:29 +0000 Kenny 30 at https://www.kennycarlile.com Make A File Dropbox For Quick Downloads https://www.kennycarlile.com/blog/2007-07-13/make-a-file-dropbox-for-quick-downloads <span>Make A File Dropbox For Quick Downloads</span> <div class="field field--name-field-blog-body field--type-text-long field--label-hidden field--item"><p>I frequently need to setup a quick and temporary link for file download either for myself or others, but I hate having to create a new page with links to files that are only going to exist for a few hours. Apache and other web servers often provide this functionality with directory browsing, but I usually want directory browsing disabled or the server that I'm using (that isn't mine) has directory browsing disabled and I can't turn it on.</p> <p>I wrote (and by "wrote", I mean "wrote some, borrowed some from all over the web--yes, I know I'm not the first to write a script like this) this script to parse a directory and display links for all the files in that folder.</p> <p>Take the script below and either create a folder called 'files' in the same directory as this file or you can modify the <em>$filesDir</em> variable to point to the location that you'd like to place your temporary downloads. For example, on my server, I have a folder under the root called downloads (<em>http://myserver.com/downloads/</em>) and I place this script in the folder and name it <strong>index.php</strong>. Within <em>downloads/</em>, I have another folder called files where I place the files for download.</p> <p>If you want the files in the same folder as the script (that is, you want them all at the same level), I've included a check before the links are displayed to make sure that it's not displaying <strong>index.php</strong>.&nbsp;<span style="line-height: 1.6em;">If you don't call this script </span><strong style="line-height: 1.6em;">index.php</strong><span style="line-height: 1.6em;">, you'll need to modify that piece of the code.</span></p> <p>Let me know if you have any questions or comments. As with the usual disclaimer, I'm sure there are enhancements that can be made to this for both performance and security and the code comes as-is and without warranty. :)</p> <pre class="prettyprint"> &lt;?xml version="1.0" encoding="iso-8858-1" ?&gt; &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"&gt; &lt;html&gt; &lt;head&gt; &lt;title&gt;Download Dropbox&lt;/title&gt; &lt;/head&gt; &lt;body&gt; &lt;h1&gt;Download Dropbox&lt;/h1&gt; &lt;hr /&gt; &lt;?php $filesDir = './files/'; // where you intend to drop files // relative to this page $files = array(); $dir = opendir($filesDir); // get the list of files while(($file = readdir($dir)) !== false) { // ignore directories and special files that // we don't care about // .DS_Store is a Mac system file that I // don't want displayed if($file !== '.' &amp;&amp; $file !== '..' &amp;&amp; !is_dir($file) &amp;&amp; ($file !== '.DS_Store')) { $files[] = $file; } // end if test } // end while loop closedir($dir); if(count($files) &lt; 1) { echo "&lt;p&gt;There were no files found.&lt;/p&gt;n"; } // end if test else { // display links for download natcasesort($files); // sort files echo "&lt;ul&gt;n"; for($i = 0; $i &lt; count($files); $i++) { if($files[$i] != "index.php") { echo "&lt;li&gt;&lt;a href=\"files/" . $files[$i] . "\"&gt;" . $files[$i] . "&lt;/a&gt;&lt;/li&gt;n"; } // end if test } // end for loop echo "&lt;/ul&gt;n"; } // end else test ?&gt; &lt;/body&gt;</pre> </div> <span><span lang="" about="/user/1" typeof="schema:Person" property="schema:name" datatype="">Kenny</span></span> <span>Fri, 07/13/2007 - 09:30</span> <div class="field field--name-field-blog-category field--type-entity-reference field--label-inline"> <div class="field--label">Category</div> <div class="field--items"> <div class="field--item"><a href="/blog/categories/web-development" hreflang="en">Web Development</a></div> </div> </div> <div class="field field--name-field-tags field--type-entity-reference field--label-above"> <div class="field--label">Tags</div> <div class="field--items"> <div class="field--item"><a href="/taxonomy/term/17" hreflang="en">Web Development</a></div> <div class="field--item"><a href="/taxonomy/term/64" hreflang="en">PHP</a></div> <div class="field--item"><a href="/taxonomy/term/85" hreflang="en">Drop Box</a></div> <div class="field--item"><a href="/taxonomy/term/86" hreflang="en">Files</a></div> <div class="field--item"><a href="/taxonomy/term/87" hreflang="en">Download</a></div> </div> </div> <section> <h2>Add new comment</h2> <drupal-render-placeholder callback="comment.lazy_builders:renderForm" arguments="0=node&amp;1=29&amp;2=field_blog_comments&amp;3=comment" token="9kYJqJN_nL4QNtjWT8YsPb_jXY2Bv9NrASHDdb5feiU"></drupal-render-placeholder> </section> Fri, 13 Jul 2007 16:30:31 +0000 Kenny 29 at https://www.kennycarlile.com https://www.kennycarlile.com/blog/2007-07-13/make-a-file-dropbox-for-quick-downloads#comments Turn Blogger Into Your Own Blog https://www.kennycarlile.com/blog/2007-07-06/turn-blogger-into-your-own-blog <span>Turn Blogger Into Your Own Blog</span> <div class="field field--name-field-blog-body field--type-text-long field--label-hidden field--item"><p>Recently I was working with a client who wanted a blog for their site but they didn't have the money (and I didn't have the time) for a completely one-off solution. The initially proposed solution was to simply make the "Blog" link point to a <a href="http://www.blogger.com/" target="_blank" title="Blogger">Blogger </a>(which was purchased by Google a while back, if you missed it) site for the client. I didn't feel very comfortable with this idea because I didn't think it would look very professional to link to a free blogging site, so I started out by using the template editor that Blogger provides to mimic the client's site. While this was a better solution, it still didn't seem professional enough. The site was still a Blogger site; the URL was Blogger's and I couldn't exactly match the look-and-feel of the client's site.</p> <p>This is when I remembered that Blogger (as many with many other sites) provides an XML-based RSS feed of each individual blog. Why not consume the RSS feed and redisplay the content on the client's site?! This technique allowed me to utilize the blog publishing and management tools from Blogger while full integrating the blog into the client's site. Now, instead of linking to an external site for the blog, I would just create a page that scraped the RSS feed, parsed the XML, iterated over the entries, and displayed the content.</p> <p>Now for the meat. First, you need to create a Blogger account (if you have a Google/Gmail/G-anything account, that will work), then create a blog under that account and enter some dummy posts. Make sure that your blog has site feeds enabled; consult the Blogger help if you can't figure this out. Once you have that setup, your blog's feed can be found at http://someblog.blogspot.com/feeds/posts/default?alt=rss where "someblog" is the name of your blog in your URL. Also, you'll notice that I've appended ?alt=rss to the link. This is mentioned in the Blogger documentation in reference to forcing the feed into RSS format rather than Atom.</p> <p><span style="line-height: 1.6em;">The following PHP code example shows a function that parses an RSS feed into a 2D array for display within your site. </span><strong style="line-height: 1.6em;">Note:</strong><span style="line-height: 1.6em;"> </span><em style="line-height: 1.6em;">the simplexml_load_file() function is part of PHP5, so you'll need to make sure that your server is running PHP5 if you want to use this code directly.</em></p> <pre class="prettyprint"> &lt;?php function getBlogPosts($blogFeedURL) { $xml = simplexml_load_file($blogFeedURL); $posts = array(); if($xml) { // get all posts foreach($xml-&gt;channel-&gt;item as $post) { $posts[] = array('title' =&gt; $post-&gt;title, 'pubDate' =&gt; $post-&gt;pubDate, 'description' =&gt; $post-&gt;description); } // end foreach loop } // end if test return $posts; } // end getBlogPosts function ?&gt;</pre> <p>This next block of code utilizes this function and iterates over the 2D array to display the blogs. Also, I've incorporated the concept of paging where you can specify the number of posts to display at a given time and paging links are found at the top and bottom of each page.</p> <pre class="prettyprint"> &lt;?php global $blogFeedURL; // defined globally, URL to RSS feed global $blogPostsPerPage; // defined globally, used for paging $posts = getBlogPosts($blogFeedURL); if(count($posts) &lt; 1) { ?&gt; &lt;p&gt;There are no posts currently available.&lt;/p&gt; &lt;?php } // end if test else { // get paging index from query string $firstPost = (array_key_exists('first', $_GET) &amp;&amp; is_numeric($_GET['first'])) ? $_GET['first'] : 0; // if first post index plus offset is more than total posts, // set last post to total number of posts $lastPost = (($firstPost + $blogPostsPerPage) &gt; count($posts)) ? count($posts) : ($firstPost + $blogPostsPerPage); // previous page link if($firstPost &gt; 0) { $first = (($firstPost - $blogPostsPerPage) &lt; 0) ? 0 : ($firstPost - $blogPostsPerPage); ?&gt; &lt;p&gt;&lt;a href="&lt;?php echo $_SERVER['PHP_SELF'] . '?first=' . $first; ?&gt;"&gt;Previous Page&lt;/a&gt;&lt;/p&gt; &lt;?php } // end if test // next page link if($lastPost &lt; count($posts)) { $first = (($firstPost + $blogPostsPerPage) &gt; count($posts)) ? count($posts) : ($firstPost + $blogPostsPerPage); ?&gt; &lt;p&gt;&lt;a href="&lt;?php echo $_SERVER['PHP_SELF'] . '?first=' . $first; ?&gt;"&gt;Next Page&lt;/a&gt;&lt;/p&gt; &lt;?php } // end if test // display only those for this page for($i = $firstPost; $i &lt; $lastPost; $i++) { $title = $posts[$i]['title']; $pubDate = date('D, M j, Y g:i A', strtotime($posts[$i]['pubDate'])); $description = $posts[$i]['description']; ?&gt; &lt;div&gt; &lt;p&gt;&lt;?php echo $title; ?&gt;&lt;/p&gt; &lt;p&gt;&lt;?php echo $pubDate; ?&gt;&lt;/p&gt; &lt;p&gt;&lt;?php echo $description; ?&gt;&lt;/p&gt; &lt;/div&gt; &lt;?php } // end foreach loop // previous page link if($firstPost &gt; 0) { $first = (($firstPost - $blogPostsPerPage) &lt; 0) ? 0 : ($firstPost - $blogPostsPerPage); ?&gt; &lt;p&gt;&lt;a href="&lt;?php echo $_SERVER['PHP_SELF'] . '?first=' . $first; ?&gt;"&gt;Previous Page&lt;/a&gt;&lt;/p&gt; &lt;?php } // end if test // next page link if($lastPost &lt; count($posts)) { $first = (($firstPost + $blogPostsPerPage) &gt; count($posts)) ? count($posts) : ($firstPost + $blogPostsPerPage); ?&gt; &lt;p&gt;&lt;a href="&lt;?php echo $_SERVER['PHP_SELF'] . '?first=' . $first; ?&gt;"&gt;Next Page&lt;/a&gt;&lt;/p&gt; &lt;?php } // end if test } // end else test ?&gt;</pre> <p>As I said earlier, the great thing about this method is that someone else (Google and Blogger) did all the hard work for you. The downside is that you have to login to Blogger to post content, but I think that's a small price to pay for the amount of work that is already done for you. You get the layout-free content and you can style it yourself and embed it in your own site as you see fit. Alternately, you could of course do this in Python, Java, .Net, or any language that you can make an HTTP call and then parse the XML.</p> <p>As for the usual caveats, I'm sure there are ways to improve the security, add layers of error checking, use objects instead of a 2D array, so feel free to modify as you wish. This is where the "This software is presented as-is and without warranty..." bit goes.</p> </div> <span><span lang="" about="/user/1" typeof="schema:Person" property="schema:name" datatype="">Kenny</span></span> <span>Fri, 07/06/2007 - 21:20</span> <div class="field field--name-field-blog-category field--type-entity-reference field--label-inline"> <div class="field--label">Category</div> <div class="field--items"> <div class="field--item"><a href="/blog/categories/web-development" hreflang="en">Web Development</a></div> </div> </div> <div class="field field--name-field-tags field--type-entity-reference field--label-above"> <div class="field--label">Tags</div> <div class="field--items"> <div class="field--item"><a href="/taxonomy/term/17" hreflang="en">Web Development</a></div> <div class="field--item"><a href="/taxonomy/term/90" hreflang="en">Blogger</a></div> <div class="field--item"><a href="/taxonomy/term/64" hreflang="en">PHP</a></div> <div class="field--item"><a href="/taxonomy/term/91" hreflang="en">XML</a></div> <div class="field--item"><a href="/taxonomy/term/92" hreflang="en">RSS</a></div> </div> </div> <section> <h2>Add new comment</h2> <drupal-render-placeholder callback="comment.lazy_builders:renderForm" arguments="0=node&amp;1=32&amp;2=field_blog_comments&amp;3=comment" token="p8M87Fh5CWOEzYhc4Cc-MA-reYAczUmiC1Vi16whKbQ"></drupal-render-placeholder> </section> Sat, 07 Jul 2007 04:20:51 +0000 Kenny 32 at https://www.kennycarlile.com