View Full Version : Site Linking
GhettoT
11-29-2006, 06:43 PM
OK, so me and another guy trying to make up a PHP script that will link multiple sites (100+) together. The idea is that their is an organization, and different people have sites within this organization but on different domains. So what we want is to have a PHP page that people can upload to their site that would call to a certain PHP script/page on a different server(or on their site) that would just insert all of these links to different pages, by name (alphabetically), date added, etc... Sound hard? How would you accomplish this idea?
Here is what we got so far.
<?php include("list_of_sites.php");
?>
How would you accomplish the "list_of_sites.php" page?
-GT
thetestingsite
11-30-2006, 02:34 AM
One thing you could utilize is a database setup. On one of the servers, make a database that has a list of all of the website information in it, then in the "list_of_sites.php" page, call upon the database for the list of names. In the database include the urls of the domains, and the site names.
This would look almost like the following:
<!--Place your html code here to make the list of sites-->
<?php
$server = "mydomain.com"; //url for the mysql server
$DBuser = "username"; //database username
$DBpass = "password"; //database password
$DB = "list_sites"; //actual database name for site info
$conn = mysql_connect($server,$DBuser,$DBpass);
mysql_select_db($DB);
$sites = mysql_query("SELECT * FROM `sites`");
while ($qry = mysql_fetch_array($sites)) {
echo '<a href='.$qry[siteurl].'>'.$qry[sitename].'</a><BR>';
}
?>
Another thing you could try is using an iframe to show "list_of_sites.php" (which is hosted on one server, but shown on all of the ones that are part of this community). These are just a couple of options that you could utilize. Hope this helps somewhat.
GhettoT
11-30-2006, 03:13 AM
One thing you could utilize is a database setup. On one of the servers, make a database that has a list of all of the website information in it, then in the "list_of_sites.php" page, call upon the database for the list of names. In the database include the urls of the domains, and the site names.
This would look almost like the following:
<!--Place your html code here to make the list of sites-->
<?php
$server = "mydomain.com"; //url for the mysql server
$DBuser = "username"; //database username
$DBpass = "password"; //database password
$DB = "list_sites"; //actual database name for site info
$conn = mysql_connect($server,$DBuser,$DBpass);
mysql_select_db($DB);
$sites = mysql_query("SELECT * FROM `sites`");
while ($qry = mysql_fetch_array($sites)) {
echo '<a href='.$qry[siteurl].'>'.$qry[sitename].'</a><BR>';
}
?>
Wow, I never even thought about using a DB for this... Excelent idea. One question, with this setup would people be able to easily find their way to all of the DB information (username, password, etc..)? Also, while on the subject what would you do so that people inside of our community with hosts that do not support PHP, so that they can be a part of our network?
-GT
thetestingsite
11-30-2006, 04:03 AM
Another thing you could try is using an iframe to show "list_of_sites.php" (which is hosted on one server, but shown on all of the ones that are part of this community).
In other words, host the list_of_sites.php page on the "main server" and either post a link to it, or use an iframe or some other form of displaying the data on the no-supported websites. Hope this helps.
djr33
11-30-2006, 08:09 AM
That PHP function (include) will put the contents of that html on your page. Not sure if that's your intent.
Yeah... if you want it to work dynamically, with forms, user input, organization, etc. use a database.
GhettoT
11-30-2006, 09:46 PM
sounds good. Also, with the iFrame would it look like this,
<P ALIGN=center>
<IFRAME SRC="PATH/TO/HTML.html" TITLE="FIRST Team Network">
<!-- Alt. content for non-supported browsers -->
<H2>FIRST Team Network</H2>
<H3>Links</H3>
...
</IFRAME></P>
-GT
thetestingsite
12-01-2006, 02:27 AM
sounds good. Also, with the iFrame would it look like this,
<P ALIGN=center>
<IFRAME SRC="PATH/TO/HTML.html" TITLE="FIRST Team Network">
<!-- Alt. content for non-supported browsers -->
<H2>FIRST Team Network</H2>
<H3>Links</H3>
...
</IFRAME></P>
-GT
Actually, in the src attribute, you would want to put the actual place as if accessing it from your address bar in your browser. (ex: http://mydomain.com/test.php) Hopefully this helps.
Powered by vBulletin® Version 4.2.2 Copyright © 2021 vBulletin Solutions, Inc. All rights reserved.