php - Solved: Display Multiple Images/Links In CDetailView Yii framework -


Support I am surfing the whole day and can not find the subject, how to display multiple images in CDTEQview Here is how:

  1. I uploaded many images, files stored in image / jpg / images / doc directory
  2. I have entered the path of images, cell means that the cell has three filenames with a comma: abc.jpg, xyz.jpg, abaca.jpg.
  3. I want to show the link in the CdBetChEViewView which click to open the image in the new tab browser.

I have tried with this script:

  array ('name' = & gt; 'file link', 'type' = & gt; ; 'Raw', 'value' = & gt; ABC, XYZ,  

and also to display pictures

  $ document = CHtml: : Encode ($ model-> document); $ file = str_getcsv ($ document, ",");  

in CDEE view

  array Link to 'name' = & gt; 'image', 'type' = & gt; 'raw', 'value' => gt; $ file [1]), array ('name' = & gt; ' Image '' 'name' = & gt; 'image', 'type' = & gt; 'raw', 'value', 'value' = & Gt; Link to 'raw', 'value' => $ file [2]) = & gt; $ file [3]),  

but the result is not like that As much as I'm hoping, when I click on the recognized link that was opened by the browser.

I hope this way: And it should be in a dynamic form. The use of 'foreach' statement can be used to understand how to use it. I am not getting it ... ... < / P>

  file link: abc.jpg   

please

resolve : For the foreach statement and CDEAT, see two widgets to display more than one image, to display simple attributes and one / which have multiple images in the

H As shown in the code , the following code states $ model-> there are many images in the database in the database, the firefighter will be exploded in the code str_getcsv , converts to the array. foreach statement

  & lt; Php can be used in $ attribute = CHtml :: encode ($ Model-> Documents); $ File1 = str_getcsv ($ attribute, ","); Forex currency ($ i => $ file as archive) {$ this- & gt; Widgets ('zii.widgets.CDetailView', array ('data' = & gt; $ model, 'attribute' '> array (array' // 'value' = & gt; $ file [$ i] 'value '= & Gt; CHtml :: link (cfm :: encoded ($ file [$ i]), wi: app () - & gt; base url. / Images /'. $ File [$ i]), ' Type '= & gt;' raw '),))); ?} & Gt;  

Therefore it is resolved as necessary

As the widget has been created several times, it is necessary to look at different solutions according to the right now. If there is a separate solution please help me.

Thanks Sandeep's

If I understand your point of view, Need to have multiple images, okay?

There is an uncompleted task for the value attribute and return the link to the images:

  'value' = & gt; Function ($ data) {// here $ data represents your model $ link = ''; If $ ($ data- & gt; image) is empty ($! - data-> link $ l) {$ link} = CHtml :: link (CHtml :: encode ($ file [$ i]), Yii:: app () - & gt; Base URL. / Images / '. $ File [$ i]). '& Lt; Br / & gt; '; } $ Link return; }  

Comments