FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


Help with Website





JoeCool
Hey, I need some help with my site.
I am trying to use the same header that I have in my forums for all the other pages of my site. I have little experience with php, and little experience with template design. I have tried several things, but I just cant seem to get it to work. Can anybody explain a way to do this. I appreciate any help! To better understand what I am talking about see my website http://www.guitarfreedom.frihost.net/
BlackSkad
It is not that very easy. All the stuff that are in the code below, are needed. You might want to search only the functions you need from the includes, but I wouldn't.Let's explain wath I'm doing:
  • define a constant IN_PHPBB, else you get a message like 'Hacking Attempt'
  • define the forum_root_path. As you're one level higher, it looks like: 'forum_folder/' (my forum_folder = forum)
  • include files with functions, configs, etc. it's standard in phpBB. Without is, you get some problems Smile
  • getting the userdata. The user will get the same header as the header of the theme he has chosen (except if he's not logged in, then standard-style)
  • setting everything right: initialising the template, set some other stuff that are needed.
  • Set the title of your page. You can change $lang['Index'] in whatever you like.
  • Include the page header
  • include the page_tail

Code:

<?php
define('IN_PHPBB', true);
$phpbb_root_path = 'forum/';
include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'common.'.$phpEx);

$userdata = session_pagestart($user_ip, PAGE_INDEX);
init_userprefs($userdata);

$page_title = $lang['Index'];
include ($phpbb_root_path . 'includes/page_header.'.$phpEx);
?>
Content goes here
<?php
include ($phpbb_root_path . 'includes/page_tail.'.$phpEx)
?>

This works almost fine, except that the links aren't correct and the pictures are not shown.
I will try to solve it.
JoeCool
WOW- That makes since! But I am still confused... I don't understand which parts of the code I need to change to make things work. I can prob make it work if I play with it for a while! I'll try...
Do I have to include the page tail or can I leave that part out...
BlackSkad
Sorry Smile I changed the post above yours Smile
If you want to links to work properly, you need to search in the page_header.php file and search all the places where links are configured. A link needs to look like this:
Code:
$phpbb_root_path."profile.".$phpEx."?blabla"

The only thing you wil need to do is add the '$phpbb_root_path.' (Mark the point!) which is a lot of work!

The images are also rather a lot of work:
near the end of page_header.php, you see this code:
Code:
$template->assign_vars(array(
   'SITENAME' => $board_config['sitename'],
   'SITE_DESCRIPTION' => $board_config['site_desc'],
   'PAGE_TITLE' => $page_title,
   'LAST_VISIT_DATE' => sprintf($lang['You_last_visit'], $s_last_visit),


Enter right above 'SITENAME' a new line with the code
Code:
'PHPBB_ROOT' => $phpbb_root_path,

Then go to your template page_header.tpl and search all the links/image-paths. Before every path-name just add {PHPBB_ROOT}
When you now run the script, the image-problem should be solved
Related topics
Need help about website promotions
A good website idea.........Please help PPL
I can help design your website.
CAN SOMEONE HELP? I DON'T UN DERSTAND HOW TO UPLOAD WEBSITE!
This is my first website. Help
Want to get help with building your website, intro.....
RuneHQ.com
Wanna help IFA with their website?
Some Help Needed on Image uploading in my website
CPG NUKE HELP WEBSITE
www.screwedcomputer.com Free Computer Help Forum
What do you use your hosting space for?
Java script error
Let us know about your project and gain contributions
Reply to topic    Frihost Forum Index -> Scripting -> Php and MySQL

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.