Montego Scripts: Forums
 

 

View next topic
View previous topic
Post new topic   Reply to topic
Author Message
charmquark
Newbie
Newbie



Joined: Sep 13, 2005
Posts: 11

PostPosted: Sun Dec 10, 2006 10:50 am Reply with quote

Hi Montego ... great newsletter script!

My domain of interest has few downloads, ie: only the same three files available since startup more than 4 years ago. Unless something changes Downloads just isn't news these days.

But the domain is heavy on the calendar use! I'm using TotalCalendar atm.

My procedure is to select-all in the current calendar center-block, copy/paste to txt editor, make edits, copy/paste to the new newsletter copy, send it all as part of the body of the email. I'll continue to put calendar details into the body of the newsletter, but I would like to get more stats on the email page about Events, particularly the number of upcoming events in the db.

This may be all too complicated for me, but I'll give it a try... my comments about confusion are in comment lines.


Code:
 

// in admin_make_nls.php

//Add After
//         } else { //Successful SQL call

              $msnl_iStatsTotReviews        = intval( $db->sql_numrows( $result10 ) );

//        }

//Total Events Calendar

        $sql                                                                                = "SELECT * FROM `tcal_events`";
        $result11                                                                 = msnl_fSQLCall( $sql );

        if ( !$result11 ) { //Bad SQL call

                msnl_fRaiseAppError( _MSNL_ADM_MAKE_ERR_DBGETSTATSEVENTS );

        } else { //Successful SQL call

                $msnl_iStatsTotEvents                        = intval( $db->sql_numrows( $result11 ) );

        }
// created $result11 for tcal_events table.
// end Step 1

// Step 2
        //Replace the stats rows in the template

        $msnl_sTotStats = $statstable;

        $msnl_sTotStats = str_replace( "{EVENTS}",                        $msnl_iStatsTotEvents,        $msnl_sTotStats );

// created a placeholder for the template
// end Step 2

// Step 3  /************************************************************************
* Build the Latest X Events Items - to replace the {EVENTS} tag
************************************************************************/
//  Now I'm lost, because if using the News tag as an example it already has $select11 included. 

        } else { //Successful SQL call

                while ( $row = $db->sql_fetchrow( $result11 ) ) { 




My guess, $result11 is already being used by something else, therefore I need to rename my EVENTS $result $resultx 12? 22?


Thinking I can resolve that issue I push on and

Code:


// Build the Latest X Events Items - to replace the {EVENTS} tag

if ( $_POST['msnl_events'] > 0 && $msnl_sTemplateNm != "notemplate" ) {

        $i                                        = 0;
        $msnl_sRows        = "";

        $sql                                = "SELECT `sid`, `informant`, `title`, `topic`, `topictext`, a.`counter` AS counter FROM `"
                                                        . $prefix."_stories` a, `"
                                                        . $prefix."_topics` b "
                                                        . "WHERE a.`topic` = b.`topicid` "
                                                        . "ORDER BY `time` DESC LIMIT 0, ". $_POST['msnl_events'];

        $result11        = msnl_fSQLCall( $sql );

        if ( !$result11 ) { //Bad SQL call

                msnl_fRaiseAppError( _MSNL_ADM_SEND_ERR_DBGETNEWS );

        } else { //Successful SQL call

                while ( $row = $db->sql_fetchrow( $result11 ) ) {

//  Now I'm lost because of $result11 confuddlement and my not yet working sql call.
                        $msnl_iSID                                        = intval( $row['sid'] );
                        $msnl_sNewsAuthor                = stripslashes ( $row['informant'] );
                        $msnl_sNewsTitle                = stripslashes( $row['title'] );
                        $msnl_iNewsTopicID        = intval( $row['ctopic'] );
                        $msnl_sNewsTopic                = stripslashes( $row['topictext'] );
                        $msnl_iNewsHits                        = intval( $row['counter'] );

                        $i        = ++$i; //Keep track of row number

// keeping at it again...

                        $msnl_sRowTmp = $latesteventsrow;

                        $msnl_sRowTmp = str_replace( "{EVENTSID}",                $msnl_iSID,                                                $msnl_sRowTmp );
                        $msnl_sRowTmp = str_replace( "{ROWNUMBER}",        $i,                                                                                $msnl_sRowTmp );

// Need to rewrite the following as per sql call ...

                        $msnl_sRowTmp = str_replace( "{TITLE}",                        $msnl_sNewsTitle,                        $msnl_sRowTmp );
                        $msnl_sRowTmp = str_replace( "{TOPICID}",                $msnl_iNewsTopicID,                $msnl_sRowTmp );
                        $msnl_sRowTmp = str_replace( "{TOPIC}",                        $msnl_sNewsTopic,                        $msnl_sRowTmp );
                        $msnl_sRowTmp = str_replace( "{AUTHOR}",                $msnl_sNewsAuthor,                $msnl_sRowTmp );
                        $msnl_sRowTmp = str_replace( "{HITS}",                        $msnl_iNewsHits,                        $msnl_sRowTmp );

                        $msnl_sRows .= $msnl_sRowTmp;

                } //End while to build rows

// Pushing on

                $msnl_sLatestEvents = $latestevensttop . $msnl_sRows . $latesteventsend;

                $msnl_sLatestEvents = str_replace( "{AMOUNT}",        $_POST['msnl_events'],        $msnl_sLatestEvents );

        } //End IF successful DB Call

} else { //Will not be including Latest Events

        $msnl_sLatestEvents = "";

} //End IF for Latest X Events Items



So, that's as far as I got. I'll have to sort out the sql call before I can go much further. But I have that question about $result11.

Thanks for any and all clues and help.
 
View user's profile Send private message
montego
Site Admin/Owner
Site Admin/Owner



Joined: Feb 12, 2005
Posts: 1391

PostPosted: Sun Dec 10, 2006 11:12 am Reply with quote

To be quite honest, in either 1.4 or 2.0 I am going to remove all of those extra variables. It is NOT necessary to have separate $result variables for every call. I have not decided yet whether I am going to do a

$result = '';

or possible an unset, just before using it each time though. Call it whatever you like. It could even be $charm if you like. Laughing

Looks like you are on the right track with the other changes you've made. I see that you are wanting the number of events in the block to be configurable. Unfortunately, this complicates it a bit. You will need to change now admin.php and admin_check_post.php and you will need to add the new entry into the cfg table.

_________________
“To err is human, but when the eraser wears out ahead of the pencil, you’re overdoing it.”
-- Josh Jenkins 
View user's profile Send private message Visit poster's website
Display posts from previous:       
Post new topic   Reply to topic

View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001-2007 phpBB Group
All times are GMT - 4 Hours
 
Forums ©
linear-bunch
linear-bunch