php - datatable server-side href variable -
I am using an example for the server side datatable plugin
This works fine, But now I am trying to change the code for my table, because the example is not exactly how I see my table.
There is a problem:
{$ row = array (); $ I = 0; $ I & lt; Count ($ acolumn); $ I ++) {if ($ a columns [$ i] == "setid") {$ row [] = ($ aRow [$ a columns [$ i]])? '& Lt; A href = \ 'http: //osu.ppy.sh/d/$aRow [$ aColumn [$ i]] \' & gt; Trial & lt; / A & gt; : $ ARow [$ a column [$ i]]; } And if ($ aColumn [$ i]! = '') {/ * Normal output * / $ line [] = $ aRow [$ a column [$ i]]; }} $ Output ['adata'] [] = $ line; } The problem is right here:
$ line [] = ($ aRow [$ a column [$ i]])? '& Lt; A href = \ 'http: //osu.ppy.sh/d/$aRow [$ aColumn [$ i]] \' & gt; Trial & lt; / A & gt; : $ ARow [$ a column [$ i]]; When I click on "test" in my table, it goes to $ aRow [$ aColumn [$ i]]] instead of the id.
As far as I know that the id is in $ aRow [$ aColumn [$ i]]; How can I solve this problem?
You need the variable names to be expanded inside the string. / P>
However, as you are using 3 variables, I will add strings instead of avoiding confusion:
$ row [] = $ aRow [$ a Column [$ i]]? ('& Lt; a href = \' http: //osu.ppy.sh/d/ '$ aRow [$ a column [$ i]].' \ '& Gt; test & lt; / a & gt; ; '): $ ARow [$ A column [$ i]];
Comments
Post a Comment