List pages ith links to detail pages
10 posts by 2 authors in: Forums > CMS Builder
Last Post: September 4, 2009 (RSS)
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
Can you please post the PHP source code for your list page?
Chris
Re: [chris] List pages ith links to detail pages
<?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
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?
Chris
Re: [chris] List pages ith links to detail pages
"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
<?php
require_once "/usr/www/users/clients1/litwillersimonsen.com/cmsAdmin/lib/viewer_functions.php";
list($services_detailRecords, $services_detailMetaData) = getRecords(array(
'tableName' => 'services_detail',
'where' => whereRecordNumberInUrl(1),
'limit' => '1',
));
$services_detailRecord = @$services_detailRecords[0]; // get first record
?>
<!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>
<!-- STEP2: Display Records (Paste this where you want your records to be listed) -->
<h1></h1>
<?php echo $services_detailRecord['content'] ?><br/>
<?php if (!$services_detailRecord): ?>
No record found!<br/>
<br/>
<?php endif ?>
<!-- /STEP2: Display Records -->
Thanks,
Krista
Re: [Kristamk] List pages ith links to detail pages
By Chris - September 4, 2009
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. :)
Chris
Re: [chris] List pages ith links to detail pages
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
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
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!
Chris