Skip to main content
Bumped by Community user
Bumped by Community user
Bumped by Community user
added 39 characters in body
Source Link
srodrig
  • 145
  • 2
  • 14

I successfully print the image url for a individual images by the following:

$file = file_load($node->field_hp_slideshow_image['und'][0]['fid']);
                print file_create_url($file->uri);

How can I do something similar but display the url of multiple images in a for or for each loop? Below I have this but it doesn't work:

<?php $slide_image = $node->field_hp_slideshow_image['und'];
    $slide_url = $node->field_hp_slideshow_link['und'];
    $file = file_load($node->field_hp_slideshow_image['und'][0]['fid']);
    print $field_hp_slideshow_image['und'][0]['filename'];
    print file_create_url($file->uri);
?>
<?php for ($i = 0; $i < count($slide_image); ++$i): ?>
    <div class="slideContent">
        <a href="<?php print $slide_url[$i]['url']; ?>">
        <img src="<?php print $base_url . "/" . $path . "/" . $slide_image['filename']; ?>" alt="" />
        </a>
    </div>
<?php endfor; ?>

I successfully print the image url for a individual images by the following:

$file = file_load($node->field_hp_slideshow_image['und'][0]['fid']);
                print file_create_url($file->uri);

How can I do something similar but display the url of multiple images in a for or for each loop?

<?php $slide_image = $node->field_hp_slideshow_image['und'];
    $slide_url = $node->field_hp_slideshow_link['und'];
    $file = file_load($node->field_hp_slideshow_image['und'][0]['fid']);
    print $field_hp_slideshow_image['und'][0]['filename'];
    print file_create_url($file->uri);
?>
<?php for ($i = 0; $i < count($slide_image); ++$i): ?>
    <div class="slideContent">
        <a href="<?php print $slide_url[$i]['url']; ?>">
        <img src="<?php print $base_url . "/" . $path . "/" . $slide_image['filename']; ?>" alt="" />
        </a>
    </div>
<?php endfor; ?>

I successfully print the image url for a individual images by the following:

$file = file_load($node->field_hp_slideshow_image['und'][0]['fid']);
                print file_create_url($file->uri);

How can I do something similar but display the url of multiple images in a for or for each loop? Below I have this but it doesn't work:

<?php $slide_image = $node->field_hp_slideshow_image['und'];
    $slide_url = $node->field_hp_slideshow_link['und'];
    $file = file_load($node->field_hp_slideshow_image['und'][0]['fid']);
    print $field_hp_slideshow_image['und'][0]['filename'];
    print file_create_url($file->uri);
?>
<?php for ($i = 0; $i < count($slide_image); ++$i): ?>
    <div class="slideContent">
        <a href="<?php print $slide_url[$i]['url']; ?>">
        <img src="<?php print $base_url . "/" . $path . "/" . $slide_image['filename']; ?>" alt="" />
        </a>
    </div>
<?php endfor; ?>
added 572 characters in body
Source Link
srodrig
  • 145
  • 2
  • 14

I successfully print the image url for a individual images by the following:

$file = file_load($node->field_hp_slideshow_image['und'][0]['fid']);
                print file_create_url($file->uri);

How can I do something similar but display the url of multiple images in a for or for each loop?

<?php $slide_image = $node->field_hp_slideshow_image['und'];
    $slide_url = $node->field_hp_slideshow_link['und'];
    $file = file_load($node->field_hp_slideshow_image['und'][0]['fid']);
    print $field_hp_slideshow_image['und'][0]['filename'];
    print file_create_url($file->uri);
?>
<?php for ($i = 0; $i < count($slide_image); ++$i): ?>
    <div class="slideContent">
        <a href="<?php print $slide_url[$i]['url']; ?>">
        <img src="<?php print $base_url . "/" . $path . "/" . $slide_image['filename']; ?>" alt="" />
        </a>
    </div>
<?php endfor; ?>

I successfully print the image url for a individual images by the following:

$file = file_load($node->field_hp_slideshow_image['und'][0]['fid']);
                print file_create_url($file->uri);

How can I do something similar but display the url of multiple images in a for or for each loop?

I successfully print the image url for a individual images by the following:

$file = file_load($node->field_hp_slideshow_image['und'][0]['fid']);
                print file_create_url($file->uri);

How can I do something similar but display the url of multiple images in a for or for each loop?

<?php $slide_image = $node->field_hp_slideshow_image['und'];
    $slide_url = $node->field_hp_slideshow_link['und'];
    $file = file_load($node->field_hp_slideshow_image['und'][0]['fid']);
    print $field_hp_slideshow_image['und'][0]['filename'];
    print file_create_url($file->uri);
?>
<?php for ($i = 0; $i < count($slide_image); ++$i): ?>
    <div class="slideContent">
        <a href="<?php print $slide_url[$i]['url']; ?>">
        <img src="<?php print $base_url . "/" . $path . "/" . $slide_image['filename']; ?>" alt="" />
        </a>
    </div>
<?php endfor; ?>
Source Link
srodrig
  • 145
  • 2
  • 14

How to print image url in foreach

I successfully print the image url for a individual images by the following:

$file = file_load($node->field_hp_slideshow_image['und'][0]['fid']);
                print file_create_url($file->uri);

How can I do something similar but display the url of multiple images in a for or for each loop?