Quote:
Originally Posted by Colmike7
Hey
How could I change a CSV and output to another CSV with html?
For example, if I have a csv in this form:
URL|Title|img|descr
But I want to output it like this:
<a href="[URL]" title="[Title]><img src="[img]" /> | [descr]
How could I do this without typing something custom in Java or anything like that?
Thanks

|
could do it via php
example links.txt
Code:
http://www.google.com|google|http://i.imgur.com/uwti0.jpg|google search engine
php
Code:
<?
$linkfile = dirname(__FILE__). "/links.txt";
$links = file($linkfile);
$result = array();
for ($i=0; $i<count($links); $i++) {
$link = explode("|", $links[$i]);
$result[] = '<a href="' . $link[0] . ' title="' . $link[1] . '"><img src="'.$link[2].'"></a> <span>'.trim($link[3]).'</span>';
echo $result[$i];
}
?>
final output
Code:
[fris@fris ~]$ php test.php
<a href="http://www.google.com title="google"><img src="http://i.imgur.com/uwti0.jpg"></a> <span>google search engine</span>