Home Menu

Menu


Reply
Thread Tools Display Modes
  #1  
Old Jun 25, 2002, 04:43 AM
wclathe wclathe is offline
Junior Member
 
Member Since: Jun 2002
Posts: 6
I just posted a question about upgrading, and I have another....

I would like to have a small 'ssi' or something similar that would announce the date/title/blurb of the last journal entry on a front web page. (something like the index page, but JUST the last entry, so when a person enters the main page of the web site, they can see when the last journal entry is). I thought of adding a small subroutine that would create/overwrite a new file with date/title/blurb and then include that on the front page as a SSI "include file...". Though I can write the subroutine, I'm not sure where to put it in the script, the variables to use
etc. Can anyone help?

Has this been done for OJ 1.17
for 2.x?


advertisement
  #2  
Old Jul 04, 2002, 10:54 AM
wclathe wclathe is offline
Junior Member
 
Member Since: Jun 2002
Posts: 6
Ok, I've worked this out.
Some Caveats First:
1. It is probably not the most elegant solution, I'm not a perl expert
2. I make no claims to whether this will screw anything up, I've tested it several times and it seems to work
3. this is for version 1.x. If I upgrade to 2.x I'll figure how to do it for that, but I don't want to upgrade till I know I can use my previous entries.

Ok, if you want a small announcement of you latest entry on the 'home' page of your site (assuming the journal is not), these are the steps:
(you will need to be able to use SSI on your site)

1.Find in openjournal.cgi the subroutine "sub new_file" after the lines:
close(NEWFILE);
chmod 0755, "$basedir/$mesgdir/$nfn\.$ext";

ADD:
open (UPDATE, ">../jim/lastupdate.txt");
print UPDATE "$etitle||$long_date||$ptime||$bodyone";
print UPDATE "\n";
close (UPDATE);

chmod 0777, "PATHTOFILE/lastupdate.txt";
(right before the "}"

This creates a text file "lastupdate.txt" with the long date of the last update, the time, title and blurb. Substitute the PATHTOFILE to the path to the directory you want to add the file in, I suggest this not be the cgi bin, but perhaps where your openjournal files are.

2. Then copy and paste the following into a new file and name it ojlast.cgi (or whatever you want), make the changes as shown in comments, upload the file and change permissions to 755:

#!/usr/bin/perl
##########################
#make sure the path above is correct for yours
#another common is !/usr/local/bin/perl
##########################

# Path to data files. (No ending slash.)
$data_location = "PATHTOWHERE lastupdate.txt is";

# File name of file containing data:
$file = "lastupdate.txt";

##########################
#reads data file lastupdate.txt and prints it off
#a bit overkill since I wrote it in case some day
#i want to report the last several updates
##########################
print "Content-type: text/html\n\n";

open (QUOTEFILE, "<$data_location/$file") || die print "Could not open links file";
@line=<QUOTEFILE>;
close (QUOTEFILE);

foreach $link (@line) {

@newlink = split (/\|\|/, $link);

print "The latest journal entry:";
print "(A HREF=\"URLOFOPENJOURNAL\"";
print ")$newlink[0](/a), $newlink[3]";
print "posted on $newlink[1] "
################################
#substitute the "( and )" with "< and >" here I forgot how to make this
# board not do html
##################################
}
exit;

##########################
#The above will print off something like:
#The latest journal entry:
#TITLE, Blurb
#posted on DATE
# you can add another print statement with
#newlink[2] to add the time
# my web site formatting is governed by a style sheet,
#so this has very little styling. If you know HTML, you
#can easily change this to look how you want it
##########################

3. Then on the page where you want the last update to show up (usually must have a .shtml extension)
(!--#exec cgi="Path to your ojlast.cgi script you just created"--)

Again, change the ( and ) to < and >

  #3  
Old Jul 04, 2002, 10:57 AM
wclathe wclathe is offline
Junior Member
 
Member Since: Jun 2002
Posts: 6
you can see an example of what I did at a web page I started for a brother at http://jim.lathefamily.org

if you have any questions, or suggestions or better way to do this, post here or email me at wclathe @aol.com (minus the space)

  #4  
Old Jul 05, 2002, 10:01 AM
wclathe wclathe is offline
Junior Member
 
Member Since: Jun 2002
Posts: 6
OOPs,

In EVERY instance I have lastupdate.txt, substitute another name like 'mostrecent.txt' or 'latest.txt' or something.

There would be no problem if you have the file reside anywhere BUT the openjournal file, but there is a file there already at that name and you DO NOT want to replace it which this would.

Just name it something else.

Sorry,

trey

Reply
Views: 453

attentionThis is an old thread. You probably should not post your reply to it, as the original poster is unlikely to see it.



Similar Threads
Thread Thread Starter Forum Replies Last Post
Weblog entry: Privacy while blogging jennie Other Mental Health Discussion 2 Nov 30, 2005 08:19 PM
Weblog entry: Lying jennie Other Mental Health Discussion 6 Oct 22, 2005 01:03 PM
How to edit or remove entry? ey5colle Community Feedback & Technical Support 0 Sep 07, 2001 01:32 PM
OpenJournal formatting question: titles/article & entry laughingmuse Community Feedback & Technical Support 0 Sep 01, 2001 04:52 PM


All times are GMT -5. The time now is 02:26 PM.
Powered by vBulletin® — Copyright © 2000 - 2025, Jelsoft Enterprises Ltd.




 

My Support Forums

My Support Forums is the online community that was originally begun as the Psych Central Forums in 2001. It now runs as an independent self-help support group community for mental health, personality, and psychological issues and is overseen by a group of dedicated, caring volunteers from around the world.

 

Helplines and Lifelines

The material on this site is for informational purposes only, and is not a substitute for medical advice, diagnosis or treatment provided by a qualified health care provider.

Always consult your doctor or mental health professional before trying anything you read here.