Skip to main content
added 6 characters in body
Source Link
srodrig
  • 145
  • 2
  • 14

I have a link field with multiple values. I want to display the link title for each of these fields. I can print the slide link titles individually but not using the foreach.

Currently I have:

field_slideshow_link; print $slide_link['und'][0]['title']; ?>
  • <ul id="slideLinks">
    <?php $slideshow_counter = 0; 
        $slide_link = $node->field_slideshow_link;
        print $slide_link['und'][0]['title'];
    ?>
    <?php foreach ($slide_link as $link) : ?>
        <li><a class="slideControl" href="javascript:void(0);"><?php print $link['und'][$slideshow_counter]['title']; ?></a></li>
        <?php print $slideshow_counter; ?>
        <?php $slideshow_counter++; ?>
    <?php
    if ($slideshow_counter == 4)
        break;
    endforeach;
    ?>
    

    I have a link field with multiple values. I want to display the link title for each of these fields. I can print the slide link titles individually but not using the foreach.

    Currently I have:

    field_slideshow_link; print $slide_link['und'][0]['title']; ?>
  • I have a link field with multiple values. I want to display the link title for each of these fields. I can print the slide link titles individually but not using the foreach.

    Currently I have:

    <ul id="slideLinks">
    <?php $slideshow_counter = 0; 
        $slide_link = $node->field_slideshow_link;
        print $slide_link['und'][0]['title'];
    ?>
    <?php foreach ($slide_link as $link) : ?>
        <li><a class="slideControl" href="javascript:void(0);"><?php print $link['und'][$slideshow_counter]['title']; ?></a></li>
        <?php print $slideshow_counter; ?>
        <?php $slideshow_counter++; ?>
    <?php
    if ($slideshow_counter == 4)
        break;
    endforeach;
    ?>
    
    Source Link
    srodrig
    • 145
    • 2
    • 14

    How to render field attribute in foreach

    I have a link field with multiple values. I want to display the link title for each of these fields. I can print the slide link titles individually but not using the foreach.

    Currently I have:

    field_slideshow_link; print $slide_link['und'][0]['title']; ?>