AnchorCal need some ideas please (Switched to SMC)

Discuss news styles, css code, and other Coranto customizations in here...the possibilities are endless, so have at it!

Moderator: Spunkmeyer

AnchorCal need some ideas please (Switched to SMC)

Postby Pirate Elf » Wed Apr 23, 2008 3:27 am

Recently a friend gave me a challenge of putting a calendar using coranto up. I went through all the various threads and the one DaleRay wrote is the only one that will do what I want however I have run into one caveat and could use some help for those that are brave:

First of all I edited up the php file so that it was a tmpl file as well. This way I could call fields. What I want to do is this:

Show the calendar on X Day show a link to a popup that shows the news item via cgi.

I have done most of the rough stuff but am running into the problem that if I do this:



Code: Select all
$display_url = "../Test/viewnews.cgi?id=<Field: newsid>&tmpl=view";


However that produces only one single news id for ALL of the links. Does anyone have any thoughts how I could get it to call whatever the id is of the specific day it clicks. IE: 23 goes to newsid=ijsjijfewijs and the 26 goes to newsid=jkskjkjsdoijw

Thoughts? Has anyone worked with this particular addition?
Last edited by Pirate Elf on Wed Apr 23, 2008 7:01 pm, edited 1 time in total.
Nichts ist für dich
Nichts war für dich
Nichts bleibt für dich
Für immer
Pirate Elf
 
Posts: 732
Joined: Wed Jan 31, 2007 9:45 pm

Postby SrNupsen » Wed Apr 23, 2008 7:07 am

You have to find some other way of passing the date, as <Field: newsid> won't work in templates. I'm not familiar with the calendar approach, but couldn't you look for some way of storing the date in a variable when outputting the calendar or something?
-----------------------------------------------------------------------------------------------------
Coranto is free software. I am available for custom work or troubleshooting.

http://www.sundaune.no - transkripsjon, webdesign, nettsider, tekstbyrå
http://www.vagbladet.no - satire, politikk, kultur, sport, nettavis
-----------------------------------------------------------------------------------------------------
SrNupsen
 
Posts: 2229
Joined: Tue Jan 09, 2007 6:46 pm
Location: Nesodden, outside Oslo, Norway

Postby Pirate Elf » Wed Apr 23, 2008 7:23 am

SrNupsen wrote:You have to find some other way of passing the date, as <Field: newsid> won't work in templates.


Oh it does but it only parses the very first newsid. I am still working on exactly how Dale Ray did this calendar because it to me seems a lot more flexible than that smcCal whatever thing, but the problem is I am running into the fact I know only a smidgen of php and Not entirely sure how I could do a variable that it could call that would work for Anything. So kind of stuck.

I have everything working great except the fact it only parses one single newsid the very first one.
Nichts ist für dich
Nichts war für dich
Nichts bleibt für dich
Für immer
Pirate Elf
 
Posts: 732
Joined: Wed Jan 31, 2007 9:45 pm

Postby Dale Ray » Wed Apr 23, 2008 9:11 am

Long Post Alert!!!!

Read This to see exactly how I implement the calendar.

Here is a calendar that have setup using the methods in the above docs. If you click on the event for April 25 it simply uses viewnews.cgi to display the info.

My viewnews.cgi default template is always empty and I simply use a style to display the item. The style therefore has to create a complete web page.

Also I use Coranto to build the data file for the calendar and the page the calendar is displayed on is an .shtml file that has:
Code: Select all
<!--#include virtual="cal/index.cgi" -->

in it to call the calendar script. The calendar script reads the data and displays it.

The trick is getting the style correct that creates the date file. This is what makes the links to the details. If you want to use javascript popups the script can do that as well, just read the smcCal docs for details and change the style Coranto uses to suit.

