Excluding certain content/list

11 posts by 2 authors in: Forums > CMS Builder
Last Post: September 17, 2012   (RSS)

Re: [design9] Excluding certain content/list

By gregThomas - September 12, 2012

Hi April

I think the problem is with the \t you have in the where statement. Have you tried removing them and doing something similar to this?:

list($aboutRecords, $aboutMetaData) = getRecords(array(
'tableName' => 'about',
'where' => "header NOT LIKE '%The Daily Post%'",
'limit' => '4',

));


The \t might be adding a space before and after the Daily post string, and these might not be saved in the table with the title.
Greg Thomas







PHP Programmer - interactivetools.com

Re: [greg] Excluding certain content/list

By design9 - September 13, 2012

Thanks.

I tried that and that doesn't seem to work either.

April

Re: [design9] Excluding certain content/list

By design9 - September 13, 2012

Hello,
I am having one other issue with this that I need some help with. When pulling in the content/image, it is working fine. It pulls the title and image form the header_images_small table with no problem. I also want to pull in the title and content fields from the about us section into that area. However, it is giving me an error because it is looking for those fields in the header_images_small table. Is there a way to also pull in the title and content fields for each listing from the about us section as well?

See ex. page:
http://www.charlotteparent.com/indexap.php

I have included my test page code to make it easier to look at.


Thanks!
April
Attachments:

indexap.php 2K

Re: [design9] Excluding certain content/list

By gregThomas - September 13, 2012

Hi April,

Would it be possible for you to add the following code and then reply with the outputted array so that I can get a clearer idea of how all of the tables are linked?

<?php foreach ($aboutRecords as $record): ?>

<?php
showme($record);
exit();

$num = $record['header'];

list($header_images_smallRecords, $header_images_smallMetaData) = getRecords(array(
'tableName' => 'header_images_small',
'where' => "num ='$num'",

));


?>


I think maybe the header field is not where the the title of album is stored, and this is why it is still returning the daily post as well.

Could you also post me your updated code with the title and content fields in? This will help me with the showing blog_title and content fields issue.

Thanks!
Greg Thomas







PHP Programmer - interactivetools.com

Re: [greg] Excluding certain content/list

By design9 - September 13, 2012

Sure...Here is the output:

Array
(
[_filename] => The-Daily-Post
[_link] => javascript:alert('Set Detail Page Url for this section in: Admin > Section Editors > Viewer Urls')
[_tableName] => about
[blog_title] => Title 1
[content] => text 1
[createdByUserNum] => 1
[createdDate] => 2012-09-12 14:32:18
[dragSortOrder] => 40
[header] => 1
[header:labels] => Array
(
[0] => The Daily Post
)

[header:values] => Array
(
[0] => 1
)

[num] => 1
[title] => The Daily Post
[updatedByUserNum] => 1
[updatedDate] => 2012-09-13 10:14:30
[createdBy.num] => 1
[createdBy.createdDate] => 2009-02-04 22:16:32
[createdBy.createdByUserNum] => 0
[createdBy.updatedDate] => 2009-02-04 22:16:32
[createdBy.updatedByUserNum] => 0
[createdBy.username] => admin
[createdBy.email] => acraig@carolinaparent.com
[createdBy.fullname] => April Craig
[createdBy.expiresDate] => 0000-00-00 00:00:00
[createdBy.neverExpires] => 1
[createdBy.isAdmin] => 1
[createdBy.disabled] => 0
[createdBy.accessList] =>
[createdBy.lastLoginDate] => 2012-09-13 12:02:01
[createdBy._filename] =>
[createdBy._link] => javascript:alert('Set Detail Page Url for this section in: Admin > Section Editors > Viewer Urls')
)

Re: [design9] Excluding certain content/list

By design9 - September 13, 2012

I have attached the code above in this post. I have the following tables:

Header_small_images table:
Title field
Image upload field

Then in my about table:
title field
header field - this is a list field that is using get options from database -advanced
values are num
labels are title
blog_title field
content field

Re: [design9] Excluding certain content/list

By gregThomas - September 13, 2012 - edited: September 13, 2012

Hi April,

Thank you for posting the array output. I think I have fixed both of the issues. I've re-attached the php file you posted earlier with the fixes in.

Instead of using a where statement to filter out the header labels I've used the in_array php function to search for the daily post instead. If it finds it, it will skip over that iteration of the foreach loop.

The second problem with the blog_title and content not displaying was caused by two of the foreach loops using $record in the as statement, and the second foreach loop was overwriting the content of the first. I've changed the names of the as statement to $about and $header_image.

Thanks
Greg Thomas







PHP Programmer - interactivetools.com
Attachments:

indexap_001.php 2K

Re: [greg] Excluding certain content/list

By design9 - September 13, 2012

Thank you so much!

April

Re: [design9] Excluding certain content/list

By design9 - September 13, 2012

Coding is perfect...exactly what I needed!!!

One other question. What would I need to add to the coding if I wanted to exclude one additional category? Ex: I want to exclude The Daily Post and Momsense for example.

Thanks!
April