Tag Archives: Scripts

Parsing Lua Scripts With PHP

Lua is a lightweight scripting language designed to be embedded in larger programs in order to allow for user customization. The most popular application to include a Lua interpreter is probably World of Warcraft. The entire user interface is customizable through Lua scripting, and a sizable community of plugin developers has grown around it.

It’s possible to include a Lua interpreter in a program built with pretty much any imaginable language…including PHP. There is a convenient PHP class, called phplua, that will allow you to do this.

phplua is a PHP extension that enables you to embed the LUA interpreter in a PHP application. Huh? A script language embedded in a script language? This is probably what you are asking yourself now. But imagine you have an application and want to allow users to customize it using some API. PHP will be sufficient if you are the webmaster and want to extend a foreign application by a separate module. But you certainly do NOT want to give an ordinary web user of this application the ability to inject their own PHP code. PHP is simply not designed to do this. At least not in a secure way.

If you have a complex web application that could do with a little bit of user customization, it’s definitely possible to bake in a Lua API. The question is: if you did that, would it make Lua a meta-scripting language?

YOURLS: Your Own URL Shortener

I have been noticing an interesting trend on Twitter and other social media sites. Larger online publications are starting to set up their own private URL shorteners for their content. Ars Technica has arst.ch, TechCrunch has tcrn.ch, and Oneforty has 14t.me, for example. Oh, and The Onion has their own short URLs under their onion.com domain.

Why are they doing this? To solve two problems that URL shorteners often introduce: The first being that they prevent you from seeing what URL you’re going to land on, which could contain malware of some other undesirable content. Having a private, branded shortener domain adds a level of trust. The second issue is that a few URL shorteners have closed their doors, or announced that they were going to. Handling them internally helps to mitigate that risk, since everything is under the publishers’ control.

How do you set up your own URL shortener? The first step is to get a short domain to use. Domai.nr is a great tool to provide inspiration. Once you have a domain, however, you have to make a decision. Do you want to use something like Bit.ly Pro, or do you want to host everything yourself? If you fall into the latter camp, you may want to give YOURLS a try.

YOURLS, or Your Own URL Shortener, is a PHP script by WordPress plugin developers Lester “Gamerz” Chan and Ozh Richard. It lets you setup a nearly-instant URL shortener. All you have to do is download and configure it on your web server. It even collects statistics.

Continue reading →

Showcase Your Images with WebAssist’s PowerGallery

Looking for a PHP photo gallery package that’s super easy to use? Look no further than WebAssist’s PowerGallery. It has a slick interface that far surpasses any I’ve seen in similar scripts. It looks good, it’s clean and simple, and it feels polished, which is more than I can say for the ever-popular Coppermine Photo Gallery.

PowerGallery Main Screen

Continue reading →

Zenphoto – Lightweight Web Gallery Script

Tired of the bloated Coppermine Photo Gallery? The much lighter Zenphoto gallery script may be a good alternative.

The compressed download is under one megabyte, and the installation looks fairly simple. Just upload via FTP, and run the installation script.

The installed gallery is responsive and clean. Don’t take my word for it, though. Look at the demo gallery.

The script is fairly new, and is still evolving. Some features, like RSS support, have just been added.

If you need a gallery (for a design portfolio, to show off your photos, etc), then be sure to check-out Zenphoto.

Start Using Polls on Your Blog

Polls are a great way to solicit opinions, and add some community to your site.

With a poll, a user can just click a button to give you their two cents. Meanwhile, it takes a lot more effort to leave a comment. Which do you think your readers prefer? While comments allow them to say anything they want, polls enable a quick multiple-choice response (which can be very useful). Also, I’ve found that blog posts with attached polls tend to generate more comments.

Once you decide you need a poll, you need to actually add one. You have plenty of choices for implementing your poll. Here are a few of the better services/scripts:

Continue reading →

roScripts – Helping Programmers Program

roScripts is a blog/forum/Digg-for-scripts. Their “articles” section has several categories worth of coding tutorials (PHP, Flash, AJAX, HTML, etc). Then they have the “scripts” section, where you can easily find pre-made scripts to suit your purposes. The interesting part, though, is that they’re sorted in a Digg-like manner. You can vote-up scripts you like, and “bury” the ones you don’t.

