You are not logged in.
Pages: 1
Hi,
Can someone help me to alter the scan.php file located in xinha/plugins/Linker.
I'm trying to list links I get from a mysql database. As far as I can see I need to alter the function scan to connect to the database, get the page name and id and return it in a kind of format linker.js can read.
I've tried this but it throws errors:
function scan($dir, $durl = ''){
$files = array();
$dir = realpath($dir);
require_once(realpath(dirname(__FILE__) . '/../../../../php/config.php'));
mysql_connect(DB_HOST,DB_LOGIN,DB_PASS);
mysql_select_db(DB_NAME);
$sql = "SELECT * FROM page";
$result = mysql_query($sql) or die($sql."\n".mysql_error());
while ($record = mysql_fetch_object($result)) {
$id = $record->page_id;
$title = $record->page_name_nl;
$files[] = array('url'=>$dir.'/index.php?pid='.$id);
}
return dirsort($files);
}
I want the user to click on a page name (from database) and the input field URL automatically gets filled with the url (http://www.mydomain.com/index.php?pid=9)
I've read http://xinha.webfactional.com/wiki/Linker and some other posts about this subject, but I couldn't find a solution to my problem.
Offline
Forget about scan.php as it is, rewrite it from scratch to do what you want.
All your new scan.php has to do is produce something like this at a minimum
[
{
url: 'a.html',
title: 'A Title'
},
{
url: 'b.html',
title: 'B Title'
}
]
James Sleeman
Offline
Hi gogo,
That's surprisingly easy!! Works like a charm.
Thank you for the quick reply.
Offline
Pages: 1