In values trong array

Events happening in the community are now at Drupal community events on www.drupal.org.
freenotes's picture
[field_image] => Array
                        (
                            [und] => Array
                                (
                                    [0] => Array
                                        (
                                            [fid] => 13
                                            [alt] => 
                                            [title] => 
                                            [uid] => 1
                                            [filename] => 123.jpg
                                            [uri] => public://123.jpg
                                            [filemime] => image/jpeg
                                            [filesize] => 96251
                                            [status] => 1
                                            [timestamp] => 1319025940
                                            [type] => image
                                            [rdf_mapping] => Array
                                                (
                                                )

                                        )

                                )

                        )

Em print_r($content);

ra đc trên, giờ em muốn lấy value filename thì pải làm sao ạ. em cảm ơn rất nhiều, mong hồi âm sớm.

Comments

Cách đơn giản nhất là

MinhVN's picture

Cách đơn giản nhất là $content['field_image']['und'][0]['filename'] :) . Còn cách khác thì em coi thử sao nhé.

Free Notes

freenotes's picture

Ok, Cảm ơn rất nhiều. cái này cho nó đơn giản.

Y: Free.Notes
F: tuansieu
T: tuansieu
E: free.notes@yahoo.com
W: freenotes.us - drupalvn.org
P: 0936 111 039

Free Notes

freenotes's picture

<?php
if ($node->field_image['und'][0]['uri']):
?>

Only local images are allowed.<?php
print image_style_url('body_images', $node->field_image['und'][0]['uri']);
?>
" if alt="
<?php
print $node->field_image['und'][0]['alt'];
?>
" />
<?php
endif;
?>

+++++++++++++++++++
Như bạn chỉ ở trên, ko dùng đc, bị lỗi, bạn dùng cái này nhé. Mình chưa thử, nhưng chắc là đc, vì sẽ hợp lý hơn.

Y: Free.Notes
F: tuansieu
T: tuansieu
E: free.notes@yahoo.com
W: freenotes.us - drupalvn.org
P: 0936 111 039

Dùng cách này

Shellingfox's picture

Dùng cách này đi:

<?php
$images
= field_get_items('node', $node, 'field_image');

foreach(
$images as $image) {
  print
image_style_url('body_images', $image['uri']);
}
?>

API: http://api.drupal.org/api/drupal/modules--field--field.module/function/f...

--
Best regards,
Sang, Lê Thanh

Tel: +84 988079498
Email: me[at]sanglt.com
WWW: www.sanglt.com