Re: Scheduled Events Add-On
Hi,
Just installed the add-on - seems to work very well - many thanks.
I have a question to take it a step further. I'd like to call the event names and dates into a custom text box on the home page.
I've tried using
<?php include('\includes\templates\orange\templates\tpl_events_home.php');?>
Note I've copied tpl_events_default.php and made tpl_events_home.php in the same directory
I can get text from the file if I add some at the top, (and from a basic php echo 'hello world'), I'm getting nothing from the database. I am not a PHP coder though, just know a few commands.
Does anyone have any ideas. I could be calling the wrong file for starters...
Cheers,
Adam.
Re: Scheduled Events Add-On
When you say text box, are you talking something in one of the sideboxes or a box on the main page?
Re: Scheduled Events Add-On
Hi,
Sorry, should have been clearer. It'll be a section on the main page (define_main_page.php) where I call in the next 2-3 events from the database.
Quote:
e.g
SCHEDULED EVENTS
The Peak Open Air Market
2010-09-25
Bradbury School Fair
2010-10-13
More >>>
Thanks,
Adam.
Re: Scheduled Events Add-On
Okay, I'll take a look later this evening. Out on laptop now.
Re: Scheduled Events Add-On
Just a quick look and no guarantees till I can look at it better.
You'll need the $result call out of includes/modules/pages/events/header.php
Quote:
$result = $db->Execute("SELECT * FROM events WHERE (event_stop >= NOW()-1) ORDER BY event_start");
$eventData = array();
while (!$result->EOF) {
$eventData[] = $result->fields;
$result->MoveNext();
}
That will get your data out of the database.
Next, you will need to change
Quote:
<?php
// Display the text of each event in a paragraph
foreach($eventData as $eventInfo) {
echo "<h5>" . $eventInfo["event_name"] . "</h5><hr />";
echo "<blockquote>";
if ($eventInfo['event_location'] != '') echo "<strong>Place: </strong>" . $eventInfo["event_location"] . "<br />";
if ($eventInfo['event_start'] != '') echo "<strong>Start Date: </strong>" . zen_date_long($eventInfo["event_start"]) . "<br />";
if ($eventInfo['event_stop'] != '') echo "<strong>Stop Date: </strong>" . zen_date_long($eventInfo["event_stop"]) . "<br />";
//if ($eventInfo['Comments'] != '') echo "<strong>Comments: </strong>" . $eventInfo["Comments"] . "<br />";
if ($eventInfo['event_booth_location'] != '') echo "<strong>Booth Location: </strong>" . $eventInfo["event_booth_location"] . "<br />";
if ($eventInfo['special_text'] != '') echo "<strong>Special: </strong>" . $eventInfo["special_text"] . "<br />";
if ($eventInfo['map'] != '') echo "<strong><a href=" . $eventInfo["map"] . ' target="_blank">Driving Directions</a></strong>';
echo "</blockquote><hr />";
}
?>
to use for versus foreach and tell it to list however many you want.
Bear in mind that this will bomb if set to 3 and you only have 2 events.
<disclaimer>Not tested and I'm tired from an eleven hour day in the mall.:sleep1:
Re: Scheduled Events Add-On
Many thanks, was out all day yesterday but will give this a try today and let you know how I get on...
Re: Scheduled Events Add-On
Okay, as I suspected my PHP *ahem* skills are not up to the task...
I understand how tpl_events_default works with regard to displaying the data, so assumed I would be able to call this into another page, in my case 'define_main_page.php', and then simply remove the echo statements for the data I don't want to show.
I then planned to play around with the PHP to try and limit the events to the next 2-3 on the list (which you've kindly provided some code for). But I can't get the basic idea to work.
The page call (include) is working. I'm getting the back button displayed, and PHP is working (I've added an 'echo' to the top of tpl_events_default.php to check this)
Note I've also checked it is working okay when displaying on it's own page (i.e. /index.php?main_page=events) and there is no problem, it looks great (I don't even have to play around with the look of it)!! But I'm having no luck with a call to the DB when trying to diplay it on another page.
So, where am I going wrong in my asumption I can display the same data on another page? Is it something to do with paths??? :blush:
Cheers,
Adam.
define_main_page.php
Code:
<?php include('\includes\templates\orange\templates\tpl_events_default.php');?>
Re: Scheduled Events Add-On
[FONT=Arial Black]NOTE TO ALL USERS:[/FONT]
We are redoing this mod to make it less invasive of the core files and give two options for installation.
Meanwhile... The mod is working with at least 1.3.9f BUT has a small php 5.3 problem that can be fixed by overwriting the phpMyEdit.class.php file in the root directory you are using for your events.
Extract the zip and load the file to the directory you are using for events.
Re: Scheduled Events Add-On
This might be EXACTLY what the doctor ordered.. Got a potential client that we are contemplating how to use Zen Cart as an events manager tool (Collect RSVPS and payments).. This add-on might be JUST the tool we need to complete this.. Can't wait to see the new version!!
Quote:
Originally Posted by
dbltoe
[FONT=Arial Black]NOTE TO ALL USERS:[/FONT]
We are redoing this mod to make it less invasive of the core files and give two options for installation.
Meanwhile... The mod is working with at least 1.3.9f BUT has a small php 5.3 problem that can be fixed by overwriting the phpMyEdit.class.php file in the root directory you are using for your events.
Extract the zip and load the file to the directory you are using for events.
Re: Scheduled Events Add-On
Good add-on!
The installation is complete now and runs well.
Congrats on the link to Google Maps. Very useful for those who create events in a professional manner.
There is a small error message above the table eventz I reach http://locahlost/eshop/eventz and is:
Deprecated: Function set_magic_quotes_runtime() is deprecated in C:\server\www\myserver.dev\public_html\eshop\eventz\phpMyEdit.class.php on line 3100
I do not wish to speak on the function set_magic_quotes_runtime() because I see it just me being the administrator of the shop.
It is now installed on my laptop on the development site where I'm learning about Zen-Cart and where can I test and add add-ons or modules before installing them in the store.
Thanks. I am every day more pleased to have chosen Zen-Cart.