If you click on the April 20 or April 18 event you will see what the news item for a completed game looks like. Both the future games and past games use the same style:
Code: Select all
<PerlCode>
# initialize variables
$thisOpp = "";
$titleTag = "";
#if Opponent is not determined yet use the subject or the schedule note instead
if ($CustomField_opponent ne "TBA" && $CustomField_opponent ne ""){
$thisOpp = $CustomField_opponent;
} elsif ($CustomField_opponent eq "TBA" && $Subject eq "" && $CustomField_schedNote eq "") {
$thisOpp = "To be announced";
} elsif ($Subject ne "") {
$thisOpp = $Subject;
} elsif ($CustomField_schedNote ne "") {
$thisOpp = $CustomField_schedNote;
}
# add appropriate text for home/away games if needed
if ($CustomField_site eq "Away") {
$titleTag = "CCSJ at ".$thisOpp." on ".$Month_Name." ".$Day.", ".$Year;
} elsif  ($CustomField_site eq "Home" || $CustomField_site eq "Neutral") {
$titleTag = "CCSJ vs ".$thisOpp." on ".$Month_Name." ".$Day.", ".$Year;
} else {
$titleTag = $thisOpp;
}
# process the score by innings entry
if ($CustomField_oppRunsByInning ne "" && $CustomField_ourRunsByInning ne "") {
    # split the score by innings entries into indexed arrays
    @oppScoreByInning = split(";",$CustomField_oppRunsByInning);
    @ourScoreByInning = split(";",$CustomField_ourRunsByInning);

    # process the opp array
    $n = 0;
    $oppRow = "";
    while (defined($oppScoreByInning[$n])) {
      #get the opp total runs for the game
       $oppRuns = $oppRuns + $oppScoreByInning[$n];
      #build the opp line for the score by inning box
       $oppRow = "$oppRow"."<td class=\"scores\">".$oppScoreByInning[$n]."</td>";
       $n++;      
    }
$oppRow = "<tr class=\"scores\"><td class=\"team-name\"><strong>".$CustomField_opponent."</strong></td>".$oppRow."<td class=\"scores\">$oppRuns</td><td class=\"scores\">$CustomField_oppHits</td><td class=\"scores\">$CustomField_oppErrors</td></tr>";


    # process our array
    $n = 0;
    $ourRow = "";
    $headerRow = "<tr class=\"scores\"><th class=\"scores\"></th>";
    while (defined($ourScoreByInning[$n])) {
       $ourRuns = $ourRuns + $ourScoreByInning[$n];
       $ourRow = $ourRow."<td class=\"scores\">".$ourScoreByInning[$n]."</td>";
       $n++;
        $headerRow = $headerRow."<th class=\"scores\">$n</th>";
    }
$ourRow = "<tr class=\"scores\"><td class=\"team-name\"><strong>CCSJ</strong></td>".$ourRow."<td class=\"scores\">$ourRuns</td><td class=\"scores\">$CustomField_ourHits</td><td class=\"scores\">$CustomField_ourErrors</td></tr>";
    $innings = $n;
$headerRow = $headerRow."<th class=\"scores\">R</th><th class=\"scores\">H</th><th class=\"scores\">E</th></tr>";

    # put the score table into correct order for home/away games

    if ($CustomField_site eq "Away" || ($CustomField_site eq "Neutral" && $CustomField_homeTeam
== 0)) {
    $scoreTable = $headerRow."\n".$ourRow."\n".$oppRow;
    } else {
    $scoreTable = $headerRow."\n".$oppRow."\n".$ourRow;
    }
}

# compare the runs by inning totals to the total entered on the input page
# to prevent mistakes
if ( ($CustomField_ourScore ne "" && $ourRuns == $CustomField_ourScore) && ($CustomField_oppScore ne "" && $oppRuns == $CustomField_oppScore) ) {
   $showLineScore = 1;
   } else {
   $showLineScore = 0;
}
</PerlCode>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>CCSJ Softball Game Details</title>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" type="text/css" href="../_style/style.css">
</head>
<body>
<!-- body table -->
<table width="85%" align="center">
<tr>
<td class="padding">
    <table width="100%" class="box_border">
        <tr>
            <td class="soft_header center">
            <img src="../_pics/logo.gif" width="97" height="61" alt="">
            </td>
            <td class="box_header">
            <img src="../_pics/logo_4.gif" width="629" height="101" alt="">
            </td>
        </tr>
    <tr>
        <td class="soft_header center" colspan="2">
        <h5><Field: titleTag></h5>
        </td>
        </tr>
        <tr>
        <td colspan="2" class="detail">
<p><Field: Date><If: Field: CustomField_timeOptions eq "Normal"> at <Field: Hour>:<Field: Minute><If: Field: AMPM eq "PM"> p.m.<If: Else> a.m.</If><If: Field: CustomField_tz ne "CST"> <Field: CustomField_tz></If></If><br>
<If: Field: CustomField_playingField><p>Played at <Field: CustomField_playingField><br></if>
<If: Field: CustomField_schedNote><Field: CustomField_schedNote><br></If>
<If: Field: CustomField_blurb><Field: CustomField_blurb><br></If></p>
<If: Field: showLineScore><table class="scores">
<Field: scoreTable>
</table></If>

<p><Field: Text></p>

<If: Field: CustomField_BoxScore><p><a href="<Field: CustomField_BoxScore>">Box Score and Play-by-Play</a></p></If>
<If: Field: CustomField_last_revised><hr /><p>Last Revised: <Field: CustomField_last_revised></p></If>

<!-- End Style Section -->
</td>
</tr>
</table>
</td>
<!-- end main body -->
</tr>
</table>
</body>
</html>


Here is the style that builds the calendar database:
Code: Select all
<PerlCode>
if ($CustomField_recurring == 1) {
   $Year = "0000";
}
# set a default style
$thisStyle = "OneItem";

#change the style based on the item category
if ($Category eq "schedule") {
   $thisStyle = "GameSummary";
}

# I use a check box to determine if I want a link
if (!$CustomField_linkToDetails) {
   $Text = "";

}
# set up the event title,
$eventTitle = "";

if ($CustomField_opponent ne "" && $CustomField_opponent ne "TBA") {
$eventTitle = $CustomField_opponent;

  if ($CustomField_site eq "Away" && $CustomField_trny != 1) {
     $eventTitle = "at ".$eventTitle;
  } elsif ($CustomField_site eq "Home" && $CustomField_trny != 1) {
     $eventTitle = "vs ".$eventTitle;
  }
 
  if ($CustomField_confGame) {
     $eventTitle = $eventTitle."*";
  }

} elsif ($CustomField_schedNote ne "")  {
   $eventTitle = $CustomField_schedNote;

} elsif ($Subject ne "") {
   $eventTitle = $Subject;

} else {
   $eventTitle = "TBA";
}
#check time options, this checks the value set by a radio button field
if ($CustomField_timeOptions eq "Normal") {
   if ($AMPM eq "AM") {
      $AMPM = "a.m.";
   } else {
      $AMPM = "p.m.";
   }
   $zone ="";
   if ($CustomField_tz ne "CST") {
      $zone = " ".$CustomField_tz;
   }
   $eventTitle = "<span class=\"bold\">".$Hour.":".$Minute." ".$AMPM.$zone." - </span> ". $eventTitle;
}
#after the perl code has run actually write the line to the calendar database
# this is all on one line
</PerlCode><If: Field: CustomField_calendar><Field: Year><Field: TwoDigitMonth><Field: TwoDigitDay>^^^<Field: eventTitle>^<If: Field: Text>http://www.ccsjsb.info/coranto/viewnews.cgi?id=<Field: newsid>&amp;style=<Field: thisStyle></If>^</If>


As you can see the syles can get complicated. You can set up the links to use different styles see this link for more information

Remember that the forum may put line returns where they don't belong in the code above.
Dale Ray
User avatar
Dale Ray
 
Posts: 1001
Joined: Sun Jan 19, 2003 6:02 pm
Location: NW Indiana

Postby Pirate Elf » Wed Apr 23, 2008 9:35 am

The problem with that is it uses that smcCalc thing and I'm sorry but that is just way too complicated to get a calendar running. Number one it's huge, number two as you can see above it requires insane style changes to make work with coranto properly, and number three the small version does a strange popup window which is of no use to me.

So far I like AnchorCal or whatever it is you wrote. The problem I am running into is it will not allow me A: use the newsid as my anchor which could solve a few problems, and B: figuring out how to get dual links on a date. I think if I could just get the newsid I can setup maginot to allow switching to other dates within the frame. The problem is AnchorCal doesn't look like it was setup for anything but one single idea.

I am still fooling with it, but I am at the point I think it might be time to hunt for another script that will fit easily with coranto. All I really want is a mini calendar that can do multiple events on a date and when you click on the date it shows you the newest event first and perhaps a link to the next one.

I was sure I could setup AnchorCal to do that but I just don't really know enough php to make heads or tales of certain calls and how I would go about it.

For an example of what I am talking about take my test page


http://ragewars.madassnews.net/AnchorCal/calendar.php


As you can see I got a good ways into doing what I want. However the problem I am running into is that I can't name files with maginot the arbitrary
Code: Select all
<a name="<Field: Year><Field: TwoDigitMonth><Field: TwoDigitDay>"></a>

At least I don't think I can. Otherwise if that were doable I might go that route. I have been toying with this now for a minute and I think I have hit a brick wall and perhaps need to move on to another script......



