Page 1 of 1

<SOLVED> News returnid is wrong when deleting the example news (?)

Posted: Thu Dec 25, 2008 2:22 pm
by mannerv
I am using CMS Made Simple 1.5.1. My hosting is GoDaddy.

I have tried to enable pretty URL's using mod_rewrite as per these instructions: http://wiki.cmsmadesimple.org/index.php ... retty_URLs

This is my .htaccess file:

Code: Select all

ServerSignature Off
Options +FollowSymLinks
RewriteEngine On
RewriteBase /
 
# 301 Redirect all requests that don't contain a dot or trailing slash to
# include a trailing slash
# RewriteCond %{REQUEST_URI} !/$
# RewriteCond %{REQUEST_URI} !\.
# 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] 
This is the edited part of my config.php file:

Code: Select all

#------------
#URL Settings
#------------

#Show mod_rewrite URLs in the menu? You must enable 'use_hierarchy' for this to work for modules
$config['assume_mod_rewrite'] = true;

#Extension to use if you're using mod_rewrite for pretty URLs.
$config['page_extension'] = '.html';

#If you don't use mod_rewrite, then would you like to use the built-in
#pretty url mechanism?  This will not work with IIS and the {metadata} tag
#should be in all of your templates before enabling.
$config['internal_pretty_urls'] = false;

#If you're using the internal pretty url mechanism or mod_rewrite, would you like to
#show urls in their hierarchy?  (ex. http://www.mysite.com/parent/parent/childpage)
$config['use_hierarchy'] = true;

#If using none of the above options, what should we be using for the query string
#variable?  (ex. http://www.mysite.com/index.php?page=somecontent)
$config['query_var'] = 'page';
If I click on a news item, I get this error:
Content Encoding Error
The page you are trying to view cannot be shown because it uses an invalid or unsupported form of compression.
The page you are trying to view cannot be shown because it uses an invalid or unsupported form of compression.
    * Please contact the website owners to inform them of this problem.
You can try this live by going to http://www.tarkkamarkka.com and clicking on any news item.

Also, now I get the content encoding error instead of a 404 error everytime I ask the server for some file that does not exist.

(On a related note, the umlauts are converted so that a-umlaut becomes ae. It should normally become just an a without umlaut.)

Re: News module does not work with pretty URL's using mod_rewrite

Posted: Thu Dec 25, 2008 8:12 pm
by korpirkor
$config['output_compression'] = false; ?

Re: News module does not work with pretty URL's using mod_rewrite

Posted: Thu Dec 25, 2008 10:16 pm
by mannerv
Nope, wasn't that. config.php has output compression set to false. Any other ideas? :/

Re: News module does not work with pretty URL's using mod_rewrite

Posted: Thu Dec 25, 2008 10:22 pm
by mannerv
Okay, I changed config.php and .htaccess back to default settings and the News still don't work. Unless there is some server delay with the .htaccess modifications, there is something funky going on here.

This is the link I get for the news file now: http://www.tarkkamarkka.com/index.php?m ... eturnid=39

I think I have screwed up somewhere else...

Re: News module does not work with pretty URL's using mod_rewrite

Posted: Thu Dec 25, 2008 10:37 pm
by mannerv
Okay, if I try with this Web Sniffer thing, some function in that software crashes. I guess it has to do with Gzip. The response seems to be 404...

http://web-sniffer.net/?url=http%3A%2F% ... POST&uak=0

I wonder what on earth I have screwed up.

Re: News module does not work with pretty URL's using mod_rewrite

Posted: Thu Dec 25, 2008 10:47 pm
by mannerv
Okay. So, for some reason, the server wanted to give me a 404 that seemed to be compressed in some odd way.

So, I put on the custom 404 message feature and now the link for the news article:
http://www.tarkkamarkka.com/index.php?m ... eturnid=39
gives me the news article "as is". No site around it, just the news article.

What I get is this (html output from Web Sniffer):

Code: Select all

→ <div id="NewsPostDetailDate">[LF]
→ → Dec 23, 2008[LF]
→ </div>[LF]
<h3 id="NewsPostDetailTitle">Testiuutinen</h3>[LF]
[LF]
<hr id="NewsPostDetailHorizRule" />[LF]
[LF]
→ <div id="NewsPostDetailSummary">[LF]
→ → <strong>[LF]
→ → → Uutisen kooste.[LF]
→ → </strong>[LF]
→ </div>[LF]
[LF]
→ <div id="NewsPostDetailCategory">[LF]
→ → Category: General[LF]
→ </div>[LF]
→ <div id="NewsPostDetailAuthor">[LF]
→ → Posted by: administrator[LF]
→ </div>[LF]
[LF]
<div id="NewsPostDetailContent">[LF]
→ Uutinen itse.[LF]
</div>[LF]
[LF]
[LF]
<div id="NewsPostDetailPrintLink">[LF]
→ <a href="http://www.tarkkamarkka.com/index.php?mact=News,cntnt01,print,0&cntnt01articleid=2&cntnt01showtemplate=false&cntnt01returnid=39">Print</a>[LF]
</div>[LF]
<div id="NewsPostDetailReturnLink"><a href="http://www.tarkkamarkka.com/">Return</a></div>[LF]
[LF]
  <!-- 0.366805 / 11 / 5775536 / 6146464 -->[LF]
So, it seems to me that I have accidentally screwed up something somewhere that affects the default 404 message from CMSms and also the "styling" of the news.

Re: News module does not work with pretty URL's using mod_rewrite

Posted: Thu Dec 25, 2008 11:10 pm
by mannerv
Okay, I think I am on to something now. The link is:
http://www.tarkkamarkka.com/index.php?m ... eturnid=39

What is that returnid=39 doing there? For some reason, it seems to screwing things up for me.

If I manually type in this link:
http://www.tarkkamarkka.com/index.php?m ... eturnid=64
everything seems to work? What on earth is happening here...

I am getting an urge to get manually to my database and put the original news item back on there.

Also, I found someone who seems to have had the exact same problem as I have:
http://forum.cmsmadesimple.org/index.ph ... 186.0.html

I am getting too tired for tonight. If anyone gets some ideas, please help. I guess the solution might lie in the meaning of the returnid parameter.

Re: News returnid is wrong when deleting the example news (?)

Posted: Fri Dec 26, 2008 4:59 pm
by mannerv
I changed the topic to more accurately describe what I think is the problem here.

I am still at loss, so if anyone has any ideas, help is appreciated.

Re: News returnid is wrong when deleting the example news (?)

Posted: Sat Dec 27, 2008 4:27 pm
by mannerv
Well, finally I understood what is going on.

Once again the reason was that I did not fully understand how the templates work. I somehow assumed that if I make some page active, there would be some warning if that page is at use in the templates. No, there is no relation or binding there.

In the news module, origid is the id of the page at which you click on a news item. returnid is the id of the page where you will land after clicking on the news item.

So, I had deactivated all of the original pages, which resulted at first on this really weird compression error and after that to this other odd behaviour.

So, if this happens to you, make a new news page, name it something and make that the detail page of your news module at the template.

By default, in the template there is this:

Code: Select all

      <div id="news">
         <h2>News</h2>
          {news number='3' detailpage='news'}
      </div>
Here 'news' is the alias of the page named News.

So, if you want to translate like I did, make a new page and have a new alias. In Finnish, that would be Uutiset. Give that the alias uutiset and edit your template like this:

Code: Select all

      <div id="news">
         <h2>News</h2>
          {news number='3' detailpage='uutiset'}
      </div>