UBB.Dev
Posted By: JoshPet [7.x] Generic Page Outside of forum directory - 01/15/2007 6:58 AM
In UBB.Threads 7, a /scripts/sample.inc.php file is provided to help you create your own custom pages as needed.

For example, you can duplicate the /scripts/sample.inc.php file to /scripts/mypage.inc.php Then create a /templates/default/mypage.tpl template file with the HTML for your page.

Then visiting ubbthreads.php?ubb=mypage will load that page.

But if you need to have this page appear outside of your forum directory, you can create a PHP script elsewhere on your site to load this page from within UBBThreads. Here's how.

For example create a "mypage.php" script elsewhere on your site which looks like this:

Code

<?php
// Generic UBBThreads wrapper
// This allows you to access a UBBThreads 7 script from outside
// The UBBThreads directory.
//
// Instructions: create your sample.inc.php script and sample.tmp file
// (follow the example Groupee provided) you can rename as needed if you
// need more pages. Then create this script wherever you wish on your server.
// Edit the variable and full path as needed.

// Set this variable to whatever scriptname.inc.php file you have included in /scripts
$_REQUEST['ubb'] = "mypage";

// Set the full path to your ubbthreads.php file
include("/home/threads/public_html/ubb7/ubbthreads.php");
?>


You will need to edit the variable to match the name of the thread script and template you created above, and you'll also need to edit the full path to your UBB.Threads directory.

Thanks to Allen for requesting this.
Thanks - will give it a try smile
I'm going to sticky this for the time being, I've gotten several requests on just this wink.

Also, since it covers UBB.T7.1 as well, I updated the subject to read 7.x vs 7.0.x.
Thank you Josh thumbsup

If you are wanting to make your portal page the index page for your site, just change this line:

$_REQUEST['ubb'] = "mypage";

to this:

$_REQUEST['ubb'] = "portal";


Save the page as index.php and upload it to the root of your site:

ex: https://ubbdev.com

thumbsup
I've done as suggested...but let me make sure I've done it right.

I have altered nothing but

$_REQUEST['ubb'] = "mypage"; to $_REQUEST['ubb'] = "portal";

and

("/home/threads/public_html/ubb7/ubbthreads.php"); to ("/my/path/to/thefiles/ubbthreads.php");

And my portal shows up via www.galacticempire.net, which is great but is that it, have I done it right ?
Yes, very simple to do smile
To make it a bit simpler for those wanting to use it for their portal page, I've attached a file below. Change the path toward the bottom to match your path, rename the extension to index.php and upload where you need it. smile

Attached File
2340-index.txt  (162 downloads)
Thank You

smile
Very nice Allen, I can think of several good uses hehe
I am seeing

$tbclose UBBTPRINT; /* UBBTREMARK */ ?>

At the top of the page, just beneath the header.

http://www.fansfocus.com/forums/ubbthreads.php?ubb=ryman or http://www.fansfocus.com/generic/ryman

Also both the columns are being displayed on the left.

This is fairly straight foward, so not sure where I have gone wrong - unless I should have more info in the template - I assume this just contains the raw html from the main body of the page and nothing else.
sorry - I'm having a bad week frown

I didn't notice some odd ubbcode at the foot of my template - all is fine now smile
I struggled with this and then noticed that the code in the box begins with ? and it should be

Not too obvious for a novice like me. wink
Thank you for the headsup, post edited to include above mentioned fix smile
Doah, a bit isdexlic I guess. tipsy
This may be a new request, but can we figure out a way to disable the portal boxes when the portal is enabled on these generic pages?

-peter
Hey Josh, if I wanted to use a variable in one of these pages, how would I do it? For a super-simplified example, what if I wanted the page to say:

Hello $display_name!

And it would say "Hello Calpy!"
Well, your script file would need to referance the user data:
Code
	$smarty_data = array(
'user' => & $user,
);

Then, hypothetically, you could call it as:
Code
$user.USER_DISPLAY_NAME
Yay, thank you! For any noobs (like me) interested in the same thing, don't forget to put curly brackets around the call on your .tpl page, like:
Code
{$user.USER_DISPLAY_NAME}
I guess I should have said that :x
Posted By: Calpy Re: [7.x] Generic Page Outside of forum directory - 04/24/2007 12:29 AM
Was there any response to how to disable portal boxes/side bars on these pages? =)
Posted By: Ian_W Re: [7.x] Generic Page Outside of forum directory - 06/12/2007 11:38 PM
Originally Posted by Calpy
Was there any response to how to disable portal boxes/side bars on these pages? =)


