vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   How to insert this PHP line?!?! (https://vborg.vbsupport.ru/showthread.php?t=55699)

WoodiE 07-29-2003 04:52 AM

How to insert this PHP line?!?!
 
Hello, I'm wanting to install a quote script called phpMyQuote on my forum.

I'd like to display the quotes on the forum home, but I am unsure of how to or where to insert the php code. Below is part of the Readme file:

Quote:

How to install Random Quote Viewer into your webpage:

1.) The first thing is to edit file quotes.inc.php. You just have to change the line:
$path = "/home/httpd/virtual/temp/myQuotes/";

Just write the right path where config.inc.php exist !

2.) Now open your personal webpage and go to the position where random quote should be displayed. You have to include file quotes.inc.php and then you just call function ShowQuote() which return string with quote:

Example:
include("quotes.inc.php");
echo ShowQuote();

You should also check for the right path in include statement.
If you dont use mysql at your webpage the code should be like this:

Example:
include("quotes.inc.php");
$link = ConnectMysql();
echo ShowQuote();
DisconnectMysql($link);

We have also include example which can be found in file testQuote.php
I know I have the script installed correctly because the testQuote.php displays them just fine, I just don't have a clue on how to get this on my forum home, would anyone care to help me out?


-Michael

Gary King 07-29-2003 04:48 PM

Open forum/index.php and find:
PHP Code:

require('./global.php'); 

Replace with
PHP Code:

require('./global.php');
include(
"quotes.inc.php");

$showquote=ShowQuote(); 

Now place
PHP Code:

$showquote 

in your forumhome template wherever you want it to show up.

WoodiE 07-29-2003 08:10 PM

I receive this error when I do the above:

LINE 8:Table 'rcnitro_forum.quotes' doesn't exist

What would cause that?

-Michael

Dean C 07-29-2003 08:41 PM

You don't have the table in your database :)

Velocd 07-29-2003 08:44 PM

Perhaps replace:
PHP Code:

require('./global.php'); 
include(
"quotes.inc.php"); 

$showquote=ShowQuote(); 

With:
PHP Code:

include("quotes.inc.php"); 
$showquote=ShowQuote();

require(
'./global.php'); 

My only guess is the DB connections are getting interlinked or something. Maybe it is searching for rcnitro_forum on the vBulletin database? Which, of course, is the wrong thing.

Velocd 07-29-2003 08:46 PM

Oh, or as Mist said, you didn't add the table into your database. ;)

WoodiE 07-29-2003 08:56 PM

Hmm this script looks so easy, but its kicking my butt right now.

Here is what I have setup for my config.inc.php file:

PHP Code:

<?
$host     = "localhost";
$username = "rcnitro_quotes";
$password = "************";
$database = "rcnitro_quote";
$mytable  = "quotes";
?>

I have already imported/ran or whatever you call it the "dump.sql" and have added two test quotes. The database even shows them as being added. I goto quotes admin panel and I can add, edit, and delete quotes just fine.

So what am I doing wrong?


-Michael


EDIT: One thing I did forget to mention... the quotes script is installed in "public_html/quotes" while the forum is installed on "public_html/forum" if that makes any difference.

Velocd 07-29-2003 09:29 PM

If config.inc.php is located in that directory, than what you should do is:

PHP Code:

require_once('global.php');

chdir('../quotes/');
require_once(
'config.inc.php');
$showquote=ShowQuote(); 

I believe..

WoodiE 07-29-2003 09:54 PM

Done as you suggested and received this error:

Fatal error: Call to undefined function: showquote() in /home/rcnitro/public_html/forum/index.php on line 21

-Michael

Velocd 07-29-2003 09:56 PM

Sorry, I made you reference to the wrong file ... ^^

Replace:

config.inc.php

With:

quotes.inc.php

;)


All times are GMT. The time now is 07:59 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01055 seconds
  • Memory Usage 1,747KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (7)bbcode_php_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete