Any code editing software, I highly recommend the following:
Microsoft Expression web
Adobe Dreamweaver
Notepad ++
This little tutorial will show you how to make "dynamic links" on your site. This is a very useful way of making sure you never have to re-write your links again. Lets, for example, you get or change the domain name for your your site. Let also say you did linking to all of your pages like this:
- Code: Select all
<li><a href="http://www.yoursubdomain.com/Games/index.php"><span>Forums</span></a></li>
This has its uses, and its problems. This is good because firstly, you know EXACTLY where this will go, and no matter what, that wont change until you change the domain, or add one. This is bad, because no matter what, that is the ONLY place that link will try to go, even if the domain name for your site changes.
OK, now that the boring introduction is out of the way, time to learn what we are going to do. First, lets learn what we are dealing with here:
1. Variables - These should be pretty self explaining, but for those who don't. This will be how we store the link, in this case, we will be storing a string value for the link.
2. includes/functions.php - This gigantic file is what we will be adding all of our variables to. This file is downloaded in the PHPbb install, and controls a LOT of variable and permission settings for users...but that is for another tutorial.
3. The links themselves - This wont be too hard or complex, but once this, and the previous two things are done, you will never have to change a link again.
OK, so to start, we will have to add our dynamic links to includes/functions.php. Open up the file and look for the following:
- Code: Select all
'U_PRIVATEMSGS' => append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=pm&folder=inbox'),
'U_RETURN_INBOX' => append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=pm&folder=inbox'),
'U_POPUP_PM' => append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=pm&mode=popup'),
This should be around line 4200, just for a quick search.
Now, we need to know how to add the variable, luckily, this is easy:
- Code: Select all
'U_POPUP_PM' => append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=pm&mode=popup'),
This is the name of the variable This sets a link path by referencing the phpbb root path, where php is located
But wait, this only references to any file deeper into the phpbb folder! Luckily, there are a couple of neat little codes that will allow you to navigate anywhere.
- Code: Select all
./folder/folder/folder/index.php - this takes the php root path, and then goes into three folders to find the index for that page.
../../folder/index.php - this code goes up two levels above where phpbb is located, goes into a defined folder, and links to the index.
Now that we understand how to go anywhere we want, we need to use this, so lets start out with the variable. First, on a new line, add the name of your variable in apostrophe's, or single quotations, however you want to call it. That will look like this:
- Code: Select all
'GAMES INDEX' - oddly enough, this doesn't tend to work out for me. This, in my experience, breaks the variable and causes all sorts of problems.
'GAMES_INDEX' - This is the correct way of defining the link. Although it doesn't HAVE to be all caps, it makes the variables easier to find when you need to.
Now for the link, first type in the following code after the variable, on the same line:
- Code: Select all
=> append_sid("{$phpbb_root_path}")
This does two things, the "arrow" sets the variable to take the string from the following code which is currently only calling the phpbb root path
And to define where to go, we add all of our nice directional code to "point" to the page in relation to phpbb. So, lets say we want to go to a folder called Games, in the level above phpbb, and access the index page, we would add this to the code:
- Code: Select all
=> ("{$phpbb_root_path}../Games/index.php"),
The comma is important, don't forget it
So, this says to create a string for the link to your "Games" page, that, no matter what, will always be able to find where it needs to go, as long as php knows where to go. Now to actually make use for this!
Now we need to open up our /styles/yourstylename/template/overall_header.htm.
In my case, I have used ProDrop 6 for my nav bar, but you can use any nav bar, or navigation type just as easily. So, if you recall, our original link is as follows:
- Code: Select all
<li><a href="http://yourdomainname.com/Games/index.php"><span>Games</span></a></li>
we will now replace the link code with the variable in BRACKETS like this:
- Code: Select all
<li><a href="{GAMES_INDEX}"><span>Games</span></a></li>
This simple code change actually does two things. First, it sets a link to your page. Secondly it sets a method that will figure out where that page is in cyberspace no matter what exterior changes happen. Be sure to check that the variable in functions.php matches the variable you are trying to call in overall_header. Something as simple as trying to call {my_link} instead of {MY_LINK} can break your board.
Clear your forum cache, and watch you new links work like a charm.
EDIT: Here are all of the dynamic links for the UCP in phpbb-3.0.7
- Code: Select all
'P_OVERVIEW' => append_sid("{$phpbb_root_path}./ucp.php?i=171.$phpEx"),
'P_PROFILE' => append_sid("{$phpbb_root_path}./ucp.php?i=172.$phpEx"),
'P_BOARD_PREFS' => append_sid("{$phpbb_root_path}./ucp.php?i=173.$phpEx"),
'P_PRIVATE_MSGS' => append_sid("{$phpbb_root_path}./ucp.php?i=174.$phpEx"),
'P_USER_GROUPS' => append_sid("{$phpbb_root_path}./ucp.php?i=175.$phpEx"),
EDIT 2: All of the Moderation Control Panel Links for phpbb-3.0.7
- Code: Select all
'MOD_MAIN' => append_sid("{$phpbb_root_path}./mcp.php?i=139.$phpEx"),
'MOD_MOD_QUEUE' => append_sid("{$phpbb_root_path}./mcp.php?i=140.$phpEx"),
'MOD_REPORTED' => append_sid("{$phpbb_root_path}./mcp.php?i=141.$phpEx"),
'MOD_USER_NOTES' => append_sid("{$phpbb_root_path}./mcp.php?i=142.$phpEx"),
'MOD_WARNINGS' => append_sid("{$phpbb_root_path}./mcp.php?i=143.$phpEx"),
'MOD_LOGS' => append_sid("{$phpbb_root_path}./mcp.php?i=144.$phpEx"),











