1

Topic: Calendar and Frontpage

Thanks for your time.

My goal is to cause manually-toggled calendar events to display on the front page.  To do this, the calendar queries a private forum, which the frontpage sticky then reads from.

The problem is, the calendar uses raw HTML, frontpage uses raw HTML, however the forum uses BBcode and parses any HTML it sees.  I need to find a way around that, either by making the forum stop parsing the damn calendar entry, or by creating a different repository for the data which uses raw HTML and would match, or by letting the checkbox 'flag' a certain calendar post as 'current', causing frontpage to point to it as its source item.

Or maybe there's a better way than any of those, that's just what I've come up with.

What I'm doing right now is attempting to get the calendar to write to the admin text in the frontpage plugin, since I don't need multiple 'current' events at once.  The problem I'm running into is that when I read the backup file, the sql entries don't make sense to me (mainly because I've never used sql before) - mostly this is what's troublesome:

INSERT INTO site_config (conf_name, conf_value) VALUES('fp_sticky_txt', 'data');

I have no idea what conf_name and conf_value are supposed to be changed to for a static query from calendar, because I haven't been able to make sense out of the variable assignments above that block of queries, which leaves me with my current problem of "how the hell do I get at the frontpage data?".

As I said before, there may be a much cleaner implementation than what I'm shooting for, so if you're inclined to leave a reply, feel free to criticize any vector of this post.

Thanks again, and in advance for any assistance,
--Radix

Re: Calendar and Frontpage

radix,
this is what i made that pulls the events from the calendar and when it get close to that date it displays the event

old site im about to redo http://modelcrowd.com
here the code!

this file goes in the include/user folder and i place it in the main.tpl with a
<pun_include "upevents.php"> where i want it to show up....

 
 <div class="block">
            <h2><span>Calendar Events</span></h2>
            <div class="box">
                <div class="inbox">
<ul>
<?php

 $show = isset($_GET['show']) ? intval($_GET['show']) : 15;
        if ($show < 1 || $show > 50)
            $show = 15;

$events= $db->query('SELECT date, id, title FROM '.$db->prefix.'calendar WHERE (date >= CURDATE()) AND  (date <= DATE_ADD(CURDATE(), INTERVAL 14 DAY))') or error ('Unable to fetch date and events: '.$db->error());

        while ($cur_event = $db->fetch_assoc($events))
        {
            if ($pun_config['o_censoring'] == '1')
                $cur_event['title'] = censor_words($cur_event['title']);

                $subject_truncated = pun_htmlspecialchars($cur_event['title']);

            $dateformatted = preg_replace("/-/", ".", $cur_event['date']);
            echo '<li><a href="'.$pun_config['o_base_url'].'/calendar.php?view=event&date='.$dateformatted.'" title="'.pun_htmlspecialchars($cur_event['title']).'">'.$subject_truncated.'</a></li><br>'."\n";

        }

?>
</ul>
<p> </p>
</div>
                    </div>
                    </div>
My stuff or my style might sux, but atleast I'm willing to help when I can.
Don't be stupid and help ! We are the stupid one's !!!

3

Re: Calendar and Frontpage

Awesome.

One thing: Because not all events should go on the frontpage (and I only need one posted at a time), is there a way for me to use the checkbox I added in calendar post/edit to basically let the event author "flag" one post at a time to be put up on the front page manually, in a simpler way than having to write to the database and then have this code read that data to find out which event should be put on the front page?

Re: Calendar and Frontpage

not sure about that... i hacked at the calendar for a while and finally got that one working...

Q

My stuff or my style might sux, but atleast I'm willing to help when I can.
Don't be stupid and help ! We are the stupid one's !!!