View Single Post
  #3  
Old 28th January 2010, 19:07
joeroberts's Avatar
joeroberts joeroberts is offline
BT.Manager Owner
 
Join Date: Jan 2008
United States
Posts: 2,113
Default
Creating function themeheader()

This is the first peace that you your browser the world see's

This is a Function so You well want to make sure you retrieve all global variables
PHP Code:
global $db$db_prefix$theme$siteurl$user$upload_level$sitename$gfx_check$donations$INVITEONLY,$onlysearch$shout_config$pivate_mode$forumshare$PHP_SELF
the most IMPORTANT are
$db
$db_prefix
$user

Those are Your data base connection Class and Data Base Prefix.
You well not need to make any further data base connection so If you can't figure out $db class But you know simple mysql you can still do this
I wont get in to $db class at this time or mysql .

Now your going to want to set users online this is Not all that Hard
PHP Code:
if ($user->user) {
        
//Update online user list
        
$pagename substr($_SERVER["PHP_SELF"],strrpos($_SERVER["PHP_SELF"],"/")+1);
        
$sqlupdate "UPDATE ".$db_prefix."_online_users SET page = '".addslashes($pagename)."', last_action = NOW() WHERE id = ".$user->id.";";
        
$sqlinsert "INSERT INTO ".$db_prefix."_online_users VALUES ('".$user->id."','".addslashes($pagename)."', NOW(), NOW())";
        
$res $db->sql_query($sqlupdate);
        if (!
$db->sql_affectedrows($res)) $db->sql_query($sqlinsert);

If you use a hard language and need to set Charset I would say set a header
header("Content-Type: text/html; charset=UTF-8");

after this you can start you html coding
first you well want to set your webcoding
HTML Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
This tells Most browser what type of information to expect and is the first line it reads
Now you want to set your
HTML Code:
<html>
followed by
HTML Code:
<head></head>
this is where you set your
style sheets
java scripts
meta tag
if You want a favacon (this is the little image beside your address bar in your browser)
this is also where it is set
here is an example
PHP Code:
echo "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">\n";
echo "<html>\n";
echo "<head>\n";
echo "<meta name='keywords' content='Jungle-Pieates, http://www.jungle-pirates.com/, joeroberts' >\n
<meta name=\"MSSmartTagsPreventParsing\" content=\"TRUE\" >\n
<meta http-equiv=\"Content-Language\" content=\"en-us\" >\n
<meta http-equiv=\"Content-Type\" content=\"text/html; charset=ISO-8859-1\" >\n";
echo "<meta name=\"generator\" content=\"PMBT 2.0.2\" >\n";
echo "<meta http-equiv=\"Pragma\" content=\"no-cache\" >\n";
echo "<meta http-equiv=\"Expires\" content=\"-1\" >\n";
echo "<meta http-equiv=\"Cache-Control\" content=\"no-cache\" >\n";
echo "<script defer type=\"text/javascript\" src=\"".$siteurl."pngfix.js\"></script>";
echo "<title>".$sitename."</title>\n";
if (is_readable("themes/$theme/favicon.ico")) {
        echo "<link REL=\"shortcut icon\" HREF=\"themes/".$theme."/favicon.ico\" TYPE=\"image/x-icon\">\n";
}

?>
<script type="text/javascript">
pmbtsite_url = "<?php echo $siteurl?>";
tag_prompt = "<?php echo _bb_tag_prompt?>";
img_prompt = "<?php echo _bb_img_prompt?>";
font_formatter_prompt = "<?php echo _bb_font_formatter_prompt?>";
link_text_prompt = "<?php echo _bb_link_text_prompt?>";
link_url_prompt = "<?php echo _bb_link_url_prompt?>";
link_email_prompt = "<?php echo _bb_link_email_prompt?>";
list_type_prompt = "<?php echo _bb_list_type_prompt?>";
list_item_prompt = "<?php echo _bb_list_item_prompt?>";
_btshoutnowprivate = "<?php echo _btshoutnowprivate?>";
shoutrefresht = "<?php echo $shout_config['refresh_time']; ?>";
shoutidle = "<?php echo $shout_config['idle_time']; ?>";
</script>
<?php
if (!$onlysearch) {
        echo 
"<link rel=\"alternate\" type=\"application/rss+xml\" title=\"Last Torrents\" href=\"backend.php?op=last\">\n";
        echo 
"<link rel=\"alternate\" type=\"application/rss+xml\" title=\"Best Torrents\" href=\"backend.php?op=best\">\n";
}


if (
is_readable("themes/$theme/style.css")) {
        echo 
"<link rel=\"StyleSheet\" href=\"$siteurl/themes/$theme/style.css\" type=\"text/css\">\n<script type=\"text/javascript\" src=\"$siteurl/global.js\"></script>\n";
}
overlib_init();

echo 
"</head>\n\n";
remember this
PHP Code:
?>
<script type="text/javascript">
pmbtsite_url = "<?php echo $siteurl?>";
tag_prompt = "<?php echo _bb_tag_prompt?>";
img_prompt = "<?php echo _bb_img_prompt?>";
font_formatter_prompt = "<?php echo _bb_font_formatter_prompt?>";
link_text_prompt = "<?php echo _bb_link_text_prompt?>";
link_url_prompt = "<?php echo _bb_link_url_prompt?>";
link_email_prompt = "<?php echo _bb_link_email_prompt?>";
list_type_prompt = "<?php echo _bb_list_type_prompt?>";
list_item_prompt = "<?php echo _bb_list_item_prompt?>";
_btshoutnowprivate = "<?php echo _btshoutnowprivate?>";
shoutrefresht = "<?php echo $shout_config['refresh_time']; ?>";
shoutidle = "<?php echo $shout_config['idle_time']; ?>";
</script>
<?php
Is your java info for shoutbox text editor and auto matic PM checker POPUP
Now We can start the
HTML Code:
<body>
this is the layout of your site
It can be as semple as a <table>/<div>
this is a little tricky because this is where you figure out if you want
1 main layout
a left collom and a Main collom
a left collom center and right collom
you well also set your header here and tab bar if wanted
simple way is a plain table system
for your header and menu do
HTML Code:
<table border="0" width="100%" cellpadding="0" cellspacing="0">
<tr><td><img src="imagelink.png"></td></tr>
<tr><td>your nav bar code</td></tr>
</table>

Now do you want 3 rows?
sample for left collom at 25% of the page
HTML Code:
<table border="0" width="100%" cellpadding="0" cellspacing="0">
<tr><td {{you might want to set width here}}width="25%"> 
your coding for your left collom</td>
sample of Center at 50% of the page
HTML Code:
<td width="50%"> 
this is where you page is added (index.php torrents.php pm.php) you can put codes here witch show above theses pages such as a add link or what not
do Not close this <td> as it well be closed in the themefooter that I well cover later on.

to sum up we just created a semple page layout with a header nav bar your left collom and center page
Attachment 2059
__________________
Do not ask me to help you work on your site that is not phpMyBitTorrent
Do not ask me to make a mod for any other source
Do not Ask me to setup your site.
I will no longer help you setup your site, there is a setup script if you have trouble with it post in the forum here or in BT.Manager™ forum
My Current Demo is here http://demo.btmanager.org/
Reply With Quote