 |

bruno
User
Nov 17, 2008, 1:39 PM
Post #1 of 6
(640 views)
Shortcut
|
|
Blog posts and news items on homepage?
|
Can't Post
|
|
Hello, Newbie with this CMS here - trying to figure out how to get articles or blogs to show up on a homepage with news items in a sidebar. http://tinymouse.biz/cmstest/index-blog.php Ive been able to get news items on a page, and blog or articles on a page, but not together. I know there must be some simple way to do this. All I am doing is using the generated code and placing it in my pages. Thanks!
|
|
|  |
 |

Dave
Staff
/ Moderator

Nov 17, 2008, 2:27 PM
Post #2 of 6
(637 views)
Shortcut
|
|
Re: [bruno] Blog posts and news items on homepage?
[In reply to]
|
Can't Post
|
|
Hi Bruno, Typically you just copy and paste multiple blocks of viewer code where you want them to appear. It looks like something isn't quite in the right place, though. Can you attach the index-blog.php file to this post so we can see the code? Then I can take you look and give some suggestions. Dave Edis - Senior Developer interactivetools.com
|
|
|  |
 |

bruno
User
Nov 18, 2008, 11:50 AM
Post #3 of 6
(629 views)
Shortcut
|
|
Re: [Dave] Blog posts and news items on homepage?
[In reply to]
|
Can't Post
|
|
Thanks Dave, I think im basically trying to have two lists - news and blog posts/articles show up on the same page. Could it be that both blocks of user code need to be at the top of the document? or do i need to combine these in some day? <?php /* STEP 1: LOAD RECORDS - Copy this PHP code block to the TOP of your page BEFORE anything else. */ require_once "/nfs/c01/h04/mnt/44900/domains/tinymouse.biz/html/cmsAdmin/lib/viewer_functions.php"; list($newsRecords, $newsMetaData) = getRecords(array( 'tableName' => 'news', )); ?> and this: <?php /* STEP 1: LOAD RECORDS - Copy this PHP code block to the TOP of your page BEFORE anything else. */ require_once "/nfs/c01/h04/mnt/44900/domains/tinymouse.biz/html/cmsAdmin/lib/viewer_functions.php"; list($blogRecords, $blogMetaData) = getRecords(array( 'tableName' => 'blog', )); ?>
|
|
Attachments:
|
index-blog.php
(12.3 KB)
|
|
|  |
 |

bruno
User
Nov 18, 2008, 12:02 PM
Post #4 of 6
(625 views)
Shortcut
|
|
Re: [bruno] Blog posts and news items on homepage?
[In reply to]
|
Can't Post
|
|
I think to further clarify im trying to combine a news list page and a blog list page
|
|
|  |
 |

bruno
User
Nov 18, 2008, 12:27 PM
Post #5 of 6
(622 views)
Shortcut
|
|
Re: [bruno] Blog posts and news items on homepage?
[In reply to]
|
Can't Post
|
|
Actually I got this to work by placing the step1 code inside of each divL <?php /* STEP 1: LOAD RECORDS - Copy this PHP code block to the TOP of your page BEFORE anything else. */ require_once "/nfs/c01/h04/mnt/44900/domains/tinymouse.biz/html/cmsAdmin/lib/viewer_functions.php"; list($newsRecords, $newsMetaData) = getRecords(array( 'tableName' => 'news', )); ?> It seems that this code does not need to be at the top of the page. Is this correct? http://tinymouse.biz/cmstest/listTest.php
|
|
|  |
 |

Dave
Staff
/ Moderator

Nov 18, 2008, 12:51 PM
Post #6 of 6
(619 views)
Shortcut
|
|
Re: [bruno] Blog posts and news items on homepage?
[In reply to]
|
Can't Post
|
|
Hi Bruno, Glad you got it working. No, the code doesn't need to be at the top of the page, you can have it anywhere as long as it's before the spot where you display the content that you were loading. You can also combine it at the top like this:
<?php /* STEP 1: LOAD RECORDS - Copy this PHP code block to the TOP of your page BEFORE anything else. */ require_once "/nfs/c01/h04/mnt/44900/domains/tinymouse.biz/html/cmsAdmin/lib/viewer_functions.php"; list($newsRecords, $newsMetaData) = getRecords(array( 'tableName' => 'news', )); list($blogRecords, $blogMetaData) = getRecords(array( 'tableName' => 'blog', )); ?> This creates two variables: $newsRecords and $blogRecords that have lists of records that you can display with a foreach loop. The reason the index-blog.php page had error was because you didn't have a foreach loop around the part that displayed the record values. Anytime you want to display a list of records you need to use a foreach loop that looks something like this:
<?php foreach ($newsRecords as $record): ?> <h2><?php echo $record['title'] ?></h2> ... <?php endforeach ?> Hope that helps! Dave Edis - Senior Developer interactivetools.com
|
|
|  |
 | |  |
|