3 Simple Ways to
Share What You Make

With Instructables you can share what you make with the world — and tap into an ever-growing community of creative experts.

PhotosPhotos

Share one or more photos of a project, recipe, or whatever you've made, quickly and easily.

Step by StepStep-By-Step

Share your step-by-step photos with text instructions of what you made so others can do it too!

VideoVideo

Share your how-to video. You'll need your embed code from a video site such as YouTube.

Instructables on your Website or Blog - UPDATED!

Instructables on your Website or Blog - UPDATED!
«
  • gmjhowe2.jpg
  • redtorope.jpg
  • Screen shot 2010-12-08 at 22.04.31.png
  • Screen shot 2010-12-08 at 22.04.02.png
This Instructable shows you how you can embed a list of links to your Instructables on your website, formatted just like on your profile page. They're updated automatically each time the page is loaded and are sortable by views, rating, recent and name. You can navigate through the pages of your Instructables by clicking the "Prev" and "Next" buttons, or by editing the "offset" in the URL.

Your profile page is fetched using PHP and the links and pictures scraped out of the html code from Instructables. These are then rearranged to look like the standard Instructables layout, your visitors clicking on them will take them straight to your Instructable.

All images are "hot linked", so there's no impact on your web server storage or bandwidth. All of this is done with the kind permission of Eric.

A list of some of the sites that have successfully installed this so far:
redtorope.com/instructables (mine)
gmjhowe.com/tutorials


A full list of users that have used it successfully will be added to the last step and updated when I learn of new uptakes.

Many thanks to gmjhowe for helping me write the HTML and CSS used to make the results the PHP finds look pretty and for taking great photos for this Ible.

I have previously fetched web pages with Perl; this is my first attempt with PHP. A list of resources in the last step shows the websites that I used to learn how to do this, all of these were invaluable.
 
Remove these adsRemove these ads by Signing Up
 

Step 1How it works

How it works
This step isn't important if you just want to use the code and be done with it, it's just for interest.

The code works in these steps:
  1. The PHP uses the $_GET function to get the information stored in the offset and sort variable in the URL, just like it does on Instructables.
  2. A URL for the Instructables page to be fetched is constructed from the variables $sort, $offset and $username. Depending on the user to be displayed, the sort method to be used and the number to offset by, it may look something like this: http://www.instructables.com/member/Jayefuu/?show=INSTRUCTABLES&sort=NAME&limit=15&offset=15
  3. The Instructables page constructed in step 2 is fetching using the PHP function curl() and stored in the variable $html.
  4. A list of links replicate the "sort by" function included in Instructables. Clicking these takes users to the same page, but changes the "sort=NAME" part of the URL.  The current sort method isn't a link, it's in bold.
  5. A regular expression is used to determine whether there is a next or previous button on the page fetched. These are then printed to the screen.
  6. One massive regular expression is used to find the 15 Instructables on the page. Their titles, URLS, title image thumbnails and featured status are stored in an array.
  7. A piece of code iterates through the array and prints html to the screen. This is what is displayed by your browser, not the PHP, which is executed on the server.
« Previous StepDownload PDFView All StepsNext Step »
20 comments
Dec 30, 2011. 1:37 AMComputothought says:
In Wordpress 3.3. I had to add the unfilter plug-in for it to work. Since it is on a private server it will not be that big of deal.
Jan 3, 2011. 1:18 PMzieak says:
I finally got it working on my site. I have a self-hosted wordpress setup. I had to take the code from step 3.4 and put it into the page text (I put it at the beginning.)

I banged up some of the code in other places on my site so need to go fix that...

Thank you so much for this!
Jan 2, 2011. 12:16 PMkillerjackalope says:
I wonder is there a decent way to pull the profile card, with all the info on it on to a site... Going to experiment but any suggestions or help would be awesome...
Jan 4, 2011. 11:53 AMkillerjackalope says:
Awesome, I'll have to take a crack at it, didn't know about that little page trick...

When's the next views count by the way? Not far from 1M now...
Dec 16, 2010. 2:56 PMAngryRedhead says:
I want it to work on Blogger. Baaaaaaah! Is there a way to run the script and have it spit out the HTML? It'll mean manually updating with each new Instructable, but it could be a real time saver for retrieving info. Or it could just be a stupid idea. :-P
Jan 2, 2011. 12:15 PMkillerjackalope says:
On a side note to that a huge number of free hosts will allow you to use various extra languages you just have to enable them on your profile, never used blogger personally though.
Dec 8, 2010. 6:26 PMjen7714 says:
Ahhh I was getting all excited about getting all my instructables on my blog but them another problem awaits. Apparently, worpress.com (the free one) doesn't allow plugins.

Any way to work around that?
Dec 9, 2010. 3:13 PMjen7714 says:
Blehh. :( But a static version might be better than nothing. Or I'll just link...
Dec 9, 2010. 5:20 AMthedod says:
In order to make it work, I had to install php5-curl: (sudo apt-get install php5-curl on ubuntu/debian), and it stil didn't work until I've added to php.ini the line extension=php_curl.so.
Works now, though :)
Dec 9, 2010. 5:30 AMthedod says:
Spoke to soon: the video play button has src="/static/img/playVideo_huge.png" (i.e. on my own server) and comes out broken :(
Dec 9, 2010. 8:32 AMthedod says:
It's actually localhost, but when I do a facelift to http://zzzen.com I'm thinking of using this
Dec 8, 2010. 3:35 PMNachoMahma says:
.  Fantastic!


And you mentioned me! Woot!!

Pro

Get More Out of Instructables

Already have an Account?

close

All Steps Viewing
View all steps of an Instructable on the same page when you're a Pro Member.

Upgrade to Pro today!
236
Followers
45
Author:Jayefuu
I am currently undertaking a PhD at the University of Huddersfield, England, looking at novel techniques in dispersive white light interferometry. Feb - April 2012 I was an artist in residence at I...
more »