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'; Code:
$userlist = $db->query_read_slave("SELECT userid, username FROM " . TABLE_PREFIX . "user WHERE usergroupid = 2"); As an example if the select return 2 users (Bob & Dave) I want to render a table that looks like this: Code:
<table> |
Is it against the law to embed other websites into your own? because I got a complaint lol
|
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.
|
Quote:
Quote:
|
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. |
Can I have the php pages set outside the forum root. Basically at the host root?
|
Amazing !
Works perfectly - even managed to get it into the Navbar :D |
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 |
Quote:
|
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 Code:
// #################### DEFINE IMPORTANT CONSTANTS ####################### |
Quote:
define('THIS_SCRIPT',+'writeups');+//+change+this+depending+on+your+filename You've got a + after the ; and before the // You can't do that. And I don't know about the + before 'writeups' either. |
Actually, I have no idea where the + came from. I did a straight copy/paste and the + is not in there.
|
Quote:
|
Actually, it's funny that you say that since it is BBEdit that I used. I even tried copying and pasting the php from this thread into a text document in TextEdit and still, the same errors came up.
|
Quote:
(Is this thread the best place to discuss this or would it be better off in it's own thread where more people can come and help?) |
Nevermind... I don't know what I have set different but it's the version of BBEdit that is screwing this up somehow. (Although I'm not sure why I got the same results with TextEdit)
What I was doing last night was on my MacBook. I just tried to create the custom page again on my G4 tower and it worked fine. The G4 has BBEdit version 7 on it while the MacBook as the updated ver. 8. Well, it's either that or my FTP software is doing something funky... Both of the computers have the same version of that but maybe one is sending the file in a different manner... Either way, this is my issue to fix... Sorry for wasting everyone's time. --------------- Added [DATE]1206723528[/DATE] at [TIME]1206723528[/TIME] --------------- Quote:
Code:
require_once('./global.php'); |
How do you adapt this article to add queries and pull data from the database? Is there an additional article out there? I've searched but came up empty.
|
Quote:
|
Yeah, I end up figuring it out with trial and error. My problem was I didn't realize you needed a separate template for looping but I got it squared away.
|
So, I'm thinking of implementing this into my forum but I have a question, do you have to edit any vbulletin files to make this work? Or is it just templates and then creating my own php files?
|
Quote:
|
In the instructions it says I have to open up includes/functions_online.php and edit to enable Who's Online. Isn't that a file?
Sorry if these are stupid questions. |
1 Attachment(s)
I have like 30 lines of php code which I want inside the box instead of Text. How do I make it so that I can have the template read my php code? (Take a look at the template I created), how do I get the php to be executed?
|
Quote:
But what hook do I use? |
I know the global_start hook location works, but I think there is a way around the hook/plugin system.
|
Yeah, I was pretty sure global_start would work but thought there might be a better hook location, don't want the piece of code being executed for every page call....
|
ea, same here. I'm trying to figure out a way to do this without using the hook thing, if I find it, ill let you know, k?
|
Cheers mate, that'd be great.
The powered pages are exactly what I'm after but if I can't include a bunch of PHP code in the actual templated, they are pretty useless to me. |
You dont have to edit any vbulletin php file to make new pages work. Who's online can be done using hooks.
php code is not supposed to be written in templates. Hooks are needed only if you want to insert code into the existing pages. This thread is about creating new pages. The idea is to have a new page. See the countries page on my site for example. For a general explanation of how templates and hooks work, see the vbulletin manual. |
is this what you used http://www.vbulletin.com/docs/html/m..._externalfiles ?
What hook location did you use? Thanks... --------------- Added [DATE]1207200276[/DATE] at [TIME]1207200276[/TIME] --------------- Also, did you create a custom template, like this tutorial? |
Quote:
This thread is about creating a completely new page using the vbulletin framework, with vbulletin's header, navbar and footer. |
I'm trying to import this table (like your countries one)
http://www.lvasp.com/providers_hook.php into http://www.lvasp.com/forum/providers.php --------------- Added [DATE]1207200883[/DATE] at [TIME]1207200883[/TIME] --------------- What tutorial did you follow to create your page then? (cause thats what I'm trying to emulate) Thanks, and sorry for being thick-headed. --------------- Added [DATE]1207201020[/DATE] at [TIME]1207201020[/TIME] --------------- I'm looking at the vbulletin manual and I cant seem to find a tutorial for a page like yours. |
I followed this tutorial to create the countries page. Hooks did not exists when this article was written (March 2004). Therefore, you can be certain that hooks are not needed for the page itself (apart from the fact that I am telling you).
The article tells you to edit original php files for "Who's online". In newer vbulletin versions, we can do this through hooks. Your provider.php is fine. I suppose you are following test.php from the article in this file. Note the part where it says "START MAIN SCRIPT". The code from providers_hook.php will go here. How are you displaying the output from providers_hook.php? The vbulletin method is to calculate all the variables and then call a template. In the article, the template is called test. Everything between $navbar and $footer in this template is your custom stuff. If there are any loops in the page (such as a table with multiple rows, like my countries page), then you have to create an additional template - the bit template. Default vbulletin has many examples of this - postbit, threadbit, reputationbit, forumbit etc etc. Within your php code, you must have a loop and within that you call the 'bit' template and store the result into a variable. In the main template for the page, you just put the variable where you want that table. Here is my countries template for reference (I call it countries_countries, meaning that its the main template of the countries page). Code:
$stylevar[htmldoctype] Code:
<tr> Code:
<?php p.s.: The code above is unaltered, but its not usable because you also need supporting code which stores the countries data in the session table. |
ok (thanks soo much for your help thus far) Here is my PROVIDERS template
Code:
$stylevar[htmldoctype] Code:
if(empty($provider[featured_pic])) { Code:
<?php |
amcd, thanks for that. Makes complete sense.
Reckon you could give us the heads up on how we do the hooks for "Who's online"? Cheers! |
GOT it, thanks
|
I'm trying to create a page within a folder called 'template' in the forum root.
[root]/template/test.php. I tried this method, it worked fine as long as the pages were in the root. What changes do i need to do to make it work when inside 'template' folder in the root.? |
Is there an update for 3.70 I need to add online location
|
Quote:
|
Quote:
Code:
switch ($filename) hook online_location_unknown Code:
switch ($userinfo['activity']) |
All times are GMT. The time now is 03:28 PM. |
Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|