Joined: Nov 2001
Posts: 10,369
I type Like navaho
I type Like navaho
Joined: Nov 2001
Posts: 10,369
Heya,
I'm trying to include some pal boxes in a sidebar on threads pages.
I've successfully done this with some tweaking with the shoutbox....
But in doing anything else, I get this error:
Call to a member function on a non-object in blahblahblah... It does it when it hits this:
$sth = $dbh -> do_query($query); I know it has to do with defining $sth or $dbh above it... but I really don't understand how this $sth and $dbh stuff works.
As this is a threads page, main.inc.php is already required....
I know it's a simple thing... so please teach me oh masters.
Joined: Jun 2001
Posts: 3,273
That 70's Guy
That 70's Guy
Joined: Jun 2001
Posts: 3,273
Try adding this to the page:
$sth = new sth;
$dbh = new dbh;
This will initialize the object.
Joined: Nov 2001
Posts: 10,369
I type Like navaho
I type Like navaho
Joined: Nov 2001
Posts: 10,369
I'm trying to add "hottopicpal.php" to my sidebar.
I added what you suggested... then it squawks:
Cannot instantiate non-existent class: sth in ..... when it hits the $sth
Here's what the file begins with:
code: $html = new html; $date = $html -> get_date(); $cdate = $date - ($hottopiccache * 60); $date = $date - 86400; if ((!$LastCacheTime) || (!$HotTopicData) || ($LastCacheTime < $cdate)) { if ($nostickyhottopic) { $nosticky = "AND (B_Sticky = 0 OR B_Sticky IS NULL)"; } else { $nosticky = ""; } $sth = new sth; $dbh = new dbh; $query = " Query removed to save space "; $sth = $dbh -> do_query($query);main.inc.php has already been required on that page. If I add that in, it kills the output from that point on.
Any more suggestions. :shrug:
Joined: Jun 2001
Posts: 3,273
That 70's Guy
That 70's Guy
Joined: Jun 2001
Posts: 3,273
The $sth probably doesn't need to be designated as an object since I don't believe there is an sth class. So you can leave that out. It's odd that the database object dbh has to be initialized since it is done when main.inc.php is included.
Joined: Nov 2001
Posts: 10,369
I type Like navaho
I type Like navaho
Joined: Nov 2001
Posts: 10,369
Hmmmm....
Fatal error: Cannot instantiate non-existent class: dbh.....
Do you think it's because the sidebar technically comes after the footer file?
Here is the link:
http://www.measurection.com/test/ubbthreads.php Trying to add the hottopic pal to the window below the shoutbox. ???
As always, thanks for your help. Occasionally (ie all the time LOL) I get in over my head.
Joined: Jun 2001
Posts: 3,273
That 70's Guy
That 70's Guy
Joined: Jun 2001
Posts: 3,273
Where exactly are you adding the IIP code? Into the templates?
We'll figure it out sooner or later...
Joined: Nov 2001
Posts: 10,369
I type Like navaho
I type Like navaho
Joined: Nov 2001
Posts: 10,369
Ok -
I've got a "sidebar" template which I "include" in the send footer function in ubbt.inc.php
My ubbt_sidebarend.tmpl file:
code: <? //UBBTREMARK echo <<<UBBTPRINT </td> <td align="left" valign="top" width="2%"> </td> <td align="right" valign="top" width="23%"> <!--Sidebar Content Starts Here--> UBBTPRINT; $palspath = "/home/measurection/htdocs/test"; include "{$palspath}/pals/languagepal.php"; include "{$palspath}/pals/configpal.php"; include "{$palspath}/pals/tablewrappers.tmpl"; include "{$palspath}/pals/announcementpal.php"; include "{$palspath}/pals/shoutboxpal.php"; include "{$palspath}/pals/hottopicpal.php"; include "{$palspath}/pals/morestuffpal.php"; echo <<<UBBTPRINT <!--Sidebar Content Ends Here--> </td> </tr> </table> </body> UBBTPRINT; /* UBBTREMARK */ ?>Maybe I should try calling the template from the send footer file to start the side bar....
then do the includes from the ubbt.inc.php file... then call another template to close it all up? <shrug>
Seems like it should be possible. I got the shoutbox to work.
Joined: Jun 2001
Posts: 3,273
That 70's Guy
That 70's Guy
Joined: Jun 2001
Posts: 3,273
Ok I think I may know the problem...
In your send_footer function, in ubbt.inc.php file add $dbh to the global call.
It looks something like this:
global $config, $theme, $thispath,...
That should make it available I believe.
Joined: Nov 2001
Posts: 10,369
I type Like navaho
I type Like navaho
Joined: Nov 2001
Posts: 10,369
Hmmmm....
Nope. Doesn't like that stuff being in the footer.
Tried adding in $dbh and $sth
It breaks. Can't login etc....
Warning: Supplied argument is not a valid MySQL result resource in /home/measurection/htdocs/test/mysql.inc.php on line 121
I'm just totally ignorant to what this $dbh and $sth stuff is about.
I've looked at the included thrads addons, which are designed to work outside of threads... but they seem similar to me as the pal boxes.
Joined: Jun 2001
Posts: 3,273
That 70's Guy
That 70's Guy
Joined: Jun 2001
Posts: 3,273
Leave out the $sth from the global call $dbh should be all that's needed... I'll try and give this more thought. It should work... lol
Joined: Nov 2001
Posts: 10,369
I type Like navaho
I type Like navaho
Joined: Nov 2001
Posts: 10,369
Yeah,
First I tried just $dbh... then I tried adding in the $sth
Neither worked.
It produces the errors twice above the headers...and once above the footer. 3 times on the page.
Thanks for thinking about it. Surely it's possible... but it doesn't seem to like being outside of the footer (or in the footer function).
Yet, shoutbox worked.
Joined: Jun 2001
Posts: 3,273
That 70's Guy
That 70's Guy
Joined: Jun 2001
Posts: 3,273
The actual shout box page is in the iframe which is seperated from your main page. That's why it's working. You'll be happy to know that IIP 6.0 allows for the placement of what ever you want into a side bar.
Joined: Nov 2001
Posts: 10,369
I type Like navaho
I type Like navaho
Joined: Nov 2001
Posts: 10,369
Cool!
I actually didn't report the error right.
With just $dbh in the global call..
I get this:
Fatal error: Cannot instantiate non-existent class: dbh in....
where the hottopic pal should be. The rest of the output is killed after that.
Joined: Jun 2001
Posts: 3,273
That 70's Guy
That 70's Guy
Joined: Jun 2001
Posts: 3,273
Possibly try adding this code to the template portion of the sidebar:
require_once ("path/to/main.inc.php");
and see if that helps any.
Joined: Nov 2001
Posts: 10,369
I type Like navaho
I type Like navaho
Joined: Nov 2001
Posts: 10,369
That helped alot.... sorta.
I didn't get any errors....
howerver I seem to have some debugging table above my hottopic thing.
Have you ever seen this?
http://www.measurection.com/test/ubbthreads.php?Cat= Seems to be like the results of the query.
But we are moving in the right direction!
Thanks.
Joined: Jun 2001
Posts: 3,273
That 70's Guy
That 70's Guy
Joined: Jun 2001
Posts: 3,273
I don't see anything out of the norm. Possibly because I'm not an admin. Your not getting the usual errors though, right? The side bar isn't present so I take it it still fails?
Joined: Nov 2001
Posts: 10,369
I type Like navaho
I type Like navaho
Joined: Nov 2001
Posts: 10,369
Doah,
Might have it so only logged in users see the side bar.
You are right... a regular user doesn't see what I see.
It's working for me.... except above the hot topic... I've got this chart (attached).
[]
https://www.ubbdev.com/threads/php/uploads/59856-debug.gif [/]
Attachments
Last edited by JoshPet; 11/03/2002 9:51 PM .
Joined: Jun 2001
Posts: 3,273
That 70's Guy
That 70's Guy
Joined: Jun 2001
Posts: 3,273
That's odd. You should only get that if you add the &Debug=1 to URL. And in doing that, there really shouldn't be anything else displayed. (although IIP will still display along with the debug info but this is fixed in next release
)
LoL let me think about this some more...
Joined: Nov 2001
Posts: 10,369
I type Like navaho
I type Like navaho
Joined: Nov 2001
Posts: 10,369
I checked.... $debug is already in the global call for the footer....
But I cheated.
I added
$debug = "0";
into the Hot Topic poll.
And it worked.
Thank YOU for your help.
(as always... I learned alot)
Joined: Jun 2001
Posts: 3,273
That 70's Guy
That 70's Guy
Joined: Jun 2001
Posts: 3,273
I'm glad I was of some assistance... I felt sort of blind... lol
Joined: Nov 2001
Posts: 10,369
I type Like navaho
I type Like navaho
Joined: Nov 2001
Posts: 10,369
LOL
No your little clues kept me plugging in the right direction.
Never would have thought to put $dbh into the global call of the footer. Still don't know what $dbh is, but it's there... and it works.
Now it's up and working.... independently.
Right now it shows all forums... but I need to copy the bit from the index.php file that restricts the posts that get put.
When I get this all done, I should post it, in case anyone wants to use hot topic on it's own. It's really a cool little pal box.
Donate to UBBDev today to help aid in Operational, Server and Script Maintenance, and Development costs.
Please also see our parent organization VNC Web Services if you're in the need of a new UBB.threads Install or Upgrade, Site/Server Migrations, or Security and Coding Services.
Posts:
87
Joined: December 2001
Forums63
Topics37,583
Posts293,955
Members13,824
Most Online151,614Nov 14th, 2025
Currently Online 547
Topics Created 0
Posts Made 0
Users Online 0
Birthdays 12