roScripts has changed a lot since their launch, and they keep getting better.

Which Lightbox is Right For You?

I was going to write a post comparing different lightbox scripts, but it looks like “etc” beat me to it. Which Lightbox is right for you? covers 18+ different scripts for your lightboxing needs.

For those of you who have never heard of the term “lightbox,” it’s a photographic term that has been recycled for web use. A lightbox, in the photographic sense, is a device used for viewing negatives. In the web design area, “lightbox” refers to a script that displays images or other content in an overlay DIV.

Which Lightbox is right for you? This post will help you figure that out.

Websites as Graphs

This is either a useful tool or a fun toy. Websites as Graphs is a Java applet that renders your website’s (X)HTML structure as a graph of colored dots.

You enter a sites’ URL into the form, and the applet puts a black dot on the screen (representing the root <html> element). Quickly, more connected dots expand outward. Each dot is color-coded to match a group of elements. The blue dots are links, the red ones are tables, etc. The graph shown to the right shows this site (note the lack of red dots :D ).

It’s fun to enter a bunch of your favorite websites and compare them (maybe it is a toy rather than a useful tool…), and compare them to your own as well. Try it out, it’s fun to watch if anything.

SimplePie: Parse RSS With PHP

LastRSS. MagpieRSS. Neither have been updated in over a year. What’s the best way to parse RSS feeds and output them with PHP? Simple, use SimplePie.

What is SimplePie? It’s a file you include in your PHP scripts, allowing you instant access to RSS-parsing capabilities. You can display RSS headlines/items on your website, combine several feeds into one, and anything else that you can think of. If you know a little PHP, the possibilities are endless.

You see this PHP code:

require('simplepie.inc');
$feed = new SimplePie("http://feeds.feedburner.com/Webmaster-source");
$feed->handle_content_type();
echo "<h1>".$feed->get_title()."</h1>";
foreach ($feed->get_items() as $item) {
echo '<h2><a href="'.$item->get_permalink().'">';
echo $item->get_title().'</a></h2>';
echo '<p>'.$item->get_description().'</p>';
}

That’s all you need to display a feed’s headlines and descriptions. Of course, that was only a simple example. It’s unbelievable what you can do with SimplePie.

Over at NTugo, SimplePie is used extensively. The MyNT RSS reader is powered by SimplePie. The “Recent blog posts” and “Recent posts from the NTugo Network” boxes on the home page are built with SimplePie. The RSS feed aggregated from all of the NTugo blogs? SimplePie again! It’s amazing what you can do with SimplePie.

If you know PHP, you’ll definitely want to take a look at SimplePie.

MyNT (My NTugo)

RSS is one of the greatest web technologies invented in the last ten years. It enables us to keep up with our favorite sites, listen to podcasts, and get niche news easily. Forget annoying old newsletters! Who needs them when you can just open your RSS reader and skim through headlines, looking for things of interest?

Ah, the RSS reader. Like with web browsers and email clients, everyone has a different preference. Some like desktop programs, while others like web-based apps. There’s no shortage of choices. You have Feedreader, Netvibes, Bloglines, etc. I don’t like any of the choices. I’m a big fan of RSS, but I’ve never really liked any RSS reader other than Firefox‘s Live Bookmarks feature. Recently I’ve had two problems. Number one, my feed collection outgrew Live Bookmarks. Number two, I’ve often wanted to read my RSS feeds on other computers.

What did I do? I threw together my own web-based RSS reader. I call it MyNT (say “Mint”), which is short for My NTugo. It’s a little innovative, as I added a few…different features to it.

My favorite feature: You can read your RSS feeds without logging in at all (just go to http://my.ntugo.com/yourusername.html). Just bookmark that URL and you can check your feeds with a single click (let’s see Bloglines do that).

Take a look at MyNT, you may like it. I can’t guarantee everyone will like MyNT. After all, I made it mainly for myself (and anyone who thinks that most feed readers are too bloated). I wanted to capture the simplicity of Live Bookmarks in a different form, and I think I did a pretty good job at it.

Well, MyNT’s URL is http://my.ntugo.com, and you can read the official press-release-sort-of-thing here.

Page 1 of 212