| Index
» Projekty
» phpMyEdit
» Fórum
» Origional ID as value for links |
 |
maarten
Založený: 05.01.2004
Príspevky: 1
Zaslal: 2004-01-05 23:03
Návrat hore
Odpovedať s citátom
|
Hi,
I was working on a project yesterday where I wanted to link a field with a hyperlink to another table.
Unfortunatly this wasn't working as expected because the $value using being used referred to the value in the table, not to the actual table content.
I patched the following code in function cellDisplay to allow this:
| Kód: |
if ($this->col_has_URL($k))
{
$orig = $row['qf'.$k.'_idx'];
return $this->urlDisplay($k, $value, $css, $key_rec, $orig);
}
|
This simple change can be used like this in a table:
| Kód: |
$opts['fdd']['CompanyId'] = array(
'name' => 'Company',
'select' => 'T',
'maxlen' => 20,
'URL' => 'company.php?fl=0&fm=0&sfn[0]=0&sfn[1]=1&operation=Details&rec=$orig',
'default' => '0',
'required' => true,
'sort' => true,
'values' => array(
'table' => 'Company',
'column' => 'Id',
'description' => 'CompanyName')
);
|
This might be usefull to add to the original code. If you need any further comments on this, please ask me.
|
michal
Založený: 17.06.2003
Príspevky: 537
Bydlisko: Slovakia
Zaslal: 2004-02-15 21:44
Návrat hore
Odpovedať s citátom
|
i was coping with a similar problem. see bug report on output_control.
$rough_row array might interest you ....
|
vang
Založený: 20.02.2004
Príspevky: 5
Zaslal: 2004-02-20 21:46
Návrat hore
Odpovedať s citátom
|
i wasn't able to understand/use rough_row, but following maarten's ideea, the patch for the newly released phpMyEdit-5.4 is something like:
1168c1168
< function urlDisplay($k, $link_val, $disp_val, $css, $key) /* {{{ */
---
> function urlDisplay($k, $link_val, $disp_val, $css, $key, $orig) /* {{{ */
1183c1183,1184
< 'url' => $url
---
> 'url' => $url,
> 'orig' => $orig
1267c1268,1273
< return $this->urlDisplay($k, $original_value, $value, $css,
$key_rec);
---
>
> //vang
> // patch from http://opensource.platon.sk/forum/projects/viewtopic.php?t=243
> //
> $orig = $row['qf'.$k.'_idx'];
> return $this->urlDisplay($k, $original_value, $value, $css, $key_rec, $orig);
(disclaimer: i'm newbie in php, but it works for me)
|
ajh
Založený: 17.12.2003
Príspevky: 236
Zaslal: 2004-02-22 19:40
Návrat hore
Odpovedať s citátom
|
5.4 has this feature as standard. $link now contains the raw data before any of the PME transformations - so you can use that in URL
|
|
Odoslať novú tému
Odpovedať na tému
|
|
|
|