vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   Display site stats on external page? (https://vborg.vbsupport.ru/showthread.php?t=213383)

globofan 05-11-2009 01:11 PM

Display site stats on external page?
 
My site forums are located at.. www.mysite.com/forums

But the homepage (www.mysite.com/index.php) is running a basic php/html news system. On the homepage how would i show the latest posts in the form and other details? Its outside the actual forum root so i do not know how it would work


I also need to know how to make an external php file to show the user profile info (latest user posts etc)..
something like www.mysite.com/showprofile.php?username=admin (shows admins profile info)

Lynne 05-11-2009 02:31 PM

You will have to do a query in your php page in order to get the latest posts. You can go find a modification that does the latest posts and just use the same query and templates to spit out the information on your page. You'll need to include global.php, just do it like this:
PHP Code:

chdir('/path/to/your/forums');
require_once(
'./global.php'); 

As for creating another page, this should help - [How-To] vBulletin API Basics: Creating Custom Pages & Misc.

Byron 05-12-2009 07:48 AM

hmm, i just ask the same question also

https://vborg.vbsupport.ru/showthrea...12#post1809212

Maybe we can help out each other.

SVTCobraLTD 05-12-2009 02:16 PM

Do a search for displaying content on external page. There are ones for logging in and displaying the stats.

globofan 05-12-2009 02:30 PM

I followed that method exactly and just got a blank page? that guide was made in 2004, surley it won't work with the newest vb version?

Lynne 05-12-2009 03:01 PM

Yes, it works with the newest version. If you have a blank page, then you did something wrong. You may post your code here - just make sure you put php or html (depending) tags around your code.

globofan 05-12-2009 03:15 PM

Lynne, thanks for this help :D

forum is located at mysite.com/forums
this script is located at mysite.com/file/vbtest/test.php and the .html is in that folder too.


test.php file code..

PHP Code:

<?php

// ######################## SET PHP ENVIRONMENT ###########################
error_reporting(E_ALL & ~E_NOTICE);

// ##################### DEFINE IMPORTANT CONSTANTS #######################
// change the line below to the actual filename without ".php" extention.
// the reason for using actual filename without extention as a value of this constant is to ensure uniqueness of the value throughout every PHP file of any given vBulletin installation.

define('THIS_SCRIPT''test'); 

// #################### PRE-CACHE TEMPLATES AND DATA ######################
// get special phrase groups
$phrasegroups = array();

// get special data templates from the datastore
$specialtemplates = array();

// pre-cache templates used by all actions
$globaltemplates = array(
                         
        
// change the lines below to the list of actual templates used in the script
        
'test_mytesttemplate1',
 
);

// pre-cache templates used by specific actions
$actiontemplates = array();

// ########################## REQUIRE BACK-END ############################

chdir('/home/netgoon/public_html/domains/mysite.com/forums');
require_once(
'./global.php');  

// #################### HARD CODE JAVASCRIPT PATHS ########################
$headinclude str_replace('clientscript'$vbulletin->options['bburl'] . '/clientscript'$headinclude);

// ########################################################################
// ######################### START MAIN SCRIPT ############################
// ########################################################################

$navbits = array(); 
// change the line below to contain whatever you want to show in the navbar (title of your custom page)
$navbits[$parent] = 'Test Page';

$navbits construct_navbits($navbits);
eval(
'$navbar = "' fetch_template('navbar') . '";');

// change the line below to contain the name of the actual main output template used in your script
eval('print_output("' fetch_template('test_mytesttemplate1') . '");');
?>

test_mytesttemplate1.html code..

HTML Code:

$stylevar[htmldoctype]
<html dir="$stylevar[textdirection]" lang="$stylevar[languagecode]">
<head>
$headinclude
<title>$vboptions[bbtitle]</title>
</head>
<body>

$header
$navbar

<table class="tborder" cellpadding="$stylevar[cellpadding]" cellspacing="$stylevar[cellspacing]" border="0" width="100%" align="center">
<tr>
<td class="tcat">My Custom Page Title</td>
</tr>
<tr>
<td class="alt1">Other Bluff...</td>
</tr>
</table>

$footer
</body>
</html>


Lynne 05-12-2009 03:42 PM

This line does not look correct according to where you said your test site was located:
PHP Code:

chdir('/home/netgoon/public_html/domains/mysite.com/forums'); 

(You said "this script is located at mysite.com/file/vbtest/test.php and the .html is in that folder too.")

Also, what you posted and said you saved as "test_mytesttemplate1.html" is not supposed to be a file. It is supposed to be a template named "test_mytesttemplate1"

globofan 05-12-2009 05:36 PM

Ahh! worked perfect thanks :)

I made a html page instead of a template! :p


All times are GMT. The time now is 01:36 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.01082 seconds
  • Memory Usage 1,751KB
  • 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
  • (1)bbcode_html_printable
  • (3)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (9)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
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete