User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the Existing Scripts section within the Web Development category of DaniWeb, a massive community of 425,932 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 1,672 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Existing Scripts advertiser: Web Code Converter
Views: 1660 | Replies: 0
Reply
Join Date: Nov 2006
Posts: 1
Reputation: pas cher is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
pas cher pas cher is offline Offline
Newbie Poster

a new script

  #1  
Nov 24th, 2006


Here a great script to automate link in a page with CSC
<?
function getArray_fromCSV()
{
$row = 1;
$handle = fopen ("/table.csv","r");
$i=0;
while ( $data = fgets ($handle, 1000))
{
$datensatz = explode('^',$data);
$datensatz[1] = trim ( $datensatz[1]);
$alle_daten[$i++] = $datensatz;
}
fclose ($handle);
//echo "<pre>";var_dump($alle_daten);echo "</pre>";
return $alle_daten;
}
function dreieckstausch($all)
{
for ($i=0;$i < sizeof($all);$i++)
{
for ($z=$i+1;$z < sizeof($all); $z++)
{
if ($all[$i][1] > $all[$z][1] )
{
$arr_tmp = $all[$i];
$all[$i] = $all[$z];
$all[$z] = $arr_tmp;
}
}
}
return $all;
}
function main2($beschreibung){
return $beschreibung;
}
function main($beschreibung)
{
define('LINKANZAHL',9);
$all_search = getArray_fromCSV();
//$all = dreieckstausch($all);
//$beschreibung = get_String();
$arr_beschreibung = explode(' ',$beschreibung);
$startwert = 5;
$bool_startwert_chk=false;
for ($i=0; $i < LINKANZAHL;$i++)
{
$bool_chk = false;
do
{
for ($z=0;$z < sizeof($all_search);$z++)
{
$suchbegriff = $all_search[$z][0];
$url = $all_search[$z][1];
$expr3 = '°\s?>*'.$suchbegriff.'<*\s?°imU';
$expr = '°^(.*>)?'.$suchbegriff.'(.*<)?$°imU';
if(preg_match($expr,$arr_beschreibung[$startwert],$foundarray) > 0)
{
$arr_beschreibung[$startwert]=str_replace($suchbegriff,"<a style=\"color:#464946;text-decoration:underline;\" href='$url'>$suchbegriff</a>",$arr_beschreibung[$startwert]);
//unset($all_search[$z]);
$all_search[$z][0] = 'kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk';
$bool_chk = true;
if ($startwert < sizeof($arr_beschreibung))
$startwert += 5;
else
$bool_startwert_chk = true;
break;
}
elseif(strpos($suchbegriff,' ') != false && preg_match($expr,$arr_beschreibung[$startwert].' '.$arr_beschreibung[$startwert+1],$foundarray) > 0)
{
$arr_suchbegriff = explode(' ',$suchbegriff);
$arr_beschreibung[$startwert]=str_replace($arr_suchbegriff[0],"<a style=\"color:#464946;text-decoration:underline;\" href='$url'>".$arr_suchbegriff[0]." ".$arr_beschreibung[$startwert+1]."</a>",$arr_beschreibung[$startwert]);
$arr_beschreibung[$startwert+1]='';
$all_search[$z][0] = 'kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk';
$bool_chk = true;
if ($startwert < sizeof($arr_beschreibung))
$startwert += 6;
else
$bool_startwert_chk = true;
break;
}
}
if ($bool_chk===false)
{
if ($startwert < sizeof($arr_beschreibung))
$startwert+=1;
else
$bool_startwert_chk = true;
}
if ($bool_startwert_chk)
break;
} while ($bool_chk === false);
}
//var_dump($all_search);
$beschreibung = implode($arr_beschreibung,' ');
return $beschreibung;

}

?>
http://www.digitalfreemarket.com/des...pc-ordinateur/
AddThis Social Bookmark Button
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb Existing Scripts Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the Existing Scripts Forum

All times are GMT -4. The time now is 9:12 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC