vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3 Articles (https://vborg.vbsupport.ru/forumdisplay.php?f=187)
-   -   How to create your own vBulletin-powered page! (uses vB templates) (https://vborg.vbsupport.ru/showthread.php?t=62164)

MrEyes 03-07-2008 11:35 AM

Here is a question:

Using the instructions given it took about 30 seconds to get an additional template driven page into my forum, which was nice :)

Now I am fiddling around trying to get data from the database into a html table in the template and have hit a wall. Just for the sake of testing I am attempting to select all users from a specific user group and display their username in a table.

So to do this after this line:

Code:

$navbits[$parent] = 'Test Page';
I have added

Code:

$userlist = $db->query_read_slave("SELECT userid, username FROM " . TABLE_PREFIX . "user WHERE usergroupid = 2");

while ($user = $db->fetch_array($userlist))
{
        //print_r($user);
}

$db->free_result($userlist);

This gets the data I want and if I uncomment the print_r function it prints the data. However I can't work out how to get the data into a table within the template.

As an example if the select return 2 users (Bob & Dave) I want to render a table that looks like this:

Code:

<table>
        <tr>
                <td>Username</td<
        </tr>
        <tr>
                <td>Bob</td>
        </tr>
        <tr>
                <td>Dave</td>
        </tr>
</table>

Could somebody push me in the right direction?

DivineMessenger 03-07-2008 11:55 AM

Is it against the law to embed other websites into your own? because I got a complaint lol

Mum 03-07-2008 04:46 PM

It's not another website, it's one i own. I own www.mummybrain.com but want to open www.mummybrain.com/tickers/ inside looking like it's vB. Is that the best way to do this? All i really need is just the header, but thought this might be able to do it. But i can't copy and paste all the code, cos then it doesn't work.

Digital Jedi 03-08-2008 04:18 AM

Quote:

Originally Posted by Mum (Post 1459484)
It's not another website, it's one i own. I own www.mummybrain.com but want to open www.mummybrain.com/tickers/ inside looking like it's vB. Is that the best way to do this? All i really need is just the header, but thought this might be able to do it. But i can't copy and paste all the code, cos then it doesn't work.

You could do that with an iframe, but it seems to me the simplest thing to do would be just to put the HTML of that page into your template, and make that page tickers.php.

Quote:

Originally Posted by DivineMessenger (Post 1459239)
Is it against the law to embed other websites into your own? because I got a complaint lol

It's not against the law. It's more like free advertisment. They still get the hit to their website, and your not hotlinking anything.

gdll 03-08-2008 05:35 AM

Does anyone know how to insert $forumbits in test.php so that it will display some threads ??? (or any reason this wouldnt work ?)

edit: seems to be working now.

soundbarrierpro 03-08-2008 06:47 PM

Can I have the php pages set outside the forum root. Basically at the host root?

jambo_1969 03-09-2008 12:18 PM

Amazing !

Works perfectly - even managed to get it into the Navbar

:D

robertpro2a 03-20-2008 03:15 AM

Thank you to the original poster for providing this source code.

I have successfully installed the test page. Is there a way to only allow the test page to load if the user is logged in? I allow guests to browse my forums; but I do not want them to be able to browse my test page.

Regards,
Robert

amcd 03-20-2008 08:12 AM

Quote:

Originally Posted by robertpro2a (Post 1469319)
Thank you to the original poster for providing this source code.

I have successfully installed the test page. Is there a way to only allow the test page to load if the user is logged in? I allow guests to browse my forums; but I do not want them to be able to browse my test page.

Regards,
Robert

Read through the thread. It has been discussed.

dismas 03-27-2008 11:27 PM

I keep running into parse errors for some reason. I don't know why though since I've used this writeup before to add pages to another of my forums. On this other forum, I'm having issues. The forums are with different hosting companies. Would that make a difference?

The first error that I got said that there was a parse error due to an unexpected ~ on line 4. I took the tilde out and then it told me this:

Code:

Parse error: parse error, unexpected T_CONSTANT_ENCAPSED_STRING in /home/content/v/e/r/vermontoutdoor/html/forum/writeups.php on line 8
Line 8 is the last line here:

Code:

// #################### DEFINE IMPORTANT CONSTANTS #######################
define('NO_REGISTER_GLOBALS', 1);
define('THIS_SCRIPT', 'writeups'); // change this depending on your filename



All times are GMT. The time now is 04:46 AM.

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.02492 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
  • (5)bbcode_code_printable
  • (3)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (4)pagenav_pagelinkrel
  • (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