michal
Založený: 17.06.2003
Príspevky: 537
Bydlisko: Slovakia
Zaslal: 2003-11-25 19:08
Návrat hore
Odpovedať s citátom
|
you can use something like this
'url' => 'other.php?rec=$value'
but you have figured this out, i guess
other solution is described
http://opensource.platon.sk/projects/bug_view_advanced_page.php?f_bug_id=127
|
hbernard
Založený: 23.03.2003
Príspevky: 159
Bydlisko: FRANCE
Zaslal: 2003-11-25 21:24
Návrat hore
Odpovedať s citátom
|
With current CVS :
| Kód: |
$opts['fdd']['msg'] = array(
.../...
'sql|L' => 'concat("<a href=\"http://mysite.com/display_user.php?id=",user_ID,"\">",msg,"</a>")';
.../...
); |
(dont use the URL options)
Hugues
PS: michal, it seems you like php functions as I like sql functions ;-)
|
hbernard
Založený: 23.03.2003
Príspevky: 159
Bydlisko: FRANCE
Zaslal: 2003-11-26 15:58
Návrat hore
Odpovedať s citátom
|
|L option means :
<< use 'sql' stuff only in list mode >>
This is in pme documentation.
Can you give the HTML output ? (you should get an hyperlink, so something is wrong in my sql escaping)
| NJGMike Napísal: |
HBernard:
It works like a charm! Pulls in the data perfectly! Thank you.
But it doesn't make the new string a Href link and rawurlencodes it.
I have read the refernce in the documentation to ['sql'] but can't find the pipe 'L' option. Does that mean a link command? If so, it doesn't seem to leave the statement as HTML.
Thank You Very Very Much. This is way better than I ever hoped.
BTW. I love SQL too! :) |
|
NJGMike
Založený: 26.11.2003
Príspevky: 3
Zaslal: 2003-11-26 17:10
Návrat hore
Odpovedať s citátom
|
Ok fixed it! Or should I say Hacked it?
The 'sql' option works great but if you want to make a displayable URL like in a SQL CONCAT query you will run into problems.
Here's a portion of my PHPMyEdit generated script
| Kód: |
$opts['fdd']['activ_msg'] = array(
'name' => printMsg('description'),
'select' => 'T',
'options' => 'L',
'maxlen' => 50,
'width' => "350px",
'required' => false,
'sort' => false,
'sql|L' => "concat('<a href=\"http://mysite.com/display_user.php?id=',cont_ID,'\">',activ_msg,'</a>')"
); |
Everything works great but the out put to the cell from PHPMyEdit translates the results safely using the PHP function
htmlspecialchars
I had to add the following line to the bottom of the
cellDisplay
function of the PHPMyEdit.class.php to have the sql result returned without converting to HTML Special Chars.
| Kód: |
if (strlen($value) <= 0) {
return ' ';
}
// MICHAEL CONNORS ADDED THIS IF STATEMENT NOV 25 2003
if ( @$this->fdd[$k]['sql'] ) {
$escape = false;
}// END MICHAEL CONNORS IF
if ($escape) {
$value = htmlspecialchars($value);
} |
Unfortunately, this Hack forces all the 'sql' values to avoid the HTML conversion.
Hope this helps someone. Thanks to HBernard for his guidance on this problem. I love this program!
|
hbernard
Založený: 23.03.2003
Príspevky: 159
Bydlisko: FRANCE
Zaslal: 2003-11-26 18:09
Návrat hore
Odpovedať s citátom
|
I wonder if you should fill a bug to add a field option
'force_escape' true/false
to force escaping or not.
then, the patch should be :
| Kód: |
Ln1225 :
if (isset(@$this->fdd[$k]['force_escape']))
$escape = @$this->fdd[$k]['force_escape']; |
|
michal
Založený: 17.06.2003
Príspevky: 537
Bydlisko: Slovakia
Zaslal: 2003-11-26 23:29
Návrat hore
Odpovedať s citátom
|
it's true, i like them. mainly because i did not study sql functions (the only i really use is unique key feature, rest is left to phpMyEdit :))
also, with php function, you change only data, which are last printed. the sql option changes their source. btw, how is filtering done, i mean if i hit search option and then apply a drop down menu, works as expected ?
maybe sql|LV option is better than pure sql. i will play with it in near future.
anyway, $row array should be available when composing url option.
in my patch there is $row (passed by all datemask,values,values2 .. options), $row_rough (as if select * from my_table)
hope someday it will be in official distribution :)
|
NJGMike
Založený: 26.11.2003
Príspevky: 3
Zaslal: 2003-11-27 00:24
Návrat hore
Odpovedať s citátom
|
Now I know you're a REAL coder! Thats a sweet idea of adding a 'force_escape' option. In fact I have already modified my PHPMyEdit.class.php with your code instead of mine.
Thanks again, Although this isn't really a bug I leave it up to the power that be to determine if it is worthy of adding to the source code.
Hope someone else can use it. Thanks 100 times
| hbernard Napísal: |
I wonder if you should fill a bug to add a field option
'force_escape' true/false
to force escaping or not.
then, the patch should be :
| Kód: |
Ln1225 :
if (isset(@$this->fdd[$k]['force_escape']))
$escape = @$this->fdd[$k]['force_escape']; |
|
|
nepto
Založený: 06.01.2003
Príspevky: 320
Bydlisko: Phoenix, Arizona (USA)
Zaslal: 2003-12-16 12:08
Návrat hore
Odpovedať s citátom
|
In the current CVS verison of phpMyEdit new field
$opts['fdd']['col_name']['escape']
option was implemented. Documentation was also written as well. Wait for comming 5.4 release to be able to use this feature.
Here is extract from documentation:
HTML escaping
By default are all field values escaped using htmlspecialchars() PHP function. However, this is not always desirable. You can turn this escaping by setting $opts['fdd']['col_name']['escape'] to false.
Example 4-10. Field escaping
| Kód: |
$opts['fdd']['col_name']['escape'] = true;
$opts['fdd']['col_name']['escape'] = false; |
_________________ Ondrej Jombik (Nepto)
Visit my
homepage
, review my recent
CV
or
projects
and give me some
feedback
.
|
|
Odoslať novú tému
Odpovedať na tému
|