stuck with an idea for multi listing

12 posts by 2 authors in: Forums > CMS Builder
Last Post: April 4, 2011   (RSS)

By ikanizaj - April 12, 2010

I'm building a site for my climbing club.
Now, I want to make it possible for every member of the club tu update a climbing reports (a database containing data about climb (date, location, grade, climbing partner)), and to make those reports made by one user to be visible under his personal page.

I allready have multipage with the all of my members, and now I would want to display those personal records when I open a detail page of every member?
--
Igor Kani¾aj

Re: [Jason] stuck with an idea for multi listing

By ikanizaj - April 15, 2010

hmmm,

but I want to have a list page that sends createdBy argument to another list page, which then displays only the records created by that user selected on prev page.

In other words, how to pickup this USER NUMBER from one list page and send it as an argument to another listpage?
--
Igor Kani¾aj

Re: [ikanizaj] stuck with an idea for multi listing

By Jason - April 15, 2010

Hi Igor,

You could try this for your list page:
<?php
list($userRecords, $userMetaData)=getRecords(array(
'tableName' => 'accounts',
));
?>
<?php foreach ($userRecords as $record) : ?>
<a href="records.php?createdBy=<?php echo $record['num'] ?>"><?php echo $record['fullName'] ?></a>
<?php endforeach ?>


This will display a list all the users. When you click on one, the variable "createdBy" with a user number will be sent to the next page (in this example records.php).

In the next page, just select your reports normally. CMSBuilder will automatically only retrieve ones created by the user number that was sent from the previous page.

Give that a try and let me know if it works.
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

Re: [Jason] stuck with an idea for multi listing

By ikanizaj - April 15, 2010

actualy, I already have an Createdby argument on my first page, so basicly, all I have to do is to use this line of code???

<a href="records.php?createdBy=<?php echo $record['num'] ?>"><?php echo $record['fullName'] ?></a>
not so sure will it automaticly load only those records, but I'll give it a try, and let you know if it worked..
--
Igor Kani¾aj

Re: [ikanizaj] stuck with an idea for multi listing

By ikanizaj - April 15, 2010

Ok, I've managed to do that with this line of code
<a href="penjackikarton.php?createdByUserNum=<?php echo $record['createdByUserNum'] ?>">otvori&gt;&gt;</a>

the only problem is that, under any user with no records inserted, it displays records from the user with number 1?
--
Igor Kani¾aj

Re: [ikanizaj] stuck with an idea for multi listing

By Jason - April 16, 2010

Hi Igor,

What we want to do is get a list of users (not records), so that when we click on the link, we are searching by a user number, not a record number. Something like this:
<?php
list($userRecords,$userMetaData)=getRecords(array(
'tableName' => 'accounts',
));
?>

<?php foreach($userRecords as $user) :?>
<a href="penjackikarton.php?createdByUserNum=<?php echo $user['num'] ?>"><?php echo $user['fullName'] ?></a>
<?php endforeach ?>


So when a user clicks on that link, they will go to penjackikarton.php and there we'll display only the records associated with their user number.

Give that a try and let me know if that works for you.
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

Re: [Jason] stuck with an idea for multi listing

By ikanizaj - April 16, 2010 - edited: April 16, 2010

I don't think we understand each other.

I have created multi record section "members", and the link under every member is not a link to a detail page, but actualy a link to another multi record section displaying only records created by that member. That's why I can't use users list, and why I used createdby argument to be sent over the link...
--
Igor Kani¾aj

Re: [ikanizaj] stuck with an idea for multi listing

By Jason - April 16, 2010

Hi,

<?php foreach($userRecords as $user) :?>
<a href="*RECORDLISTPAGE*.php?createdByUserNum=<?php echo $user['num'] ?>"><?php echo $user['fullName'] ?></a>
<?php endforeach ?>


If you replace *RECORDLISTPAGE* with the name of you record list page, then the link will pass the variable createdByUserNum (with the value of a user number) to the record list page.

CMSB will then automatically only select records that were created by the member with that user number.

Give it a try and let me know if you run into any issues.
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

Re: [Jason] stuck with an idea for multi listing

By ikanizaj - April 4, 2011

This works great.

Now I have another question.

I have a page with two tabels that are filled with records from two different tabels in database. How to send this createdBy argument to only one selection of records, and that the other tabel is filled with all the records from other table? Because when I use it like this, it fills both tables only with records from that one user...
--
Igor Kani¾aj