Hi, I’m new on the board and thank you for stop here.
I have a code that use a CSV as a database the PHP script generate a html page from this CSV file but I want that this script detect the presence of a www/@ string and covert all the word on hyperlink/mailto, but I don't have a clue how to Automatically parse URLs around internet addresses + email addresses
Thank you on advance
<head>
<style type="text/css">
table {
font-family: arial, sans-serif;
font-size: smaller;
border-collapse: collapse;
border: solid black thin;
}
th,td {
margin: 0;
padding: 3px;
border: solid black thin;
}
th {
font-weight: bold;
text-align: center;
}
.Odd {
background-color: #CCCCCC;
}
.Even {
background-color: #FFFFFF;
}
</style>
</head>
<body>
<?php
$sOutput = '<table>';
$fp = fopen("test2.csv", "r");
$aCSV = fgetcsv($fp, 1000, ";");
$iColumns = count($aCSV);
# column headers from 1st row of CSV:
$sOutput .= '<tr><th>' . implode('</th><th>', $aCSV) . '</th></tr>';
# data rows:
$iRow = 1;
while (($aCSV = fgetcsv($fp, 1000, ";")) !== FALSE)
{
if (isset($aCSV[$iColumns - 1]))
{
$sJPG = $aCSV[$iColumns - 1];
unset($aCSV[$iColumns - 1]);
}
else
$sJPG = '';
$sOutput .= '<tr class="' . (($iRow++ % 2 === 0) ? 'Even':'Odd') . '"><td>' . implode('</td><td>', $aCSV) . '</td><td>' . ((strlen($sJPG) > 0) ? '<img src="./' . $sJPG . '">':'') . '</td></tr>';
}
$sOutput .= '</table>';
echo str_replace('><', ">\n<", $sOutput);
?>
</body>
</html>