***Pirate Edit***
Ya know after playing with it somemore I really just want to edit line 289 so that I could get something like this to work:
Code: Select all
 echo "\n    <td $style><a href=\"Dates\<Field: newsid>.php\">$d</a></td>";


However editing that line won't work correctly because it's still asking for the silly 20080422 format for the A anchor. Just replace that with newsid would be awesome then I could get on to higher learning. LOL

WEll I kind of got it, but still no closer to what I want... A simple mini calendar with links...
Nichts ist für dich
Nichts war für dich
Nichts bleibt für dich
Für immer
Pirate Elf
 
Posts: 732
Joined: Wed Jan 31, 2007 9:45 pm

Postby Jackanape » Wed Apr 23, 2008 1:42 pm

I did a lot of work on Dale's smCal integration last year, and it is ready to go, and should serve your purposes very nicely. You can download it directly from CVS at:
http://corantoaddons.cvs.sourceforge.ne ... ns/smcCal/

To see what I did to it, you can check:
http://coranto.org/forum/viewtopic.php?p=66464#66464

It is very easy to use, and I would LOVE some feedback, or even some contributions, if you see any that need to be made. I was planning to brush it up and release the official addon over the summer, so if you want, let me know what needs changing!
A human being should be able to change a diaper, plan an invasion, butcher a hog, conn a ship, design a building, write a sonnet, balance accounts, build a wall, set a bone, comfort the dying, take orders, give orders, cooperate, act alone, solve equations, analyze a new problem, pitch manure, program a computer, cook a tasty meal, fight efficiently, die gallantly.
Specialization is for insects.
-Robert A. Heinlein
User avatar
Jackanape
 
Posts: 632
Joined: Tue Jan 09, 2007 12:15 am
Location: Capitol of the Great State of New York

Postby Dale Ray » Wed Apr 23, 2008 3:03 pm

AnchorCal was intended for linking to a monthly archive file. When you call it it reads a single data file and creates links on the calendar for each day that has one or more events. It processes a file looking for the html anchors in a specified format. You can change the format it looks for by changing the regex. The file does not have to be an html file.

You could use one Coranto profile to create a list of the days with events for each month. Just a text file with the achors in it would work. Then change the code within AnchorCal that creates the links to point where you want - to a file for each day for example. Then use Maginot to create static files for each day.

I think the best you can do with it would be to create one link for each day.

This code:
Code: Select all
    if (isset($tag[$d]) && ($tag[$d])) {
        $k = ( $d < 10 ? "0".$d : $d);
        $m = ( strlen($month_number) < 2 ? "0".$month_number : $month_number);
        echo "\n    <td $style><a href=\"$display_url#$year$m$k\">$d</a></td>";
    }

is where the link is created.

You would have to set the variable $display_url to what you need and delete the date related stuff. If you did a separate maginot file for each day's events you could base the naming scheme for the Maginot file on the date and you should be able to recreate the link to it in the AnchorCal script.

AnchorCal was never designed to allow more than one link per day.

You could probably achieve this using javascript to pop-up a box for the user to select a single event with a fall-back to viewing all events for the day if javascript is disabled.

BTW there is a version of smcCal that displays a small calendar, you can see it at Parahead's site.

I am pretty busy right now but if I get some time over the summer (read in about a month) I will look at updating AnchorCal. If you come up with a solution on your own please share.

Edited for clearer content.
Dale Ray
User avatar
Dale Ray
 
Posts: 1001
Joined: Sun Jan 19, 2003 6:02 pm
Location: NW Indiana

Postby Pirate Elf » Wed Apr 23, 2008 3:22 pm

Jackanape wrote:I did a lot of work on Dale's smCal integration last year, and it is ready to go, and should serve your purposes very nicely.


I attempted the smc cal first but it didn't play well with customization and after reading what little documentation there is on the matter I realized what I wanted would only be achieved in a really long drawn out style, so I turned to the only other option which was AnchorCal. It proved to be a bit better at dealing with the needed customization and integration but so far linking has eluded me. I attempted some other flat file calendars but they all fell within the concept of smcCal, sure it works but the amount of styling necessary to achieve a half decent result is almost like writing a whole new calendar. No thanks. LOL! It's been AGES though since I even looked at perl or php and it's slowly coming back to me, but it's mostly trial and error at this point until I find someone that's really good at PHP.....
Nichts ist für dich
Nichts war für dich
Nichts bleibt für dich
Für immer
Pirate Elf
 
Posts: 732
Joined: Wed Jan 31, 2007 9:45 pm

