List pages ith links to detail pages

10 posts by 2 authors in: Forums > CMS Builder
Last Post: September 4, 2009   (RSS)

Hi, I'm new to CMS and trying to get a List page with links to their corresponding detail pages. I have a page "Services" that is a category type and I made a "Services Detail" page that's multi. This is far as I can seem to get.

Here's a link to the dev List page, http://www.litwillersimonsen.com/current_servicesList.php

How do I get the link to just be the title and not "_link : current_servicesDetail.php?Test-1-3"

When you click on the link it takes you to a detail page but the content does not show.

Any help appreciated, thanks!

Krista

Re: [Kristamk] List pages ith links to detail pages

By Chris - September 4, 2009

Hi Krista,

Can you please post the PHP source code for your list page?
All the best,
Chris

Re: [chris] List pages ith links to detail pages

Hi Chris, here's the php code ffor the List page,

<?php

require_once "/usr/www/users/clients1/litwillersimonsen.com/cmsAdmin/lib/viewer_functions.php";

list($servicesRecords, $servicesMetaData) = getRecords(array(
'tableName' => 'services',
));

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
<style type="text/css">
body { font-family: arial; }
.instructions { border: 3px solid #000; background-color: #EEE; padding: 10px; text-align: left; margin: 25px}
</style>
</head>
<body>

<!-- INSTRUCTIONS -->

<!-- /INSTRUCTIONS -->

<!-- STEP2: Display Records (Paste this where you want your records to be listed) -->
<h1></h1>
<?php foreach ($servicesRecords as $record): ?>
_link : <a href="<?php echo $record['_link'] ?>"><?php echo $record['_link'] ?></a><br/>

<?php endforeach; ?>

<?php if (!$servicesRecords): ?>
No records were found!<br/><br/>
<?php endif ?>
<!-- /STEP2: Display Records -->

Re: [Kristamk] List pages ith links to detail pages

By Chris - September 4, 2009

Hi Krista,

Assuming that the field you want to display is called 'title', replace this line:

_link : <a href="<?php echo $record['_link'] ?>"><?php echo $record['_link'] ?></a><br/>

with this:

<a href="<?php echo $record['_link'] ?>"><?php echo $record['title'] ?></a><br/>

Hope this helps. :)

As for your detail pages not working, your link looks correct, so can you please post the PHP source code for your current_servicesDetail.php page?
All the best,
Chris

Re: [chris] List pages ith links to detail pages

Hi, I replaced the line off code and now hthis shows up on the page,

"Notice: Undefined index: title in /usr/www/users/clients1/litwillersimonsen.com/current_servicesList.php on line 97"

Thanks,

Krista

Re: [Kristamk] List pages ith links to detail pages

By Chris - September 4, 2009

Hi Krista,

Your list page is pulling records from a section called "services", but your detail page is using a different section called "services_detail". I'm not sure exactly what you have in mind for your site, but you probably don't need both sections.

If you search and replace "services_detail" with "services" in your current_servicesDetail.php page, your links will work.

Does that solve your problem? Please let me know. :)
All the best,
Chris

Re: [chris] List pages ith links to detail pages

Hello,
I am wanting to have a page (A List Page) with just links, when you click on the links you go to that sub page.

I'll try your last suggestion.

thanks,

Krista

Re: [chris] List pages ith links to detail pages

Ok, I did that and the link now works.

If you look at this page,
http://www.litwillersimonsen.com/current_servicesList.php

you'll first see that the link name is funky, it should be "Test 1" and not, "Notice: Undefined index: title in /usr/www/users/clients1/litwillersimonsen.com/current_servicesList.php on line 97 "

Do I need to remove "Services Details" from the Section Editors??

i just want to be add to add links to the Current Services page and when you click the links you go to that page.

Thanks!

Do you guys post on the weekend?

Thanks again,

Krista

Re: [Kristamk] List pages ith links to detail pages

By Chris - September 4, 2009

Hi Krista,

I usually post on the weekends, yes.

The code I gave you above assumed that the field you want to display is called 'title'. Since you don't have a field called 'title', you're getting that error. What field do you want to display in the link on your list page?

If you need to get a list of fields, you can either generate Viewer code again -- or look in the section editor.

Do I need to remove "Services Details" from the Section Editors??


If you're not using it, you might as well remove it so it doesn't confuse anyone later. Keeping things simple is always a good goal. :)

Hope this helps!
All the best,
Chris