| Index
» Projekty
» phpMyEdit
» Fórum
» Link Only When Link in Value? |
 |
clindsey
Založený: 01.09.2008
Príspevky: 31
Zaslal: 2008-10-17 22:19
Návrat hore
Odpovedať s citátom
|
I've got a column in my table, and some of the values contain a url, and others do not. Is there a way to only make a link when there is a value in the cell? I would like to be able to look at the field in phpmyedit and tell when there is a link and when there isn't.
I'm using the following code:
| Kód: |
$opts['fdd']['syllabus'] = array(
'name' => 'Syllabi?',
'URL' => 'http://phpmyedit.ugakey.com/syllabi/$link',
'URLtarget' => '_blank',
'URLdisp' => 'Syllabus'
); |
Thanks.
Chris
|
clindsey
Založený: 01.09.2008
Príspevky: 31
Zaslal: 2008-10-24 19:15
Návrat hore
Odpovedať s citátom
|
Doug, thanks for the link. I'm still having problems, though. Here's the deal. In the column 'syllabus' I have file names of files which are stored in another directory. I only want to have a link display if a file name is present, and if a file name is present, just have the link text say 'Syllabus' or something. Here's the code I'm at now:
| Kód: |
$opts['fdd']['syllabus']['sql|VLF'] =
'if(syllabus <> "",
CONCAT("<a href=\"http://phpmyedit.ugakey.com/syllabi/",
syllabus,
"\">",
syllabus,
"</a>"),
"")';
$opts['fdd']['syllabus'] = array(
'escape' => false,
'name' => 'Syllabi?',
'select' => 'N',
'maxlen' => 20,
'sort' => true
); |
Using this code, I've gotten merely the filename to be displayed, with no link. Any ideas on how to fix this?
If it helps, without that field array, the correct code displays, including the a href, but it is only text, no link. With the field array, it merely displays the filename, no link.
Thanks again for your help.
|
clindsey
Založený: 01.09.2008
Príspevky: 31
Zaslal: 2008-10-24 19:48
Návrat hore
Odpovedať s citátom
|
Doug, thanks for the quick reply. That fixed the issue with the link. Can I make the text of the link say something other that what is in the field? Right now, the link text is the filename, which makes the column really wide. I would like it to just say 'Syllabus' or something like that, and that text would be the same for all links.
|
|
Odoslať novú tému
Odpovedať na tému
|
|
|
|