Load image with link referred to row data

QuestionsLoad image with link referred to row data
Gosmar Maurizio asked 6 years ago

Hello,

I have a table with a column called “item_code”.

For each row I must load an image with a different image that depends from “item_code”.

I have tried to get the value of “item_code” with :

$col[“default”] = “<img height=50 src=’http://www.mysite.com/images/&#8221;.$row[“item_code”]”‘.jpg>”;

but don’t work because the variable is not set correctly.

Can you help me ?

Thank you

Maurizio

3 Answers
Abu Ghufran Staff answered 6 years ago

If you have a column $col[“name”] = “item_code” then you can use:

$col[“default”] = “<img height=50 src=’http://www.mysite.com/images/{item_code}.jpg>”;

_________________________
Abu Ghufran - Dev Team
Grid 4 PHP Framework
 
Maurizio answered 6 years ago

Before to insert the value {item_code} in the string assigned to $col[“default”] I need to make some operation on the string item_code ( i need to add the extension, to modify a part of the path and to add another string to path )

For this reason I need to have the item_code not inside the string <img …… > but to have it like a normal variable.

I have tried to use $MyPath = {item_code} but if I use $MyPath to add informations to path the variable is always empty.

There is a solution ?

Maurizio

 

Abu Ghufran Staff answered 6 years ago

Refer extended conditional content here:

http://www.phpgrid.org/docs/column-options/#conditional-content

_________________________
Abu Ghufran - Dev Team
Grid 4 PHP Framework
 
Your Answer

4 + 17 =

Login with your Social Id:

OR, enter

Attach code here and paste link in question.
Attach screenshot here and paste link in question.



How useful was this discussion?

Click on a star to rate it!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate it.

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?