WebFrame

Purpose

Show another site or a web page in a frame within your blog by inserting into your post or page something like this:
<!–- webframe http://www.yahoo.com 400 200 -–>
And you get results like in the screen shot below.

Maybe you love/hate that site, or maybe you need to use an application but do not want to bother integrating it into WordPress properly. This is the easy way.

There is already an excellent sexy, fiery PageView plug-in by Urban Giraffe, but I wanted something very functional, so I trimmed it and changed it till I got this lean (less than 10 lines of actual code) yet friendly beast.

WebFrame in action

What it does, how it works

Decide where you want the frame to be and insert the WebFrame directive into your post: Show another site or a web page in a frame within your blog by inserting something like this: <!–- webframe URL WIDTH HEIGHT -–>

Replace URL, WIDTH, and HEIGHT with the respective values.

  • Width and height are measured in pixels.
  • URL can be absolute like <!–- webframe http://www.yahoo.com/ 400 200 -–>
  • or relative like <!–- webframe /my/videos/birthday.html 400 200 -–>

Credits

WebFrame owes most of this code to the wonderful PageView plug-in. I did not ask its author John Godley for permission or help – his code was an inspiration enough. So, whan WebFrame works – at least 80% of your thanks should be directed to John. When this plug-in horribly disfigures your server and ruins your marriage… I was going to put “the fault is mine” here, but read the disclaimer below!

Disclaimer

I wrote WebFrame for my own purposes, not for public distribution. It is provided “As Is” and can probably do horrible harm.

I do not know PHP. I have never written a full PHP program in my life. Not even “Hello, World”. This means the code may be buggy and is guaranteed to be sub-optimal.

Parts of this plug-in came from other people’s code. I think I understand what they do, but not always why or how.

Good luck!

Download

Have you read the Disclaimer above??? – download WebFrame here: WebFrame WordPress Plug-in Version 1.0

Installation

  1. Download the plugin (see “Download” above).
  2. Rename webframe.txt to webframe.php and put it into your plugins directory (/wp-content/plugins/) or in a sub directory of the plugins directory.
  3. Activate the Plug-in.
  4. Enjoy!

Thank you

Writing all this up took time and effort. If you happen to be actually using this plug-in – I appreciate your vote of confidence and would love to hear about it!



  1. Hi I have been looking for something like this however I can’t get it to work correctly.
    I want to insert a page with a crossword puzzle on it inside a ‘page’ in wordpress so I thought iframe.

    I found your code and installed it. The problem is that the iframe code refuses to take the available space it just stops around 400px. I need it to be much wider. Do you have any ideas?

    The page in question is: http://crucialbusiness.com/office-vocablary-crossword-puzzle-in-english/

  2. Christopher,

    could you also post your webframe invocation? – I looked at your page and I can see the problem but to track down the source I need to see how you call WEBFRAME in your page.

    Offhand, i suspect that the invocation is a bit flawed – you do not need to specify the size unit (“px”) and you do not need the words “Width” and “Height”.

    Let me know if this helps.

  3. Hi andrabr,

    I changed two main lines in your pgm

    1. Get a better browser!

    2. return preg_replace ("//", $rep, $text);

    Thanks for the clean little plugin!

  4. Ok, sorry about that. WP.com ate my tags 🙂

    Hope this appears better.

    First needed to increment the argument counter:

    – src=”$2″ WIDTH=”$3″ HEIGHT=”$4″

    – Second, added an extra argument collector: “(.*?)” in preg_replace command.

  5. Cool!

    Max, I just might adopt your way 🙂

  6. can’t get it to work 😦

    1. Works fine on WP 2.8.4. Are you putting a space between the — in the opening code and the word “webframe” and then another space before the closing — ? If not, it won’t work.

  7. Instead of using pixels as the entry for width, it’s better to use 100%. Ex.

    !– webframe url 100% height —

Leave a reply to Christopher Cancel reply


About

I am sorry you have to see this. Actually, I am not – if you came here, it’s you fault. When we choose our actions we also choose the consequences.

Despite my oversized ego I do NOT believe that anyone out there craves a daily dose of my insight. In fact, I am suspicious of people who think otherwise.

This blog is a tool.

I meddle with many complex computer deployments, and as I go through adding features and learning things, I also tend to forget numerous details and the reasoning behind the many choices I have made in the past. This is the place to document my adventures. And to give something back.

If you stumble upon this and find it useful – …good for you.