First I just want to say Thank you to ALL you guys. I also want you to know why…
This is THE only PHP forum that offers help. I have been to other forums and they just do not answer questions and if they happen to it’s rudely and rarely with any kind of explanation. You guys here are just AWESOME!!!
Where I can I link back to your site to show people that I have gotten help from here. I’m thinking I am going to write a module that links back to this forum Thanking you guys for ALL the help you’ve given me.
Once again HUGE Thanks for your patience, kindness and understanding with us all!
OK now to it…
I have written a ‘module’ that displays the Holidays [American] by reading an xml file [Thanks to JimL for the foreach lesson!! LOL]
Now what I’d like to do is match and image with something to trigger it to show that image…
Here is the code that I am using and it’s working fantastically…
[php]
<?php defined ( '_JEXEC' ) or die (); require_once( dirname(__FILE__) . '/helper.php' ); JHtml::stylesheet('modules/' . $module->module . '/assets/css/CoverPop.css'); JHTML::script('modules/' . $module->module . '/assets/js/CoverPop.js',true); $ufc = $params->get('ufont'); $tfc = $params->get('tfont'); $hfc = $params->get('hfont'); $user = JFactory::getUser(); $u = $user->username; $url = ("localhost/joomla/modules/mod_holiday/assets/xml/Holidays.xml"); $ch = curl_init(); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_URL, $url); $data = curl_exec($ch); curl_close($ch); $xml = simplexml_load_string($data); foreach ($xml->event as $listing) { $dates= ($listing->date); $names= ($listing->name); $desc= ($listing->description); date_default_timezone_set("America/New_York"); $d = date("Y-m-d", time()); if ($dates == $d) { ?> <div id="CoverPop-cover" class="splash">
<div class="CoverPop-content splash-center">
<h2 class="splash-title"><font color=<?= $hfc ?> size=100%>It's Holiday Time!</font></h2>
<BR><BR>
<p class="splash-intro"><font color=<?= $tfc ?> size="5"><?= $names ?></font> <font color=#<?= $ufc ?> size="5"><b><?= $u ?></b></font></p>
<BR><BR>
<p class="close-splash"><font color=#000 size="2">Hit ANY key to close</font></p>
</div>
<?php }
} ?>
[/php]
I did it that way because I’m only after two keys in the array so it works for me… Maybe not the best way but it works… I took this from about 275 lines down to what you see… again Thanks JimL for the lesson!!!
SO I’m trying to match an image to a date…
Could I do it by naming the image the same as the date then matching it that way? Or is there an easier way to do it?
In case it’s needed here’s the xml…
<events>
<event>
<date>2015-02-13</date>
<name>Happy Test Day</name>
</event>
<event>
<date>2015-01-01</date>
<name>New Year's Day</name>
<flag_day>1</flag_day>
<url>http://en.wikipedia.org/wiki/New_Year%27s_Day</url>
<description>New Year's Day is observed on January 1, the first day of the year on the modern Gregorian calendar as well as the Julian calendar used in ancient Rome. With most countries using the Gregorian calendar as their main calendar, New Year's Day is the closest thing to being the world's only truly global public holiday, often celebrated with fireworks at the stroke of midnight as the new year starts. January 1 on the Julian calendar currently corresponds to January 14 on the Gregorian calendar, and it is on that date that followers of some of the Eastern Orthodox churches celebrate the New Year.</description>
</event>
<event>
<date>2015-01-19</date>
<name>Martin Luther King, Jr. Day</name>
<flag_day>1</flag_day>
<age>86</age>
<url>http://en.wikipedia.org/wiki/Martin_Luther_King,_Jr._Day</url>
<description>Martin Luther King, Jr. Day is a United States federal holiday marking the birthday of Rev. Dr. Martin Luther King, Jr. It is observed on the third Monday of January each year, which is around the time of King's birthday, January 15. The floating holiday is similar to holidays set under the Uniform Monday Holiday Act, though the act predated the establishment of Martin Luther King, Jr. Day by 15 years.</description>
</event>
This isn’t the entire xml but it’s too large to put here… so I just put the first three… this file goes through 2020
Thank you!!