I made a new link field called siterealname where I type the name of the site without spaces and all lowercase letters. ex - Big Top would be bigtop. I want to send my hits out using something like link.php?id=bigtop instead of the link id number.
That's a dangerous thing to do, since you can't be sure that you'll always remember to keep the names unique. You're likely to eventually end up with two links that have the same name, rendering one of them dead.
In link.php, change
if ($id > 0)
{
$thelink = new onelink('id', $id); // get for frequent later use if ($thelink->url == '') $action = 'detail'; // if no url, don't try to go to it
}
to
if ($id > 0)
{ $id = $db->rowitem($db->select('id', 'linkstable', "siterealname='$id'")); $thelink = new onelink('id', $id); // get for frequent later use if ($thelink->url == '') $action = 'detail'; // if no url, don't try to go to it
}
Then just link in the templates with link.php?id={LINKSITEREALNAME} (you might want to use the mass replacement across all templates option on the 'advanced' page of your admin panel).
Comments on Alt to link.php?id=
Usergroup: Customer
Joined: Jan 13, 2005
Total Topics: 23
Total Comments: 50
I made a new link field called siterealname where I type the name of the site without spaces and all lowercase letters. ex - Big Top would be bigtop. I want to send my hits out using something like link.php?id=bigtop instead of the link id number.
How can I do it?
developer
Usergroup: Administrator
Joined: Dec 20, 2001
Location: Diamond Springs, California
Total Topics: 61
Total Comments: 7868
That's a dangerous thing to do, since you can't be sure that you'll always remember to keep the names unique. You're likely to eventually end up with two links that have the same name, rendering one of them dead.
In link.php, change to
Then just link in the templates with link.php?id={LINKSITEREALNAME} (you might want to use the mass replacement across all templates option on the 'advanced' page of your admin panel).
Usergroup: Customer
Joined: Jan 13, 2005
Total Topics: 23
Total Comments: 50
Thanks but that code doesn't work.
When I click on a link I get the following error.
Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result resource in /usr/apache/www/htdocs/links/classes/database.php on line 69
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /usr/apache/www/htdocs/links/classes/database.php on line 82
Fatal error: Call to a member function on a non-object in /usr/apache/www/htdocs/links/link.php on line 149
developer
Usergroup: Administrator
Joined: Dec 20, 2001
Location: Diamond Springs, California
Total Topics: 61
Total Comments: 7868
Looks right, if that's actually your field name. Post the debug.