Haven't found a way yet frown



Quote
In UBB.Threads 7, a /scripts/sample.inc.php file is provided to help you create your own custom pages as needed.

For example, you can duplicate the /scripts/sample.inc.php file to /scripts/mypage.inc.php Then create a /templates/default/mypage.tpl template file with the HTML for your page.

Then visiting ubbthreads.php?ubb=mypage will load that page.

This works great for my custom pages.

Code
// Set this variable to whatever scriptname.inc.php file you have included in /scripts
$_REQUEST['ubb'] = "mypage";

// Set the full path to your ubbthreads.php file
include("/home/threads/public_html/ubb7/ubbthreads.php");
?>

When I follow the instructions for that, it works BUT when visiting the generated page it shows me as logged out. What do I need to add?
should work fine, check to make sure you have cookies set to be used site-wide

/
Hmmmm

It works now with no changes but the other day...

Hmmmm

Thanks anyway Allen

smile
It was much easier on the old 6.4 boards to do everything in 1 file. Is there anyway to do that now?

How can I check to see if a user belongs to a specific group to display certain data to?

Also, I want to open a custom database table to display data from if the user belongs to a certain group.

For me this was easy with the old wrapper. Where do I put my php code for this?

Here is just a little sample of the code.

Code

if ( (ereg ("-8-", $groups)) || (ereg ("-15-",$groups)) ) {
echo "<br>(Member access)";
} else {
echo "<br>Public access";
}
echo "</center><p>";

// Get all the info
$wowConnect = mysql_connect($config['dbserver'], $config['dbuser'], $config['dbpass']);
if ($wowConnect){
mysql_select_db($config['dbname'], $wowConnect);
}

thanks in advance for any help.
I followed AllenAyres txt file
got the paths from my control panel and works a treat.

Its easier than you think wink
could someone explain to me in layman's terms what this all allows me to do? I think this is an answer i've been looking for, but i'm a little confused about it, and would like to clear it up before I start to really dig into it and get moving on it.

Thanks in advance!
essentially it allows you to have one or more pages with your own content (within the template page) on your site, whilst still retaining the header, footer, sidebars, breadcrumbs etc.

We have around 100 other pages on our site.

It can be used for anything.

Of course it is simple to add further scripting into those pages.
and the pages are built into UBB? Or do I need to setup an external HTML site and link it to my UBB somehow?

Also, is this something i do through the admin panel? Or will the owner of the forums need to do it?

Thanks for responding wink
Posted By: Ian_W Re: [7.x] Generic Page Outside of forum directory - 08/04/2007 10:15 PM
The page that the user sees is external to UBB (and can be anywhere on your domain) - however you will need to upload the script page to the scripts folder and the template page to the templates/default folder.

For the various scripts and template pages I preceded these files with ff for FansFocus.Com so that I can easily find them within the folders. They do not need to be the same name as the page the user sees on your site.

Just follow the examples shown above and you should be fine smile
Would it be possible to have this generic page configured such that the left and/or right columns could be on or off? Or does the user's preference setting prevent this?
It would follow what you have set in the control panel.
Originally Posted by JoshPet
In UBB.Threads 7, a /scripts/sample.inc.php file is provided to help you create your own custom pages as needed.

For example, you can duplicate the /scripts/sample.inc.php file to /scripts/mypage.inc.php Then create a /templates/default/mypage.tpl template file with the HTML for your page.

Then visiting ubbthreads.php?ubb=mypage will load that page.

I have tried unsuccessfully to make a generic page (inside of the forum directory). While there is a sample.inc.php script, there is no sample.tpl file I can use, and as a complete newbie with no real desire to learn php, I have no idea where to start.

Is this documented somewhere? I guess what I need is a step by step instruction on how to make generic pages (for dummies) - which I will use for static link collections, about-texts etc.

I am not trying to make anything complicated, just a static custom page with some plain html content.

While fiddling around with this, I got the following error when trying to view my page:

page_about_gpc not found!

Any help/pointers or links to instructions would be highly appreciated.
Posted By: Gizmo Re: [7.x] Generic Page Outside of forum directory - 08/31/2008 12:43 AM
well, all the tpl file is would be your html code... you can use smarty code in it, which examples would be every .tpl file in the directory.
© UBB.Developers