![]() |
|
![]() |
|||||||||||
![]() |
![]() |
||||||||||||
|
JavaScript The simplest way to embed your journal into your website is to just insert this JavaScript wherever in your webpage HTML that you want your journal to show up. In browsers where JavaScript is unavailable, a link to your journal can be shown instead. Explanation This JavaScript fragment loads JavaScript from Blurty. The special thing to note here is the &enc=js at the end of the customview.cgi arguments that tells Blurty to encode the page as one big document.write("...."); JavaScript command. <script language="JavaScript" src="http://www.blurty.com/customview.cgi?username=username&styleid=101&enc=js"> <noscript><a href="http://username.blurty.com/">View my Blurty</a></noscript> </script> *
HTML Frames One way to hide www.blurty.com from the URL and make your journal look like part of your site is using frames... put the HTML page with the <frameset> on your own server, and then make one of the frames be your journal. This method will work with any frame-supporting browser, including Netscape and Internet Explorer. Additionally, HTML-4.0 compliant browsers are supposed to let you embed a frame inline with your page, so it doesn't have to be on the far side. This is called an Note For more information on <center> <iframe name="Blurty" src="http://www.blurty.com/users/username/" frameborder="0" scrolling="auto" height="400" width="460"> <a href="http://username.blurty.com/">View my LiveJournal</a> </iframe> </center> *
CGI Scripts Basic CGI Script You can write a CGI script (a program that runs on your server) to download your journal and then spit it back out to your clients. You could write a CGI script like this in any language, but by far the easiest language would be Perl, mostly because just about every hosting provider supports it. Explanation The client will never see www.blurty.com, because your server is actually the one that's downloading it. Note This example uses the LibWWW module for perl, which you may need to install on your server, or have your admin do it. #!/usr/bin/perl
use LWP::Simple;
print "Content-type: text/html\n\n";
print get('http://www.blurty.com/customview.cgi' .
'?username=username&styleid=101');
Server Side Includes and CGI If you already have some existing content that you don't want to modify and you just want your Blurty inserted into an existing HTML document on your server everytime a client requests it, you can create the CGI script in the previous example and then place the example below into a server-parsed HTML document. Note To get an HTML file to be server parsed, you usually have to name it .shtml, or set its execute bit; it depends on your webserver and how it's configured. In order to figure that out you might need to talk to your sysadmin. <!--#exec cgi="/cgi-bin/blurty.cgi" --> *
Better Markup Language If you're using BML on your server, you need to do two things in your document. First, you need to set the NOCACHE flag (example included), so that the visitor's browser doesn't store old states of the page in cache. Then you simply need to add in the given _CODE block somewhere on your page. Since BML evaluates markup blocks returned from code blocks, you can include BML markup in your embedding style in order to make your embedded journal fit in with your BML scheme. Note This uses the LibWWW module for Perl, which you may need to install on your server, or have your admin do it.
<?_code
use LWP::Simple;
return get('http://www.blurty.com/customview.cgi' .
'?username=username&styleid=101');
_code?>*
Macromedia Flash One of our users informed us that it is possible to have Flash download a list of variables to prefill into text elements in a Flash file. The formatting of these variable=value pairs are the same as in URLs. To accomodate this need, we provide a style which does this formatting for you. As an example, see the URL below.http://www.blurty.com/customview.cgi?username=username&styleid=103 *
PHP Using Contributed by: Bill Humpries This method simply opens the journal URL, and then prints the content. Explanation This method uses fopen() to open the journal URL, and then uses fpassthru() to pass the journal content to stdout. <?php
$journalURL = "http://www.blurty.com/".
"customview.cgi?username=username&styleid=101";
if ($fh = fopen($journalURL,"r")) {
fpassthru($fh);
} else {
echo "<p>Unable to load journal.</p>\n";
}
?>
Using Contributed by: Elliot Schlegelmilch This method is slightly different, and may work even if URL fopen wrappers aren't enabled on your server. Explanation This method uses <?php
$fp = fsockopen("www.blurty.com", 80, &$errno, &$errstr, 30);
if($fp) {
fputs($fp,"GET /customview.cgi?".
"username=username&styleid=101 HTTP/1.0\n\n");
while(!feof($fp)) {
echo fgets($fp,128);
}
fclose($fp);
}
?>
Using Contributed by: Jay Cuthrell This method is useful for those that want a line by line parse of their journal, with line number references.Explanation This method uses the <?php
$page = "http://www.blurty.com/customview.cgi".
"?username=username&styleid=101";
$content = file($page);
$slurp = "";
while (list($foo,$bar) = each($content)) {
$slurp .= $bar;
}
echo $slurp;
?>
Using Contributed by: Jon Parise This simply includes the journal page inside of the PHP page. Note This requires you have URL fopen wrappers enabled (they're on by default in PHP 4). <?php
include "http://www.blurty.com/customview.cgi".
"?username=username&styleid=101";
?>
*
Python Contributed by: Jeremy Tribby Embedding your Blurty is easy with Python; just use the urllib class. <%
import urllib
u = urllib.open('http://www.blurty.com/customview.cgi?username=username&styleid=101')
print 'Content-type: text/html\n\n'
print u.read()
%>
*
Active Server Pages Using the Microsoft.XMLHTTP component Contributed by: Pavel Titov This is an easy way to embed your journal using the Microsoft.XMLHTTP component and IIS. <%
Response.Buffer = True
Dim xml
' Create an xmlhttp object:
Set xml = Server.CreateObject("Microsoft.XMLHTTP")
' Or, for version 3.0 of XMLHTTP, use:
' Set xml = Server.CreateObject("MSXML2.ServerXMLHTTP")
' Opens the connection to the remote server.
xml.Open "GET",
"http://www.blurty.com/customview.cgi?username=username&styleid=101",
False
' Actually Sends the request and returns the data:
xml.Send
Response.Write xml.responseText
Set xml = Nothing
%>
Using PerlScript Contributed by: Ansley Ingram Here is how to embed your LiveJournal on your site using ASP and PerlScript. Note Unfortuately, many WinNT hosting providers don't offer PerlScript. PerlScript is included in the ActivePerl installation for NT from ActiveState. <%@language=perlscript%>
<%
use LWP::Simple;
$Response->Write(get 'http://www.blurty.com/customview.cgi?' .
'username=username&styleid=101');
%>
*
Cold Fusion Contributed by: Cold Fusion users can embed their journals as follows. <CFHTTP
URL="http://www.blurty.com/customview.cgi?username=username&styleid=101"
METHOD="GET">
</CFHTTP>
<CFOUTPUT>#cfhttp.filecontent#</CFOUTPUT>
*
AOLServer .adp pages Contributed by: You can embed your Blurty on your site using AOLServer's .adp pages. Note This is not for people using AOL's Internet Access service; it is for people using the AOLServer web server. <% ns_puts "[ns_geturl http://www.blurty.com/customview.cgi?username=username&styleid=101 ]" %> * |
| © 2002-2008. Blurty Journal. All rights reserved. |