Postby Pirate Elf » Wed Apr 23, 2008 7:10 pm

Alright forget all I said. Either A: I found the wrong version of smcCal or B: After almost 7 hours of continuous coding on that AnchorCal my "skills" came back, but I managed to get smcCal kind of working and perhaps someone has answer for this:

Using the build of Jackanape's

I have managed a nice little .shtml file. I am using the style of
Code: Select all
<Field: Year><Field: TwoDigitMonth><Field: TwoDigitDay>^^^<Field: Subject>^<If: Field: Text><MaginotURL: Calendar3></if>^

And the ChangeDateNew of Parahead's to post into the future as well as now.

I have a few problems that I could use some help with:

One birthdays don't seem to work.

Two is this one also limited to one item per day?

For examples checkout
http://ragewars.madassnews.net/Calendar/five.shtml

Thanks

*Note there are no coranto links due it not being a live site in the sense people are viewing. Once I get my host situation taken care of it will go back to my beloved link "Rendered using Coranto". *
Nichts ist für dich
Nichts war für dich
Nichts bleibt für dich
Für immer
Pirate Elf
 
Posts: 732
Joined: Wed Jan 31, 2007 9:45 pm

Postby GabeT » Sat Apr 26, 2008 4:24 am

I have the calendar working on a site that I've been building for my job. The problem I run into is that I need to have the dates link to a page with only the content from that particular date show up. Example if one were to click on the date of April 27 then it would take them to a content page which has all the events from the 27th on that page.
GabeT
 
Posts: 86
Joined: Thu Jan 11, 2007 12:35 am
Location: Albuquerque, NM

Postby SrNupsen » Sat Apr 26, 2008 7:19 am

Couldn't you create a Maginot sliced profile and slice it by date? That would create separate files for each date, which you could then link to by using

Code: Select all
<a href="<MaginotURL: sliced_profile_name>">


or even

Code: Select all
<a href="http://www.mysite.org/calendar/<Field: year>/<Field: TwoDigitMonth>/<Field: TwoDigitDay>.shtml


or similar.
-----------------------------------------------------------------------------------------------------
Coranto is free software. I am available for custom work or troubleshooting.

http://www.sundaune.no - transkripsjon, webdesign, nettsider, tekstbyrå
http://www.vagbladet.no - satire, politikk, kultur, sport, nettavis
-----------------------------------------------------------------------------------------------------
SrNupsen
 
Posts: 2229
Joined: Tue Jan 09, 2007 6:46 pm
Location: Nesodden, outside Oslo, Norway

Postby Pirate Elf » Sat Apr 26, 2008 5:18 pm

SrNupsen wrote:Couldn't you create a Maginot sliced profile and slice it by date? That would create separate files for each date, which you could then link to by using


That's exactly what I am doing. Only problem I have run into is doing it that way you can only post one thing on one day. Which sucks, but to be honest how often is it going to come up that multiple things will happen on the same day?

*note I wonder why my post count is so low. I know when we switched here I had to re-sign up, still makes me look like a newbie. LOL! *
Nichts ist für dich
Nichts war für dich
Nichts bleibt für dich
Für immer
Pirate Elf
 
Posts: 732
Joined: Wed Jan 31, 2007 9:45 pm

Postby GabeT » Sat Apr 26, 2008 6:44 pm

I need it to have multiple items for each date. We have some days that will have up to 3-4 things going on in one day.
GabeT
 
Posts: 86
Joined: Thu Jan 11, 2007 12:35 am
Location: Albuquerque, NM

Postby SrNupsen » Sun Apr 27, 2008 8:48 am

In a calendar, when you click on a date, it can only link to 1 page, right? I don't quite see what you are trying to achieve...
-----------------------------------------------------------------------------------------------------
Coranto is free software. I am available for custom work or troubleshooting.

http://www.sundaune.no - transkripsjon, webdesign, nettsider, tekstbyrå
http://www.vagbladet.no - satire, politikk, kultur, sport, nettavis
-----------------------------------------------------------------------------------------------------
SrNupsen
 
Posts: 2229
Joined: Tue Jan 09, 2007 6:46 pm
Location: Nesodden, outside Oslo, Norway

Postby GabeT » Sun Apr 27, 2008 9:50 pm

Right, What i need that one page to be is a page where multiple events show up.
GabeT
 
Posts: 86
Joined: Thu Jan 11, 2007 12:35 am
Location: Albuquerque, NM

Next

Return to Customization

Who is online

Users browsing this forum: No registered users and 1 guest

cron