Previous/Next SEO optimized Url's
2 posts by 2 authors in: Forums > CMS Builder
Last Post: March 7, 2011 (RSS)
By videopixel - March 6, 2011 - edited: March 6, 2011
I have this code:
and this to show it:
it works like expected but i want SEO urls...
How do i get SEO optimized urls with that code (in folder format) (blog.php/article_title_with number/) ?
list($blogRecords, $blogMetaData) = getRecords(array(
'tableName' => 'blog',
'where' => whereRecordNumberInUrl(1) . ' AND status ="1"',
'limit' => '1',
'useSeoUrls' => true,
));
$blogRecord = @$blogRecords[0];
if (!$blogRecord) {
header("HTTP/1.0 404 Not Found");
print "Record not found!";
exit;
}
list($prevRecord, $nextRecord) = getPrevAndNextRecords(array(
'tableName' => 'blog',
'recordNum' => getNumberFromEndOfUrl(),
'where' => 'status = "1"',
'useSeoUrls' => true,
));
and this to show it:
<div>
<?php if (@$nextRecord): ?>
<div><a href="<?php echo $nextRecord['_link'] ?>">Previous blog</a></div>
<?php endif; ?>
<?php if (@$prevRecord): ?>
<div><a href="<?php echo $prevRecord['_link'] ?>">Next blog</a></div>
<?php endif; ?>
</div>
it works like expected but i want SEO urls...
How do i get SEO optimized urls with that code (in folder format) (blog.php/article_title_with number/) ?
Re: [videopixel] Previous/Next SEO optimized Url's
By Jason - March 7, 2011
Hi,
The function getPrevAndNextRecords() doesn't currently support the option 'useSeoUrls'
If you already now the format of the url that you want, you can produce the url manually like this:
Hope this helps
The function getPrevAndNextRecords() doesn't currently support the option 'useSeoUrls'
If you already now the format of the url that you want, you can produce the url manually like this:
<?php if (@$nextRecord): ?>
<?php
$url = "blog.php/". str_replace(" ", "-",$nextRecord['title']). "-". $nextRecord['num'];
?>
<div><a href="<?php echo $url?>">Previous blog</a></div>
<?php endif; ?>
Hope this helps
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com
Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/
Jason Sauchuk - Project Manager
interactivetools.com
Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/