PHP interesse |
|
@ helaas dit werkt niet
1.$artikel = nametolink($record['newsitemcontent'])
2.$artikel = teamtolink($record['newsitemcontent'])
1.$artikel = nametolink($record['newsitemcontent']) 2.$artikel = teamtolink($record['newsitemcontent'])
dit zijn beide functies
///////////////////////////////////////////////////////////////////
// nametolink V.2.5 | fullname search added ///
// Find a playersname in the news item and ///
// And make it a link to the playerstats page ///
// 13-jun- 2010 ///
// by markla ///
//////////////////////////////////////////////////////////////////
function nametolink ($article_text)
{
//get all names
$Q_name2link=
"SELECT
a.Player_Achternaam as player_achternaam,
a.Player_Voornaam as player_voornaam,
a.Player_Tussenvoegsel as player_tussenvoegsel,
a.Player_ID as playerid
FROM
af_players a
Order BY a.Player_Achternaam, a.Player_Voornaam
";
$name2link= mysql_query($Q_name2link) or die ( mysql_error( ) );
while($record = mysql_fetch_array($name2link))
{ //open while
if(empty($record["player_tussenvoegsel"]))
{// open the if loop
$Player_urlName = $record["player_achternaam"].", ".$record["player_voornaam"]." ".$record["player_tussenvoegsel"];
$Player_Name = $record["player_voornaam"]." ".$record["player_achternaam"];
$find = $Player_Name;
$replace= '<a href="http://www.website.nl/speler/'.$record["playerid"].'/'.strtolower(clean_url($Player_urlName)).'.htm" target="_blank" ><u>'.$Player_Name.'</u></a>';
$article_text = str_replace($find, $replace, $article_text);
} else {
$Player_urlName = $record["player_achternaam"].", ".$record["player_voornaam"]." ".$record["player_tussenvoegsel"];
$Player_Name = $record["player_voornaam"]." ".$record["player_tussenvoegsel"]." ".$record["player_achternaam"];
$find = $Player_Name;
$replace= '<a href="http://www.website.nl/speler/'.$record["playerid"].'/'.strtolower(clean_url($Player_urlName)).'.htm" target="_blank" ><u>'.$Player_Name.'</u></a>';
$article_text = str_replace($find, $replace, $article_text);
} // close the if loop
} //close while
return $article_text;
}
///////////////////////////////////////////////////////////////////
// END nametolink ///
///////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
// TEAM2link V.2.0 ///
// Find a Teamname that's in the news item and ///
// And make it a link to the team stats page ///
// 13-jun- 2010 ///
// by markla ///
/////////////////////////////////////////////////////////////////////////
function teamtolink ($article_text)
{
//get all names
$Q_team2link=
"SELECT
a.Team_ID as teamid,
a.TeamName as teamname
FROM
af_teams a
WHERE a.Team_ID > 3
ORDER BY
a.TeamName
";
$team2link= mysql_query($Q_team2link) or die ( mysql_error( ) );
while($record = mysql_fetch_array($team2link))
{
$team_urlName = $record["teamname"];
$team_name = $record["teamname"];
$find = $team_name;
$replace = '<a href="http://www.website.nl/teams/'.$record["teamid"].'/'.strtolower(clean_url($team_urlName)).'.htm" target="_blank" ><u>'.$team_name.'</u></a>';
$article_text = str_replace($find, $replace, $article_text);
}
return $article_text;
}
///////////////////////////////////////////////////////////////////
// END TEAM2LINK ///
///////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////// // nametolink V.2.5 | fullname search added /// // Find a playersname in the news item and /// // And make it a link to the playerstats page /// // 13-jun- 2010 /// // by markla /// ////////////////////////////////////////////////////////////////// function nametolink ($article_text) { //get all names $Q_name2link= "SELECT a.Player_Achternaam as player_achternaam, a.Player_Voornaam as player_voornaam, a.Player_Tussenvoegsel as player_tussenvoegsel, a.Player_ID as playerid FROM af_players a Order BY a.Player_Achternaam, a.Player_Voornaam "; { //open while if(empty($record["player_tussenvoegsel"])) {// open the if loop $Player_urlName = $record["player_achternaam"].", ".$record["player_voornaam"]." ".$record["player_tussenvoegsel"]; $Player_Name = $record["player_voornaam"]." ".$record["player_achternaam"]; $find = $Player_Name; $replace= '<a href="http://www.website.nl/speler/'.$record["playerid"].'/'.strtolower(clean_url ($Player_urlName)).'.htm" target="_blank" ><u>'.$Player_Name.'</u></a>'; $article_text = str_replace($find, $replace, $article_text); } else { $Player_urlName = $record["player_achternaam"].", ".$record["player_voornaam"]." ".$record["player_tussenvoegsel"]; $Player_Name = $record["player_voornaam"]." ".$record["player_tussenvoegsel"]." ".$record["player_achternaam"]; $find = $Player_Name; $replace= '<a href="http://www.website.nl/speler/'.$record["playerid"].'/'.strtolower(clean_url ($Player_urlName)).'.htm" target="_blank" ><u>'.$Player_Name.'</u></a>'; $article_text = str_replace($find, $replace, $article_text); } // close the if loop } //close while return $article_text; } /////////////////////////////////////////////////////////////////// // END nametolink /// /////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////// // TEAM2link V.2.0 /// // Find a Teamname that's in the news item and /// // And make it a link to the team stats page /// // 13-jun- 2010 /// // by markla /// ///////////////////////////////////////////////////////////////////////// function teamtolink ($article_text) { //get all names $Q_team2link= "SELECT a.Team_ID as teamid, a.TeamName as teamname FROM af_teams a WHERE a.Team_ID > 3 ORDER BY a.TeamName "; { $team_urlName = $record["teamname"]; $team_name = $record["teamname"]; $find = $team_name; $replace = '<a href="http://www.website.nl/teams/'.$record["teamid"].'/'.strtolower(clean_url ($team_urlName)).'.htm" target="_blank" ><u>'.$team_name.'</u></a>'; $article_text = str_replace($find, $replace, $article_text); } return $article_text; } /////////////////////////////////////////////////////////////////// // END TEAM2LINK /// ///////////////////////////////////////////////////////////////////
|