Jump to content

Recommended Posts

Posted

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.

Posted

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.

Posted

I do this :

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

and it shows NULL for both.

Posted

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.

Posted

I'm mostly interested in the class (get_class() will make it shorter) and if it's a PageArray in the ->count(). Also $register is sufficient.

Posted

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());
Posted

Ok, so it seems really like the repeater does just not pick up it's pages for whatever reason. For the record, which pw version are you using?

  • Like 1
Posted

What if you use include=all, or check role set to false (sorry, on mobile, don't know the correct term for the latter)

Posted

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

Posted

I'd look on github and the forums if other do also have issues with repeaters in the user template. There are some foggy memories, that there might have been others, but I've not much time to look myself right now.

Posted

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

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
  • Recently Browsing   0 members

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