Jump to content

Array User Field


Sradesign
 Share

Recommended Posts

Hi

I have another problem like always :D I want to have a repetitive field for each user for example we call that field (MT) each user may have numbers of (MT) with different values in his account like:

Name: client number 1   MT1: 1213 MT2: 1214

Name: client number 2   MT1: 1216 MT2: 1217 MT3:1218

Name: client number 3   MT1: 1216

how to setup this scenario and how to add this MT's to user accounts like. and also how to get them in a loop.

Link to comment
Share on other sites

I have problem now with reading the data from repeater. see the below image my repeater have one entity now.

mt4.jpg

but when I try to read it like this :

<table width="100%" id="registrations" class="table table-hover table-light dataTable dtr-inline" role="grid" aria-describedby="registrations_info" style="width: 100%;">
<thead>
<tr>
	<th>VF-ID</th>
	<th>Name</th>
	<th>Family</th>
	<th>Country</th>
	<th>Phone</th>
        <th>MT4</th>
	<th>Action</th>
</tr>
</thead>
<tbody>
<?php
     $registrations = $users->find("include=hidden,roles=member");
	foreach($registrations as $register){
?>
<tr>
	<td><?php echo '<span class="badge badge-danger bg-blue btn-block">VF-' . $register->id . '</span>'; ?></td>
	<td><?php echo $register->fname; ?></td>
	<td><?php echo $register->lname; ?></td>
	<td><?php echo $register->country_of_citizenship; ?></td>
	<td><?php echo $register->phone; ?></td>
	<td>
	<?php 
		foreach($register->mt4 as $mt4) {
			echo $mt4->platform;
		}
	?>
        </td>
	<td><?php echo '<a href="/user-details/id/'.$register->id.'" class="badge badge-danger bg-blue btn-block">Edit</a>'; ?></td>
</tr>
	<?php
        }
	?>
</tbody>
</table>

it shows nothing


How can I access my repeater data it changed the name of nested fields by itself.

Link to comment
Share on other sites

I did try with $register like this:

var_dump($register->getFormatted('mt4'));
echo "<hr>";
var_dump($register->getUnformatted('mt4'));

and even like this:

var_dump($users->get(1213)->getFormatted('mt4'));
echo "<hr>";
var_dump($users->get(1213)->getUnformatted('mt4'));

both gives me thousand of line which is impossible to check.mind you I have 53 field in each user page.

Link to comment
Share on other sites

this will return RepeaterPageArray

echo get_class($register->getFormatted(mt4));
echo "<hr>";
echo get_class($register->getUnformatted(mt4));

and this one nothing :

echo get_class($register->getFormatted(mt4)->count());
echo "<hr>";
echo get_class($register->getUnformatted(mt4)->count());
Link to comment
Share on other sites

I still got the problem with repeaters can anyone help in that or I should go with pagefield which make my job harder to create the pages each time then import them to my user details pagefield. :D that's a bit ugly :D

Link to comment
Share on other sites

I can see one inconsistency between my repeaters and what rayan always shows in the pictures screen_shot_2012-07-27_at_9_15_24_am.png

this is rayan's one and in my case is like the below I mean the title of fields are with id and added _repeater I don't know if that make any difference or not but why is different.

Untitled_2.jpg

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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...