file contents of syndication.php
<?
//===========================================================================
// EXPERIMENTAL CODE FOR SYNDICATION TILES
// David Gibson, 08-Nov-2020
//===========================================================================
$file = __FILE__; // The current file. Used in __show.php
include '_common_from_caves/php/__show.php'; // Decide whether to display this code in the browser or execute it
//===========================================================================
// Set up data arrays
// ==========================================================================
// ----- The title of the pane
$title = array( 'BCRA Events',
'News from BCA',
'This Month\'s Feature',
'Our Next Event',
'Annual Conference',
'Cave Science Centre',
);
// ----- The page being syndicated
// ----- for preference, these should be dedicated pages, e.g. https://british-caving.org.uk/news4bcra.html
$syndic = array( 'https://britiac3.bcra.org.uk/calendar/index.html?header=no',
'https://british-caving.org.uk/',
'https://darknessbelow.co.uk/cheddar-caves-closed-to-both-tourists-and-cavers/',
'https://british-caving.org.uk/bcra-cave-science-symposium/',
'https://hidden.earth/',
'https://cave-science.org.uk/', // This doesnt work well; perhaps not use it?
);
// ----- The provider of the content
$source = array( $link_to_google_calendar, // set via calendar/link_to_google.php, loaded before this file
'https://british-caving.org.uk/',
'https://darknessbelow.co.uk/',
'https://british-caving.org.uk/',
'https://hidden.earth/',
'https://cave-science.org.uk/',
);
// ----- The text for the link to the provider of the content
$j = 0;
$provid = array( 'Open/Share this in ' . makeAnchor('Google Calendar', $source[$j++]),
'Content from the ' . makeAnchor('British Caving Association', $source[$j++]),
'Content from the ' . makeAnchor('Darkness Below', $source[$j++]),
'Content from the ' . makeAnchor('British Caving Association', $source[$j++]),
'Content from the ' . makeAnchor('Hidden Earth', $source[$j++]),
'Content from the ' . makeAnchor('British Cave Science Centre', $source[$j++]),
);
//===========================================================================
// Output the HTML - IMMEDIATE
// ==========================================================================
$L = $j;
for ($j=0; $j < $L; $j++)
{
echo getTile($title[$j], $syndic[$j], $provid[$j], $j, $L);
}
//===========================================================================
// Functions
// ==========================================================================
function getTile($title, $syndic, $provid, $j, $L) // re-using the identifiers
{
// ----- Ive lifted this from the previous experiment now live on home page.
// ----- I ought to tidy both up sometime. The HTML is based on a previous format using Tables
$echo = <<<EOT
<DIV CLASS="keepTogether">
<!--===== INFORMATION BOX ===== #[$j/$L] written via PHP ============================= -->
<P CLASS="heading">
<SPAN STYLE="font-size: smaller; font-weight: lighter; white-space: nowrap; float: right;">
View as <A HREF="$syndic;">full page</A>
</SPAN>$title</P>
<DIV CLASS="pseudoCell">
<P CLASS="columns">$provid</P>
<IFRAME SRC="$syndic" CLASS="calendar">ERROR: Unfortunately, your
browser does not support i-frames, so our content cannot display here.
Please <A HREF="<? echo $syndic; ?>">click here</A> to view it.
</IFRAME>
</DIV>
<P CLASS="pseudoCell"><!--spacer--></P>
</DIV>
EOT;
return $echo;
}
// -------------------------------------------------------------
function makeAnchor($text, $url)
{
return "<a href=\"$url\">$text</a>";
}
// -------------------------------------------------------------
?>