Page 2 of 2
Re: smarty error if I call deleted news category?
Posted: Wed Apr 25, 2012 4:19 pm
by ladyr0gue
Jo Morg wrote:ladyr0gue wrote:Still a bit confused as to why my 404 or 401 page doesn't display if someone was to click on a link to an old category that wasn't redirected.
I'm willing to bet that it should display a 404, as it is supposed to be the default behavior of CMSMS when a link points to any nonexistent content (I mean the Smarty errors are not a typical 'page does not exist' error). Still looks like a bug to me.

Sorry to ask a probably silly question but by 'bug' do you mean something thats up with my install/config or something thats up with the version? as this is just a test site, when it's ready I will be installing cmsms on a live server and transferring the backup - do you think that it would happen on that?
Re: smarty error if I call deleted news category?
Posted: Wed Apr 25, 2012 4:39 pm
by Jo Morg
Bug as in
module has a bug. At least that is what it seems. If I'm right, odds are that it will behave the same way on a live site.
As a side note, I'm still transitioning from PC applications software programming to web programming (more specifically in PHP), so there are things I'm still not sure of.
However, if you have been using the default News templates and still gives that particular error, doesn't seem that it was designed to be that way.
Re: smarty error if I call deleted news category?
Posted: Wed Apr 25, 2012 5:33 pm
by calguy1000
First off... lets get some vocabulary straight wrt News (and most other modules). If you get the vocabulary straight it results in alot less confusion, and the people that are willing to assist will be able to do so faster.
A 'category' is just that, a way of organizing articles. In news, 'categories' are hierarchical and n article can only belong in one spot in the 'category tree'. You can display a summary view all of the articles within a certain position in the category tree by calling {news category='foo'}.
A summary view is intended to be a brief summary of all of the items that match the criteria you have specified. i.e.: possibly the items that belong to a category. From a summary view you can normally link to a 'detail view' for an individual item.
A detail view is intended to contain a detailed report or view of an individual item.
Many of the other modules have similar functions, but may behave, or be entitled differently. It is important to use the correct terminology for the module.
Now that that problem is out of the way... the issue we are talking about in this thread is 'the behavior of the news module when an invalid url to a news detail view is supplied. i.e: the user browses to some URL that either used to be valid, or never was... but matches a valid news route.
FYI: a 'route' is a programmatic thing that says (overly simplified) 'when the url requested on the website matches this pattern, do this'. News, and many other modules register numerous routes to enact many different behaviors. News registers a few routes intended to display detail views of specified articles (it registers others too, but those are ancillary to this discussion).
Now... for some details.
The route in question simply says if the url looks like news/<an integer>/<an integer>/<some text> to do the following (simplified):
a: assume we are calling the news module and want a detail view.
b: assume that the first integer is a news article id.
c: assume that the second integer is a page id
d: ignore the remaining text, as it is only for SEO purposes, and News does not enforce that article titles be unique.
e: ensure the page id specified is valid
-- if it is not, a 404 WILL be generated.
f: Set some internal variables
- module: News, action: detail, articleid = (from b)
g: start rendering the page.
Now... when the {content} block of the page template that is attached to the pageid specified in c: is executed, it will
i: detect those special variables from f:
ii: call the appropriate module and action, in this case News, with the rest of the applicable data from f:
Now we're finally at the news module.... and this is where things get technical.
- The news module will attempt to read the article from the database. It does not know yet if the article is invalid or expired, or some other difficulty (permissions maybe) that would cause the article not to be displayed to this site visitor.
- Assuming that the article is invalid (or expired) etc. at this time it 'should' exit... and either display a meaningful error message, or nothing. THIS is where I believe there may be a bug.
- In CMSMS 1.10.3 there is no convenient way for the news module to generate a 404 error. It has no choice but to just 'return'. I've already fixed this issue for CMSMS 1.11.
Re: smarty error if I call deleted news category?
Posted: Wed Apr 25, 2012 6:44 pm
by ladyr0gue
Thanks so much for your replies - and Calguy that post must have taken you ages! It's really appreciated as I am still very much a learner. Thank you for explaining so clearly about the vocabulary and the way the url is created. I got the article/page id confused and thought it was category id/article id - that all makes more sense now.
I won't worry about it for now anyway, and I'm glad to find out that this error isn't caused by something I've managed to break my end
