Previous Thread
Next Thread
Print Thread
Rating: 5
#216480 05/07/2002 5:12 AM
Joined: Apr 2002
Posts: 141
Member
Member
Offline
Joined: Apr 2002
Posts: 141
I have been expirimenting with PHP for the first time and came up with this:

I create a new page called html2ubbt.php and drop it in the root of my threads dir.

In this page I put this code:
code:
<?
// Require the library
require ("main.inc.php");

// ---------------------
// Send the page to them
$html = new html;
$html -> send_header("testpage",$Cat,0,0,0,0,$user);
$html -> table_header("testpage");

$phpurl = $config['phpurl'];
$html -> open_table();
readfile("{$config['path']}/html/test.html");
$html -> close_table();
// -------------
// Send a footer
$html -> send_footer();



Then I create a folder "html" in the threads root

In there I upload my test.html file which contains just plain html:

<br>
this is just a test<br>
<br>
this is just a test<br>
<br>
this is just a test<br>
<br>

If you go here you can see the result:

www.sat4all.com/board/html2ubbt.php

What I want to do now is give the background of the table a variable which can be found in the stylesheets so the standard background color can be set to the same background color used on the forum summery page.

Then most importantly, I want to replace "testpage" with a varible called "name" which must be defined by the way you call the html2ubbt.php page.

example: yourdomain.com/ubbthreads/html2ubbt.php?name=tespage or something like that.

Then I would like to replace "test.html" with a variable "file" which calles the required file.

Example: yourdomain.com/ubbthreads/html2ubbt.php?name=tespage&file=test.html or something like that.

Can someone help me with this. It could be a nice addition to ubbthreads.

Regards,

Ron.

Last edited by Toxicq; 05/07/2002 5:40 AM.

Those who fail to read ask many questions:-)
Sponsored Links
Joined: Apr 2002
Posts: 141
Member
Member
Offline
Joined: Apr 2002
Posts: 141
I managed to do some changes by myself even though I am a absolute PHP rookie:

http://www.sat4all.com/board/html2ubbt.php?name=test&file=html/test.html

The code now looks like this:
code:

<?
// Require the library
require ("main.inc.php");

// ---------------------
// Send the page to them
$html = new html;
$html -> send_header("$name",$Cat,0,0,0,0,$user);
$html -> table_header("$name");

$phpurl = $config['phpurl'];
$html -> open_table();

if(substr($file,-4)!=".htm" && substr($file,-5)!=".html" ){
echo "Sorry, only HTML is allowed here!";
$html -> close_table();
$html -> send_footer();
}
else {
if( substr($file,0,5)!="./../" && substr($file,0,7)!="http://" ){
include ($file);
$html -> close_table();
$html -> send_footer();
}
else {
echo "Sorry, you can not use this script for a page which does not belong to this website";
$html -> close_table();
}
}
?>



I just don't know how to point the background color of the table (now it's blue) to the grey color in my the stylesheet!

I NEED HELP!

regards,

Ron.


Those who fail to read ask many questions:-)
Joined: Jun 2001
Posts: 3,273
That 70's Guy
That 70's Guy
Offline
Joined: Jun 2001
Posts: 3,273
Looking good

Right after $html -> open_table(); add this:

echo "<TR><TD class="lighttable">";

and just before $html -> close_table(); add this:

echo "</TD></TR>";


Also you may want to specify the value 1 when opening the table if you want to open it at 100% width. open_table(1)

I think that should work though

Joined: Apr 2002
Posts: 141
Member
Member
Offline
Joined: Apr 2002
Posts: 141
Ok I made those changes and it workes as advertised:-)
Can you also tell me what changes I need to make to replace the the location of the html directory with a variable wich can be changed in the script itself?
Is it also possible to display this without the menu bar?

Regards,

Ron.


Those who fail to read ask many questions:-)
Joined: Jun 2001
Posts: 3,273
That 70's Guy
That 70's Guy
Offline
Joined: Jun 2001
Posts: 3,273
Unfortunately all requests to send_header include the menu bar.

Could you specify the location of the directory as you do with the file name?

Example: yourdomain.com/ubbthreads/html2ubbt.php?name=tespage&file=test.html or something like that.

changed to

Example: yourdomain.com/ubbthreads/html2ubbt.php?name=tespage&file=test.html&location=myfolder or something like that.

Sponsored Links
Joined: Apr 2002
Posts: 141
Member
Member
Offline
Joined: Apr 2002
Posts: 141
That is not what I meant:)
I would like to include the location of the HTML directory in the php file itself but use a varible in the top of the file to specify the directory.
I tried to do that but a was getting parse errors all the time.
I short: I would like the html/ out of here:
http://www.sat4all.com/board/html2ubbt.php?name=test&file=html/test.html
and into the php file as a variable to be set in top of the file for configuration.
I really a rookie, I just managed to get this working by looking at a lot of other scripts and just copy and paste it togethet untill it worked, sorry:-))

It would be bether to take the variable "name" from the name of the HTML file.
If you call the html file Testpage.html the name wich appears in the table would be Testpage as well, but I don't know if that is possible.

Regards,

Ron.

Last edited by Toxicq; 05/08/2002 3:58 AM.

Those who fail to read ask many questions:-)
Joined: Mar 2002
Posts: 147
Member
Member
Offline
Joined: Mar 2002
Posts: 147
In reply to:

It would be bether to take the variable "name" from the name of the HTML file




Anyone come up with a way to do this yet?

Goal:
1. Pull the title of the displayed page from a variable called from the data file.
2. Use that variable or another to display that title in the header bar.

Is it possible to pull that variable from the data file if it is declared as a variable?


Link Copied to Clipboard
Donate Today!
Donate via PayPal

Donate to UBBDev today to help aid in Operational, Server and Script Maintenance, and Development costs.

Please also see our parent organization VNC Web Services if you're in the need of a new UBB.threads Install or Upgrade, Site/Server Migrations, or Security and Coding Services.
Recommended Hosts
We have personally worked with and recommend the following Web Hosts:
Stable Host
bluehost
InterServer
Visit us on Facebook
Member Spotlight
Gizmo
Gizmo
Portland, OR, USA
Posts: 5,833
Joined: January 2000
Forum Statistics
Forums63
Topics37,573
Posts293,925
Members13,849
Most Online5,166
Sep 15th, 2019
Today's Statistics
Currently Online
Topics Created
Posts Made
Users Online
Birthdays
Top Posters
AllenAyres 21,079
JoshPet 10,369
LK 7,394
Lord Dexter 6,708
Gizmo 5,833
Greg Hard 4,625
Top Posters(30 Days)
Top Likes Received
isaac 82
Gizmo 20
Brett 7
WebGuy 2
Morgan 2
Top Likes Received (30 Days)
None yet
The UBB.Developers Network (UBB.Dev/Threads.Dev) is ©2000-2024 VNC Web Services

 
Powered by UBB.threads™ PHP Forum Software 8.0.0
(Preview build 20221218)