Hyperlinking to other table data
11 posts by 4 authors in: Forums > CMS Builder
Last Post: November 24, 2008 (RSS)
By gethudson - May 11, 2008
I have two sections/tables. The first is called ‘issue’ and has one text field called ‘issuemonth’ into which a year and month are typed in the format ‘yyyymm’. This list viewer appears as I want it:
Issue - List Page Viewer
Issue for: 200806
Issue for: 200805
The second section/table is called ‘page’ and has two fields: a text field called ‘page_number’ into which a page number (001, 002, …) is typed, and ‘assign_issue’ which uses a picklist generated from the ‘issuemonth’ field in the ‘issue’ table. The list viewer page appears like this:
Page - List Page Viewer
Issue: 200806 - Page Number: 001 - Link: pageDetail.php?8
Issue: 200806 - Page Number: 002 - Link: pageDetail.php?6
Issue: 200805 - Page Number: 001 - Link: pageDetail.php?1
Issue: 200805 - Page Number: 002 - Link: pageDetail.php?2
What I am struggling to achieve is that I want to be able to click on a link in the Issue - List Page Viewer page and be sent to something that looked like the Page - List Page Viewer page, but only showing records that related to the ‘issuemonth’ that had been clicked.
Code – top of Issue - List Page Viewer:
list($issueRecords, $issueDetails) = getRecords(array(
'tableName' => 'issue',
));
Code – body of Issue - List Page Viewer:
<?php foreach ($issueRecords as $issueRecord): ?>
Issue for: <a href="<?php echo $issueRecord['_link'] ?>"><?php echo $issueRecord['issuemonth'] ?></a>
<hr/>
<?php endforeach; ?>
Code – top of Page - List Page Viewer:
list($pageRecords, $pageDetails) = getRecords(array(
'tableName' => 'page',
));
Code – body of Page - List Page Viewer:
<?php foreach ($pageRecords as $pageRecord): ?>
Issue: <?php echo $pageRecord['assign_issue'] ?> - Page Number: <?php echo $pageRecord['page_number'] ?> - Link: <a href="<?php echo $pageRecord['_link'] ?>"><?php echo $pageRecord['_link'] ?></a>
Thanks for any assistance in advance, George
Re: [gethudson] Hyperlinking to other table data
By Dave - May 11, 2008
The first step is figuring out how to get your "Page List" only showing records that are in a specific issue. All the viewers have search capabilities enabled by default (unless you turn it off). Try this:
yourPageListViewer.php?issuemonth=200806
And have a look at the search docs here:
http://www.interactivetools.com/docs/cmsbuilder/viewer_search.html
If that works you just need to add that to the links in the issue list viewer, like this:
<a href="<?php echo $issueRecord['_link'] ?>?issuemonth=<?php echo $issueRecord['issuemonth'] ?>"><?php echo $issueRecord['issuemonth'] ?></a>
Hope that helps! Let me know if that works for you. :)
interactivetools.com
Re: [Dave] Hyperlinking to other table data
By gethudson - May 12, 2008 - edited: May 12, 2008
Just for the record in case it helps any other newbie, then here is my final code:
<?php foreach ($issueRecords as $issueRecord): ?>
Issue for: <a href="pageList.php?assign_issue=<?php echo $issueRecord['issuemonth'] ?>">
<?php echo $issueRecord['issuemonth'] ?></a>
<hr/>
<?php endforeach; ?>
Re: [gethudson] Hyperlinking to other table data
By Dave - May 12, 2008
interactivetools.com
Re: [Dave] Hyperlinking to other table data
By Janet - July 21, 2008
I'm trying to link one record to another within the same database ("faculty_member"). In this case, it's directory listing where professors and students can enter their information. I've added an extra field where students can enter the name of their advising professor. I made this field ("major_professor") a list field using the same database ("faculty_member") to populate the list. I used "num" as one list field option and "lname" as the another (just in case there are two professors with the same last name.)
I can't figure out how to filter the search so that the value of "major_professor" links to that professors profile page.
This is what the code looks like so far:
<?php
$type = @$_GET['faculty_directory'];
if ($type == 'Postdoctoral Associates'):
?>
<h2> <?php echo $facultyDirectory ?> </h2>
<?php foreach ($listRows as $record): ?>
<div class="directory-listing">
<h5> <?php echo $record['fname'] ?> <?php echo $record['lname'] ?> </h5> // gets the name of the student
<p class="locale">
<a href="facultyMember.php?<?php echo $record['major_professor] ?>"><?php echo $record['major_professor] ?></a> //this is the linking statement where the name of the major professor links to his/her profile page.
<p class="contact"> <a href="mailto:<?php echo $record['email'] ?>"> <?php echo $record['email'] ?> </a> <br />
<?php echo $record['phone_number'] ?> (voice)<br />
<?php echo $record['fax_number'] ?> (fax) </p>
</div>
<?php endforeach ?>
<?php endif ?>
I hope my explanation make sense.
Jan
Re: [Janet] Hyperlinking to other table data
By Dave - July 21, 2008
So is there a field in the 'faculty_member' section that will have the same value as $record['major_professor]?
If so you'd use a special url to search on that field like this:
facultyMember.php?lname_keyword=<?php echo $record['major_professor] ?>
You can read about the search features here:
http://www.interactivetools.com/docs/cmsbuilder/viewer_search.html
Hope that helps, let me know if you need more help with that.
interactivetools.com
Re: [Dave] Hyperlinking to other table data
By Janet - July 21, 2008
Jan
Re: [Janet] Hyperlinking to other table data
By Janet - July 21, 2008
We're going in a different direction for this solution. Don't trouble yourself. I'm going to add a couple of fields which we'll enter manually. A couple of the faculty are listed twice and my content editor doesn't know which one to select from the list menu. Thanks anyway!
Jan
Re: [Janet] Hyperlinking to other table data
By Dave - July 22, 2008
interactivetools.com
Hyperlinking to other table data : I DONT UNDERSTAND
I have a section editor call "Categories".
I have another section editor call "product".
Product is compose by:
- category (this is a list, the options are from the other section editor upper "Categories"
- title
- content
Here is what i want to do : A page with all the "Categories" entry listed. When i click on one "Categorie" i want to display a page which will list the "products" of the Categorie.
In this page i want to be able to also display the name of the categorie where my product are listed