not selecting the right record

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

Re: [craighodges] not selecting the right record

By Dave - October 29, 2009

Hi Craig,

Can you attach both files to this thread? If I can see how the code is outputting the title value that will help me figure out what the issue is.

Thanks!
Dave Edis - Senior Developer
interactivetools.com

Re: [Dave] not selecting the right record

thanks Dave -

There are three primary files.

1 - overview.php is the main page
2 - viewres_stu.php is the viewer page
3 - substu.php creates a subnav menu

You will see the page title is pulled from the title in CMSB. but it always pulls the first record - even when you change records.

Thanks

Craig

Re: [craighodges] not selecting the right record

By Dave - November 2, 2009

Hi Craig,

This was a little tricky, but I think I figured it out. It's because on viewres_stu.php these lines are commented out:

list($stu_resourcesRecords, $stu_resourcesMetaData) = getRecords(array(
'tableName' => 'stu_resources',

'limit' => '1',
));


The where line would get the number from the url, so that code is always just loading the first record.

So this line shows the title from the first record:
<title><?php echo $stu_resourcesRecord['title'] ?>

And then lower this line shows the same value but it's different then:
<h1 class="pg_hdr"><?php echo $stu_resourcesRecord['title'] ?></h1>

Which means one of these includes must have some viewer code that is overwriting $stu_resourcesRecord['title'] or $stu_resourcesRecord

<?php include("../headercode.php");?>
<?php include("../home_link.php"); ?>
<?php include("../nav_top.php");?>
<?php include("substu.php");?>
<?php include("../content_subnavtop.php");?>

What you can try is print <?php echo $stu_resourcesRecord['title'] ?> after each to quickly figure out what file it's being changed in.

Hope that helps!
Dave Edis - Senior Developer
interactivetools.com