As I said earlier, I'm very anxious to install the analog clock, so I started working on a new installation quickly. But... still no luck!
First, let me say that my site is built with Zen Cart, which reads from various .php files and builds the .html code. What I want to do is have the clock in my page footer, common to all pages. I have created a footer menu with the clock on the left part of the footer.
To build the menu, I use a number of <li>...</li> and format it with css. The footer is within the file english.php (a language file) and there is a similar footer within the greek.php file, which displays the same contents in my Greek pages.
The english.php file starts as below:
define('FOOTER_TEXT_BODY', '
<div id="customfooter">
<div id= "custommenu" class="custommenu">
<ul>
<li class="col00 firstcol">
script type="text/javascript" src="swfobject.js"></script>
<script type="text/javascript"><!--
var flashvars = {
clockSkin: "media/skins/skin004.png",
arrowSkin: "7",
showSeconds: "no",
arrowScale: "70",
UTCTime: "<?php echo gmdate('H:i:s'); ?>",
timeOffset: "3600",
widgetUrl: "http://www.xorbin.com/"
};
swfobject.embedSWF(
"devAnalogClock.swf",
"devAnalogClock",
"220",
"220",
"8",
"expressInstall.swf",
flashvars,
{scale: "noscale", wmode: "transparent"}
);
// --></script>
<li class="col00"> </li>
<li class="col0 coltopper"></li>
<li class="col0"><a href="index.php?main_page=index&language=en"><img border="0" src="images/design/home.png" width="24" height="24" alt="Home" title="Home" /></a></li>
<li class="col0"><a onClick="window.scrollTo(0,0);"><img border="0" src="images/design/top.png" width="24" height="24" alt="Top of page" title="Top of page" /></a></li>
<li class="col1 coltopper">Info</li>
<li class="col1"><a href="index.php?main_page=about_us&language=en">About Athens Collectibles</a></li>
<li class="col1"><a href="index.php?main_page=contactus&language=en">Contact us</a></li>
<li class="col1"><a href="index.php?main_page=site_map&language=en">Site map</a></li>
<li class="col1"><a href="index.php?main_page=advanced_search&language=en">Advanced search</a></li>
<li class="col2 coltopper">Shop</li>
<li class="col2"><a href="index.php?main_page=products_new&language=en">New products</a></li>
<li class="col2"><a href="index.php?main_page=featured_products&language=en">Featured products</a></li>
<li class="col2"><a href="index.php?main_page=products_all&language=en">All products</a></li>
<li class="col2"><a href="index.php?main_page=art&language=en">Our art gallery</a></li>
<li class="col3 coltopper">Policies</li>
<li class="col3"><a href="index.php?main_page=conditions&language=en">Terms and conditions</a></li>
<li class="col3"><a href="index.php?main_page=privacy&language=en">Privacy policy</a></li>
<li class="col3"><a href="index.php?main_page=payments&language=en">Payment methods</a></li>
<li class="col3"><a href="index.php?main_page=shippinginfo&language=en">Shipping and returns</a></li>
<li class="col4 coltopper">Various</li>
<li class="col4"><a href="index.php?main_page=dvdinfo&language=en">Information about our DVD</a></li>
<li class="col4"><a href="index.php?main_page=reward&language=en">Reward Program</a></li>
<li class="col4"><a href="index.php?main_page=destinations&language=en">Where we ship</a></li>
<li class="col4"><a href="index.php?main_page=unsubscribe&language=en">Unsubscribe from newsletter</a></li>
</ul>
</div>
........ (some more <div>...</div> content here)
');
@setlocale(LC_TIME, 'en_US.ISO_8859-7');
define('DATE_FORMAT_SHORT', '%d/%m/%Y'); // this is used for strftime()
define('DATE_FORMAT_LONG', '%A %d %B, %Y'); // this is used for strftime()
define('DATE_FORMAT', 'd/m/Y'); // this is used for date()
define('DATE_TIME_FORMAT', DATE_FORMAT_SHORT . ' %H:%M:%S');
if (!function_exists('zen_date_raw')) {
function zen_date_raw($date, $reverse = false) {
if ($reverse) {
return substr($date, 0, 2) . substr($date, 3, 2) . substr($date, 6, 4);
} else {
return substr($date, 6, 4) . substr($date, 3, 2) . substr($date, 0, 2);
}
}
}
define('LANGUAGE_CURRENCY', 'GBP');
define('HTML_PARAMS','dir="ltr" lang="en"');
define('CHARSET', 'iso-8859-7');
define('FOOTER_TEXT_REQUESTS_SINCE', 'requests since');
......... (more php content)
You can see the clock code there near the top as copied from the http://www.xorbin.com/widgets/analog-fl
/example-5 page.
This doesn't work and produces a 500 error (very generic "Internal Server Error"). When the UTCTime was removed, it didn't give the 500 error but the clock did not display. So, having transferred the "js" and "media" folders to my root directory, I started investigating the reasons and found out:
1. The skin does not display if it remains within the media/skins folder. It does display if it's moved to my root directory. As the default skin002.png was too large, I edited it with PhotoShop, reduced its size from 144x144 to 75x75 renaming it to clock.png (just to make some sense) and moved it to the root directory. I edited the two parameters from '200' to '75' and changed the path in clockSkin variable to "clock.png".
2. The javascript swfobject.js is not executed if src="swfobject.js" as in line 2 of the example. I changed it to src="js/swfobject.js" and it works.
3. I also changed lines 14 and 19 of the example to read "media/devAnalogClock.swf" and "media/expressInstall.swf" for the same reason, that is I added the media/ to the path.
4. I changed some other variables like arrowSkin, showSeconds and arrowScale but these changes are irrelevant to the clock's functionality.
After all the changes, I ended with the following code:
<p id="devAnalogClock"><a href="http://www.xorbin.com/">Analog flash clock widget</a></p>
<script type="text/javascript" src="js/swfobject.js"></script>
<script type="text/javascript"><!--
var flashvars = {
clockSkin: "clock.png",
arrowSkin: "2",
showSeconds: "yes",
arrowScale: "60",
timeOffset: "3600"
};
swfobject.embedSWF(
"media/devAnalogClock.swf",
"devAnalogClock",
"75",
"75",
"8",
"media/expressInstall.swf",
flashvars,
{scale: "noscale", wmode: "transparent"}
);
// --></script>
This gives me a nice clock but it displays the visitor's time, not my time as intended. Please note that the timeOffset parameter in the above code does not change anything. The time shown is my computer's time whatever value I give to it (3600, +3600, 10800, +10800) or even when I completely delete the line. This is understandable as there is no base time to calculate the offset.
Every time I insert the UTCTime: "<?php echo gmdate('H:i:s'); ?>", line I get the dreaded 500 error. I have no idea of php and javascript but I tried changing the double quotes at the beginning and end with single quotes, escaped single and double quotes or no quotes. No improvement!
The clock can be seen at the footer of my http://www.athenscollectibles.info/inde
page=index main page. Never mind the misaligned footer contents, I will sort it out with css if the clock finally works.
My server runs PHP 5.2.17 if that makes any difference.
I shall be watching this forum for any ideas or suggestions. Thanks in advance for your assistence.
George