Php Help
Php Help
Hey there, I was wondering if there is a way to link to a forum hosted by a different site. Without just making a post in a board with a url slapped in it.
These are the 2 boards I'm trying to link
http://www.w-w-c.net/boards/
http://www.dpkrew.com/forum/
These are the 2 boards I'm trying to link
http://www.w-w-c.net/boards/
http://www.dpkrew.com/forum/
- Lucifer
- Project Developer
- Posts: 8683
- Joined: Sun Aug 15, 2004 3:32 pm
- Location: Republic of Texas
- Contact:
How are you trying to link them? What exactly do you mean "link"? Obviously you don't mean html link, so some further description is needed.
Besides all that, if your php is compiled with this support in it (most are), you can reference a url in most file functions, like require, require_once, include, include_once, and so forth. So, for example, you could do:
require_once('http://www.google.com/');
and Google's home page would appear embedded in your page. Of course, you'll have an extremely non-standard html page, but it'll be there. When I've done this, I've done it with a newsfeed from sourceforge, and I stripped out the <html> and <body> tags and the <head> part, and the page validated last time I checked it.
Besides all that, if your php is compiled with this support in it (most are), you can reference a url in most file functions, like require, require_once, include, include_once, and so forth. So, for example, you could do:
require_once('http://www.google.com/');
and Google's home page would appear embedded in your page. Of course, you'll have an extremely non-standard html page, but it'll be there. When I've done this, I've done it with a newsfeed from sourceforge, and I stripped out the <html> and <body> tags and the <head> part, and the page validated last time I checked it.
- Tank Program
- Forum & Project Admin, PhD
- Posts: 6712
- Joined: Thu Dec 18, 2003 7:03 pm
- Lackadaisical
- Shutout Match Winner
- Posts: 823
- Joined: Sun Dec 21, 2003 4:58 pm
- Location: Amsterdam, Netherlands
- Contact:
you can try to change the template file (/subSilver/index_body.tpl) and add a 'hardcoded' forumrow in which you put a link to that other forum..
um.. let me describe it with some code:
this part of the code can be found in index_body.tpl, and it represents the list with all the forums.
Now what you need to do is copy the part between start and end forumrow and paste it after end catrow (before the </table>). This way there'll be an extra row in the list where you can put anything you want. And what you want to do is change:
{catrow.forumrow.U_VIEWFORUM} to the url of that other forum
{catrow.forumrow.FORUM_NAME} to the name of that other forum
{catrow.forumrow.FORUM_DESC} to the description of that other forum
I guess it is possible to get the amount of posts/last post and other data from the other forum, but that would be kinda.. hard, or at least i cant help you with that.
[/code]
um.. let me describe it with some code:
this part of the code can be found in index_body.tpl, and it represents the list with all the forums.
Code: Select all
<table width="100%" cellpadding="2" cellspacing="1" border="0" class="forumline">
<tr>
<th colspan="2" class="thCornerL" height="25" nowrap="nowrap"> {L_FORUM} </th>
<th width="50" class="thTop" nowrap="nowrap"> {L_TOPICS} </th>
<th width="50" class="thTop" nowrap="nowrap"> {L_POSTS} </th>
<th class="thCornerR" nowrap="nowrap"> {L_LASTPOST} </th>
</tr>
<!-- BEGIN catrow -->
<tr>
<td class="catLeft" colspan="2" height="28"><span class="cattitle"><a href="{catrow.U_VIEWCAT}" class="cattitle">{catrow.CAT_DESC}</a></span></td>
<td class="rowpic" colspan="3" align="right"> </td>
</tr>
<!-- BEGIN forumrow -->
<tr>
<td class="row1" align="center" valign="middle" height="50"><img src="{catrow.forumrow.FORUM_FOLDER_IMG}" width="46" height="25" alt="{catrow.forumrow.L_FORUM_FOLDER_ALT}" title="{catrow.forumrow.L_FORUM_FOLDER_ALT}" /></td>
<td class="row1" width="100%" height="50"><span class="forumlink"> <a href="{catrow.forumrow.U_VIEWFORUM}" class="forumlink">{catrow.forumrow.FORUM_NAME}</a><br />
</span> <span class="genmed">{catrow.forumrow.FORUM_DESC}<br />
</span><span class="gensmall">{catrow.forumrow.L_MODERATOR} {catrow.forumrow.MODERATORS}</span></td>
<td class="row2" align="center" valign="middle" height="50"><span class="gensmall">{catrow.forumrow.TOPICS}</span></td>
<td class="row2" align="center" valign="middle" height="50"><span class="gensmall">{catrow.forumrow.POSTS}</span></td>
<td class="row2" align="center" valign="middle" height="50" nowrap="nowrap"> <span class="gensmall">{catrow.forumrow.LAST_POST}</span></td>
</tr>
<!-- END forumrow -->
<!-- END catrow -->
</table>
{catrow.forumrow.U_VIEWFORUM} to the url of that other forum
{catrow.forumrow.FORUM_NAME} to the name of that other forum
{catrow.forumrow.FORUM_DESC} to the description of that other forum
I guess it is possible to get the amount of posts/last post and other data from the other forum, but that would be kinda.. hard, or at least i cant help you with that.
[/code]
Official Officiant of the Official Armagetron Clan Registration Office
Back (in the sig) by popular demand: Lack draws
Back (in the sig) by popular demand: Lack draws
- Tank Program
- Forum & Project Admin, PhD
- Posts: 6712
- Joined: Thu Dec 18, 2003 7:03 pm
Well, after hours of trying to figure out how to do this, I then realised I don't know what the hell I am doing, would you guys mind if i posted the code and you guys can help me out there?
Where it sais DPK Forums, is where I need it go to http://www.dpkrew.com/forum
Best of Luck and thanks alot for putting forth the effort in helping my guys.
Click on the link below to go to the link that goes to the text file provided with the code, I had to link it off of my site because I could not upload it here.
http://www.w-w-c.net/boards/phpbbhelp
Where it sais DPK Forums, is where I need it go to http://www.dpkrew.com/forum
Best of Luck and thanks alot for putting forth the effort in helping my guys.
Click on the link below to go to the link that goes to the text file provided with the code, I had to link it off of my site because I could not upload it here.
http://www.w-w-c.net/boards/phpbbhelp
- Lackadaisical
- Shutout Match Winner
- Posts: 823
- Joined: Sun Dec 21, 2003 4:58 pm
- Location: Amsterdam, Netherlands
- Contact:
http://www.w-w-c.net/boards/templates/s ... x_body.tpl
original version:
and after i added an extra row:
to see what i changed, go to my first post..
just replace everything in templates/subSilver/index_body.tpl with the last piece of code.
original version:
Code: Select all
<table width="100%" cellspacing="0" cellpadding="2" border="0" align="center">
<tr>
<td align="left" valign="bottom"><span class="gensmall">
<!-- BEGIN switch_user_logged_in -->
{LAST_VISIT_DATE}<br />
<!-- END switch_user_logged_in -->
{CURRENT_TIME}<br /></span><span class="nav"><a href="{U_INDEX}" class="nav">{L_INDEX}</a></span></td>
<td align="right" valign="bottom" class="gensmall">
<!-- BEGIN switch_user_logged_in -->
<a href="{U_SEARCH_NEW}" class="gensmall">{L_SEARCH_NEW}</a><br /><a href="{U_SEARCH_SELF}" class="gensmall">{L_SEARCH_SELF}</a><br />
<!-- END switch_user_logged_in -->
<a href="{U_SEARCH_UNANSWERED}" class="gensmall">{L_SEARCH_UNANSWERED}</a></td>
</tr>
</table>
<table width="100%" cellpadding="2" cellspacing="1" border="0" class="forumline">
<tr>
<th colspan="2" class="thCornerL" height="25" nowrap="nowrap"> {L_FORUM} </th>
<th width="50" class="thTop" nowrap="nowrap"> {L_TOPICS} </th>
<th width="50" class="thTop" nowrap="nowrap"> {L_POSTS} </th>
<th class="thCornerR" nowrap="nowrap"> {L_LASTPOST} </th>
</tr>
<!-- BEGIN catrow -->
<tr>
<td class="catLeft" colspan="2" height="28"><span class="cattitle"><a href="{catrow.U_VIEWCAT}" class="cattitle">{catrow.CAT_DESC}</a></span></td>
<td class="rowpic" colspan="3" align="right"> </td>
</tr>
<!-- BEGIN forumrow -->
<tr>
<td class="row1" align="center" valign="middle" height="50"><img src="{catrow.forumrow.FORUM_FOLDER_IMG}" width="46" height="25" alt="{catrow.forumrow.L_FORUM_FOLDER_ALT}" title="{catrow.forumrow.L_FORUM_FOLDER_ALT}" /></td>
<td class="row1" width="100%" height="50"><span class="forumlink"> <a href="{catrow.forumrow.U_VIEWFORUM}" class="forumlink">{catrow.forumrow.FORUM_NAME}</a><br />
</span> <span class="genmed">{catrow.forumrow.FORUM_DESC}<br />
</span><span class="gensmall">{catrow.forumrow.L_MODERATOR} {catrow.forumrow.MODERATORS}</span></td>
<td class="row2" align="center" valign="middle" height="50"><span class="gensmall">{catrow.forumrow.TOPICS}</span></td>
<td class="row2" align="center" valign="middle" height="50"><span class="gensmall">{catrow.forumrow.POSTS}</span></td>
<td class="row2" align="center" valign="middle" height="50" nowrap="nowrap"> <span class="gensmall">{catrow.forumrow.LAST_POST}</span></td>
</tr>
<!-- END forumrow -->
<!-- END catrow -->
</table>
<table width="100%" cellspacing="0" border="0" align="center" cellpadding="2">
<tr>
<td align="left"><span class="gensmall"><a href="{U_MARK_READ}" class="gensmall">{L_MARK_FORUMS_READ}</a></span></td>
<td align="right"><span class="gensmall">{S_TIMEZONE}</span></td>
</tr>
</table>
<table width="100%" cellpadding="3" cellspacing="1" border="0" class="forumline">
<tr>
<td class="catHead" colspan="2" height="28"><span class="cattitle"><a href="{U_VIEWONLINE}" class="cattitle">{L_WHO_IS_ONLINE}</a></span></td>
</tr>
<tr>
<td class="row1" align="center" valign="middle" rowspan="2"><img src="templates/subSilver/images/whosonline.gif" alt="{L_WHO_IS_ONLINE}" /></td>
<td class="row1" align="left" width="100%"><span class="gensmall">{TOTAL_POSTS}<br />{TOTAL_USERS}<br />{NEWEST_USER}</span>
</td>
</tr>
<tr>
<td class="row1" align="left"><span class="gensmall">{TOTAL_USERS_ONLINE} [ {L_WHOSONLINE_ADMIN} ] [ {L_WHOSONLINE_MOD} ]<br />{RECORD_USERS}<br />{LOGGED_IN_USER_LIST}</span></td>
</tr>
</table>
<table width="100%" cellpadding="1" cellspacing="1" border="0">
<tr>
<td align="left" valign="top"><span class="gensmall">{L_ONLINE_EXPLAIN}</span></td>
</tr>
</table>
<!-- BEGIN switch_user_logged_out -->
<form method="post" action="{S_LOGIN_ACTION}">
<table width="100%" cellpadding="3" cellspacing="1" border="0" class="forumline">
<tr>
<td class="catHead" height="28"><a name="login"></a><span class="cattitle">{L_LOGIN_LOGOUT}</span></td>
</tr>
<tr>
<td class="row1" align="center" valign="middle" height="28"><span class="gensmall">{L_USERNAME}:
<input class="post" type="text" name="username" size="10" />
{L_PASSWORD}:
<input class="post" type="password" name="password" size="10" maxlength="32" />
{L_AUTO_LOGIN}
<input class="text" type="checkbox" name="autologin" />
<input type="submit" class="mainoption" name="login" value="{L_LOGIN}" />
</span> </td>
</tr>
</table>
</form>
<!-- END switch_user_logged_out -->
<br clear="all" />
<table cellspacing="3" border="0" align="center" cellpadding="0">
<tr>
<td width="20" align="center"><img src="templates/subSilver/images/folder_new.gif" alt="{L_NEW_POSTS}"/></td>
<td><span class="gensmall">{L_NEW_POSTS}</span></td>
<td> </td>
<td width="20" align="center"><img src="templates/subSilver/images/folder.gif" alt="{L_NO_NEW_POSTS}" /></td>
<td><span class="gensmall">{L_NO_NEW_POSTS}</span></td>
<td> </td>
<td width="20" align="center"><img src="templates/subSilver/images/folder_lock.gif" alt="{L_FORUM_LOCKED}" /></td>
<td><span class="gensmall">{L_FORUM_LOCKED}</span></td>
</tr>
</table>
Code: Select all
<table width="100%" cellspacing="0" cellpadding="2" border="0" align="center">
<tr>
<td align="left" valign="bottom"><span class="gensmall">
<!-- BEGIN switch_user_logged_in -->
{LAST_VISIT_DATE}<br />
<!-- END switch_user_logged_in -->
{CURRENT_TIME}<br /></span><span class="nav"><a href="{U_INDEX}" class="nav">{L_INDEX}</a></span></td>
<td align="right" valign="bottom" class="gensmall">
<!-- BEGIN switch_user_logged_in -->
<a href="{U_SEARCH_NEW}" class="gensmall">{L_SEARCH_NEW}</a><br /><a href="{U_SEARCH_SELF}" class="gensmall">{L_SEARCH_SELF}</a><br />
<!-- END switch_user_logged_in -->
<a href="{U_SEARCH_UNANSWERED}" class="gensmall">{L_SEARCH_UNANSWERED}</a></td>
</tr>
</table>
<table width="100%" cellpadding="2" cellspacing="1" border="0" class="forumline">
<tr>
<th colspan="2" class="thCornerL" height="25" nowrap="nowrap"> {L_FORUM} </th>
<th width="50" class="thTop" nowrap="nowrap"> {L_TOPICS} </th>
<th width="50" class="thTop" nowrap="nowrap"> {L_POSTS} </th>
<th class="thCornerR" nowrap="nowrap"> {L_LASTPOST} </th>
</tr>
<!-- BEGIN catrow -->
<tr>
<td class="catLeft" colspan="2" height="28"><span class="cattitle"><a href="{catrow.U_VIEWCAT}" class="cattitle">{catrow.CAT_DESC}</a></span></td>
<td class="rowpic" colspan="3" align="right"> </td>
</tr>
<!-- BEGIN forumrow -->
<tr>
<td class="row1" align="center" valign="middle" height="50"><img src="{catrow.forumrow.FORUM_FOLDER_IMG}" width="46" height="25" alt="{catrow.forumrow.L_FORUM_FOLDER_ALT}" title="{catrow.forumrow.L_FORUM_FOLDER_ALT}" /></td>
<td class="row1" width="100%" height="50"><span class="forumlink"> <a href="{catrow.forumrow.U_VIEWFORUM}" class="forumlink">{catrow.forumrow.FORUM_NAME}</a><br />
</span> <span class="genmed">{catrow.forumrow.FORUM_DESC}<br />
</span><span class="gensmall">{catrow.forumrow.L_MODERATOR} {catrow.forumrow.MODERATORS}</span></td>
<td class="row2" align="center" valign="middle" height="50"><span class="gensmall">{catrow.forumrow.TOPICS}</span></td>
<td class="row2" align="center" valign="middle" height="50"><span class="gensmall">{catrow.forumrow.POSTS}</span></td>
<td class="row2" align="center" valign="middle" height="50" nowrap="nowrap"> <span class="gensmall">{catrow.forumrow.LAST_POST}</span></td>
</tr>
<!-- END forumrow -->
<!-- END catrow -->
<tr>
<td class="row1" align="center" valign="middle" height="50"><img src="http://www.w-w-c.net/boards/templates/subSilver/images/folder_big.gif" width="46" height="25" alt="{catrow.forumrow.L_FORUM_FOLDER_ALT}" title="{catrow.forumrow.L_FORUM_FOLDER_ALT}" /></td>
<td class="row1" width="100%" height="50"><span class="forumlink"> <a href="http://www.dpkrew.com/forum" class="forumlink">DPK Forums</a><br />
</span> <span class="genmed">The DPK Forums!<br />
</span><span class="gensmall">{catrow.forumrow.L_MODERATOR} {catrow.forumrow.MODERATORS}</span></td>
<td class="row2" align="center" valign="middle" height="50"><span class="gensmall">{catrow.forumrow.TOPICS}</span></td>
<td class="row2" align="center" valign="middle" height="50"><span class="gensmall">{catrow.forumrow.POSTS}</span></td>
<td class="row2" align="center" valign="middle" height="50" nowrap="nowrap"> <span class="gensmall">{catrow.forumrow.LAST_POST}</span></td>
</tr>
</table>
<table width="100%" cellspacing="0" border="0" align="center" cellpadding="2">
<tr>
<td align="left"><span class="gensmall"><a href="{U_MARK_READ}" class="gensmall">{L_MARK_FORUMS_READ}</a></span></td>
<td align="right"><span class="gensmall">{S_TIMEZONE}</span></td>
</tr>
</table>
<table width="100%" cellpadding="3" cellspacing="1" border="0" class="forumline">
<tr>
<td class="catHead" colspan="2" height="28"><span class="cattitle"><a href="{U_VIEWONLINE}" class="cattitle">{L_WHO_IS_ONLINE}</a></span></td>
</tr>
<tr>
<td class="row1" align="center" valign="middle" rowspan="2"><img src="templates/subSilver/images/whosonline.gif" alt="{L_WHO_IS_ONLINE}" /></td>
<td class="row1" align="left" width="100%"><span class="gensmall">{TOTAL_POSTS}<br />{TOTAL_USERS}<br />{NEWEST_USER}</span>
</td>
</tr>
<tr>
<td class="row1" align="left"><span class="gensmall">{TOTAL_USERS_ONLINE} [ {L_WHOSONLINE_ADMIN} ] [ {L_WHOSONLINE_MOD} ]<br />{RECORD_USERS}<br />{LOGGED_IN_USER_LIST}</span></td>
</tr>
</table>
<table width="100%" cellpadding="1" cellspacing="1" border="0">
<tr>
<td align="left" valign="top"><span class="gensmall">{L_ONLINE_EXPLAIN}</span></td>
</tr>
</table>
<!-- BEGIN switch_user_logged_out -->
<form method="post" action="{S_LOGIN_ACTION}">
<table width="100%" cellpadding="3" cellspacing="1" border="0" class="forumline">
<tr>
<td class="catHead" height="28"><a name="login"></a><span class="cattitle">{L_LOGIN_LOGOUT}</span></td>
</tr>
<tr>
<td class="row1" align="center" valign="middle" height="28"><span class="gensmall">{L_USERNAME}:
<input class="post" type="text" name="username" size="10" />
{L_PASSWORD}:
<input class="post" type="password" name="password" size="10" maxlength="32" />
{L_AUTO_LOGIN}
<input class="text" type="checkbox" name="autologin" />
<input type="submit" class="mainoption" name="login" value="{L_LOGIN}" />
</span> </td>
</tr>
</table>
</form>
<!-- END switch_user_logged_out -->
<br clear="all" />
<table cellspacing="3" border="0" align="center" cellpadding="0">
<tr>
<td width="20" align="center"><img src="templates/subSilver/images/folder_new.gif" alt="{L_NEW_POSTS}"/></td>
<td><span class="gensmall">{L_NEW_POSTS}</span></td>
<td> </td>
<td width="20" align="center"><img src="templates/subSilver/images/folder.gif" alt="{L_NO_NEW_POSTS}" /></td>
<td><span class="gensmall">{L_NO_NEW_POSTS}</span></td>
<td> </td>
<td width="20" align="center"><img src="templates/subSilver/images/folder_lock.gif" alt="{L_FORUM_LOCKED}" /></td>
<td><span class="gensmall">{L_FORUM_LOCKED}</span></td>
</tr>
</table>
just replace everything in templates/subSilver/index_body.tpl with the last piece of code.
Official Officiant of the Official Armagetron Clan Registration Office
Back (in the sig) by popular demand: Lack draws
Back (in the sig) by popular demand: Lack draws
An easier way to do a redirect is:
When you select the title for your forum in the admin panel in the title just write
In the address bit put the address to foward to and the name part put what you want to be displayed as the title of the forum area.
I dont know if this works with all phpBB versions but i have 2.0.11 and it works fine with that.
Hope this helps.
When you select the title for your forum in the admin panel in the title just write
Code: Select all
<a href="http://anything.com">Anything</a>
I dont know if this works with all phpBB versions but i have 2.0.11 and it works fine with that.
Hope this helps.
We Put The Fun In Fundamentalist.
And the site could output some PHP code and have it executed on your server. readfile() would thus be a better idea to use.Lucifer wrote:require_once('http://www.google.com/');
and Google's home page would appear embedded in your page.
- Lucifer
- Project Developer
- Posts: 8683
- Joined: Sun Aug 15, 2004 3:32 pm
- Location: Republic of Texas
- Contact:
Yeah, I didn't know that when I wrote it. Heh. I use a different function these days, I forget which one (it's not readline, it's the one that reads the whole file into a string).deja_vu wrote:And the site could output some PHP code and have it executed on your server. readfile() would thus be a better idea to use.Lucifer wrote:require_once('http://www.google.com/');
and Google's home page would appear embedded in your page.
you can do:
$page = file_get_contents('http://www.google.com');
echo $page;
but you might find you need to first go through it with some string replacements to change src=" to src="http://google.com/" and other such things.
I've even done some other skull duggery to keep the links pumping through my own site, like mypage.php?externalsite=http://google.com/..., and then the mypage.php looks for the $_GET['externalsite'] and does the right things.
$page = file_get_contents('http://www.google.com');
echo $page;
but you might find you need to first go through it with some string replacements to change src=" to src="http://google.com/" and other such things.
I've even done some other skull duggery to keep the links pumping through my own site, like mypage.php?externalsite=http://google.com/..., and then the mypage.php looks for the $_GET['externalsite'] and does the right things.