Jump to content

how to use wireArray


Recommended Posts

When I'm using wireArray, both with repeater and image field with more than one image, I have a problem getting the content of the array. 

For example, I have the following code where info_tabs is a repeater of textarea fields. 

$texts = $page->info_tabs;
foreach ($texts as $tab){
    echo "<div>;
    echo $tab;
    echo "</div>;

Instead of echoing the text, the page is echoing numbers, it is echoing the numbers 1029-1032. why is that?

Link to comment
Share on other sites

Since a Repeater item is a kind of page the numbers are the id's of the extries of the repeater...

so have a closer look at:


like in the example you have to call the fields like:

foreach ($page->info_tabs as $tab){
    echo "<div>";
    echo $tab->title;

    //or if you have a special text field
    echo $tab->myFieldName;
    echo "</div>";

regards mr-fan

Edited by LostKobrakai
Fixed missing quotes
  • Like 2
Link to comment
Share on other sites

thanks! can you maybe that also for the case of images array? Because in that case each image doesn't have a field (or does it?)

right now i use 

foreach($images as image){
  $imagesrc = "{$image->url}{$image}";

to get the whole image src, but it seems kind of redundant. Is there a better way?

Edited by LostKobrakai
Fixed another missing quote
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...