in answer to a question here http://forum.cmsmadesimple.org/viewtopi ... 20&t=37978 about whether it was possible to make pretty urls for browsing between summary pages (like Page 1 of N etc.) Calguy1000 said
calguy1000 wrote:answer: no.
Once you add parameters like sort order, sorting field, page number, page limit, summary template, detail template (and other parameters that the news and other various modules support for customizing the output) to the url, no matter what you do, it won't be pretty. and besides, usually it's the detail view that's most important anyways... users don't generally care about how ugly the url is to access "the 4th page of all news articles (even expired ones) sorted by author in decending order with 5 items per page", using a different detail template.
News allows you numerous ways to organize the data, just by adding more calls to the module. Making the pagination urls 'pretty' would require removing that flexibility.
So Firstly and foremost - is it actually possible to make pretty the news category pages without creating an actual page for each new category, adding the news tag and setting it to only view that category, each time? As that would be inconvenient and complicated for the user....
If it is possible, I don't know what I'm doing wrong!
I'm running 1.10.3 on xampp
I tried to follow the instructions on the first post, reading very carefully. Here's what I've been trying...
I have the following in my config.php file
Code: Select all
<?php
# CMS Made Simple Configuration File
# Documentation: /doc/CMSMS_config_reference.pdf
#
$config['dbms'] = 'mysql';
$config['db_hostname'] = 'localhost';
$config['db_username'] = 'root';
$config['db_password'] = '';
$config['db_name'] = 'cms';
$config['db_prefix'] = 'cms_';
$config['db_port'] = 0;
$config['root_url'] = 'http://localhost/cmsms';
$config['timezone'] = 'Europe/Berlin';
$config['default_encoding'] = 'utf-8';
#------------
#URL Settings
#------------
$config['url_rewriting'] = 'mod_rewrite';
$config['use_hierarchy'] = true;
$config['query_var'] = 'page';
#Show mod_rewrite URLs in the menu?
$config['assume_mod_rewrite'] = true;
#Extension to use if you're using mod_rewrite for pretty URLs.
$config['page_extension'] = '.html';
$config['process_whole_template'] = false;
?>
Code: Select all
$name = preg_replace(array("/ /", "/[^A-Za-z0-9-\-]/", "/--/"),array("-", "", "-"),$params['name']);
$id = $params['id'];
echo 'blog/category/'.$id.'/'.$name.'.html';
Code: Select all
{if $count > 0}
<ul class="list1">
{foreach from=$cats item=node}
{if $node.depth > $node.prevdepth}
{repeat string="<ul>" times=$node.depth-$node.prevdepth}
{elseif $node.depth < $node.prevdepth}
{repeat string="</li></ul>" times=$node.prevdepth-$node.depth}
</li>
{elseif $node.index > 0}</li>
{/if}
<li class="newscategory">
{if $node.count > 0}
<a href="{news_category_url name=$node.news_category_name id=$node.news_category_id}">{$node.news_category_name}</a> ({$node.count}){else}<span>{$node.news_category_name} (0)</span>{/if}
{/foreach}
{repeat string="</li></ul>" times=$node.depth-1}</li>
</ul>
{/if}
Code: Select all
Options +FollowSymLinks
RewriteEngine on
RewriteBase /cmsms
RewriteCond %{HTTP_HOST} ^localhost$
RewriteRule ^news/category/([0-9]+)/(.+).html index.php?mact=News,cntnt01,default,0&cntnt01detailpage=3&cntnt01category_id=$1&cntnt01returnid=3 [NC,L]
# 301 Redirect all requests that don't contain a dot or trailing slash to
# include a trailing slash
# except for form POSTS
# RewriteCond %{REQUEST_URI} !/$
# RewriteCond %{REQUEST_URI} !\.
# RewriteCond %{REQUEST_METHOD} !POST$
# RewriteRule ^(.*) %{REQUEST_URI}/ [R=301,L]
# Rewrites urls in the form of /parent/child/
# but only rewrites if the requested URL is not a file or directory
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+).html$ index.php?page=$1 [QSA]