Linking to specific blog posts

5 posts by 2 authors in: Forums > CMS Builder
Last Post: March 1, 2010   (RSS)

By wadeos - February 24, 2010

Hi,

Not too sure if this has been mentioned yet but if someone could point me to a similar post or help would be good.

I am designing a blog with CMSB, I have the list page/detail page down the left column and I want to have a right hand column which shows up on each page with the Authors listed and a link from each authors name to a page which lists just their posts . . . .

AUTHORS
Author 1 [link to Author 1 blogs listings]
Author 2 [link to Auther 2 blogs listings]
Author 3 [link to Author 3 blogs listings]
etc

Sorry I am still relatively new with this so it may be something simple but can't seem to figure it out.

Cheers

Re: [wadeos] Linking to specific blog posts

By Damon - February 24, 2010

Hi,

Do you have an Author section setup in CMS Builder or are you using User Accounts for authors?

Can you post the code you have so far so I can take a look?
Cheers,
Damon Edis - interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

Re: [Damon] Linking to specific blog posts

By wadeos - February 24, 2010

Hi Damon,

I have created a blog in section editor and within that blog have created a list field with all the Authors names. So when they add a new entry they just click on the drop down list and pick their name.


<?php header('Content-type: text/html; charset=utf-8'); ?>
<?php

require_once "/home/nzph/public_html/cmsAdmin/lib/viewer_functions.php";

list($ridersblogRecords, $ridersblogMetaData) = getRecords(array(
'tableName' => 'ridersblog',
'perPage' => '7',
));

?>
<?php
function maxWords($textOrHtml, $maxWords) {
$text = strip_tags($textOrHtml);
$words = preg_split("/\s+/", $text, $maxWords+1);
if (count($words) > $maxWords) { unset($words[$maxWords]); }
$output = join(' ', $words);

return $output;
}
?>

<!-- blog left column -->
<div id="LC_blog">

<!-- STEP2: Display Records (Paste this where you want your records to be listed) -->
<h1>Rider's Blog</h1>
<?php foreach ($ridersblogRecords as $record): ?>
<p span class="headline_blog"><a href="<?php echo $record['_link'] ?>"><?php echo $record['title'] ?></a></span>
<p><?php echo date("D, M jS, Y g:i:s a", strtotime($record['date'])) ?></p>
<p><?php echo $record['author'] ?></p>

<!-- For date formatting codes see: http://www.php.net/date -->
<p><?php echo maxWords($record['content'], 100); ?> . . . <a href="<?php echo $record['_link'] ?>">Read More</a></p>

<br/>


<hr size="1" noshade="noshade"/>
<?php endforeach; ?>

<?php if ($ridersblogMetaData['invalidPageNum']): ?>
Results page '<?php echo $ridersblogMetaData['page']?>' not found, <a href="<?php echo $ridersblogMetaData['firstPageLink'] ?>">start over &gt;&gt;</a>.<br/><br/>
<?php elseif (!$ridersblogRecords): ?>
No records were found!<br/><br/>
<?php endif ?>
<!-- /STEP2: Display Records -->


<!-- STEP3: Display Page Links (Paste anywhere below "Load Record List") -->
<?php if ($ridersblogMetaData['prevPage']): ?>
<a href="<?php echo $ridersblogMetaData['prevPageLink'] ?>">&lt;&lt; prev</a>
<?php else: ?>
&lt;&lt; prev
<?php endif ?>

- page <?php echo $ridersblogMetaData['page'] ?> of <?php echo $ridersblogMetaData['totalPages'] ?> -

<?php if ($ridersblogMetaData['nextPage']): ?>
<a href="<?php echo $ridersblogMetaData['nextPageLink'] ?>">next &gt;&gt;</a>
<?php else: ?>
next &gt;&gt;
<?php endif ?>
<!-- /STEP3: Display Page Links -->
</div>
<!-- end blog left column -->

<!-- blog right column -->
<div id="RC_blog">
<p span class="rightcol_title">AUTHORS</span>
<p>View blogs by Author
<a href="#">Author 1</a><br />
<a href="#">Author 2</a><br />
<a href="#">Author 3</a><br />
<a href="#">Author 4</a><br />
</p>

</div>
<!-- end blog right column -->

Re: [Damon] Linking to specific blog posts

By wadeos - March 1, 2010

Thanks Damon, will have a go and get back to you if I get stuck.