- Posts: 7
- Thank you received: 0
Hi
I wonder if there is any way not to link the empty URLs.
I mean, in "Links:" I have a Link for Column: 'Names', and Link Column: 'some URLs'
Not all the Names have URL, so, I don't want Names without URL to be linkable.
Currently my empty URLs are opening the root of my site.
Thanks
Please Log in or Create an account to join the conversation.
Hi,
Unfortunately this is not possible without some hacking.
If you are familiar with PHP you can pimp the function createLink() in /components/com_grid/GridBuilder.php to return just $data if $link is empty.
We might also add this in future versions. Thanks for the idea.
Please Log in or Create an account to join the conversation.
Ok thank you very much, I'm trying but..
Please please help, I need to ad a couple of lines but I can't came up with them . This is my code:
function createLink($type, $link, $data, $customLink=""){
//echo( "type:".$type." link:". $link." label:". $data." custom link:". $customLink."<br>");
$output="";
switch($type){
case '0':{
$output = $data;
}break;
case '1':{
$output = '<a target="_blank" href="'.$link.'">'.$data.'</a>';
}break;
case '2':{
$output = '<a target="_blank" href="?option=com_content&view=article&id='.$link.'">'.$data.'</a>';
}break;
case '3':{
$link = str_replace('@ID', $link, $customLink);
$output = '<a target="_blank" href="'.$link.'">'.$data.'</a>';
}break;
default:{
$output = $data;
}
}
return $output;
}
Please Log in or Create an account to join the conversation.
I would do something like this:
function createLink($type, $link, $data, $customLink=""){
//echo( "type:".$type." link:". $link." label:". $data." custom link:". $customLink."<br>");
$output="";
if($link=="") return $data;
switch($type){
case '0':{
$output = $data;
}break;
case '1':{
$output = '<a target="_blank" href="'.$link.'">'.$data.'</a>';
}break;
case '2':{
$output = '<a target="_blank" href="?option=com_content&view=article&id='.$link.'">'.$data.'</a>';
}break;
case '3':{
$link = str_replace('@ID', $link, $customLink);
$output = '<a target="_blank" href="'.$link.'">'.$data.'</a>';
}break;
default:{
$output = $data;
}
}
return $output;
}
Please Log in or Create an account to join the conversation.
Yes! thanks!!!!
It worked like a charm!
Please Log in or Create an account to join the conversation.