smarty error if I call deleted news category?

For questions and problems with the CMS core. This board is NOT for any 3rd party modules, addons, PHP scripts or anything NOT distributed with the CMS made simple package itself.
ladyr0gue
Forum Members
Forum Members
Posts: 91
Joined: Fri Feb 17, 2012 4:25 pm

smarty error if I call deleted news category?

Post by ladyr0gue »

I found this out completely by accident... I entered a url for an article which had been deleted, along with it's containing category.
(1.10.3)

(I have an existing article, "http://localhost/cmsms/news/1/66/Example.html and I have a custom error 404 set up which works fine everywhere else)

When I tried to navigate to "http://localhost/cmsms/news/2/55/Old-Article.html the NewsPostDetailContent produces the following rather ugly error:

Code: Select all

Posted by: Anonymous
C:\xampp\htdocs\cmsms\lib\smarty\plugins\function.eval.php:25 - trigger_error
C:\xampp\htdocs\cmsms\tmp\templates_c\News^%%E8^E85^E85D59E8%%module_db_tpl%3ANews%3BdetailSample.php:46 - smarty_function_eval
C:\xampp\htdocs\cmsms\lib\smarty\Smarty.class.php:1263 - include
C:\xampp\htdocs\cmsms\lib\classes\module_support\modtemplates.inc.php:242 - fetch
C:\xampp\htdocs\cmsms\lib\classes\class.CMSModule.php:2438 - cms_module_ProcessTemplateFromDatabase
C:\xampp\htdocs\cmsms\modules\News\action.detail.php:63 - ProcessTemplateFromDatabase
C:\xampp\htdocs\cmsms\lib\classes\class.CMSModule.php:1583 - include
C:\xampp\htdocs\cmsms\modules\News\action.defaulturl.php:4 - DoAction
C:\xampp\htdocs\cmsms\lib\classes\class.CMSModule.php:1583 - include
C:\xampp\htdocs\cmsms\lib\classes\class.CMSModule.php:1628 - DoAction
C:\xampp\htdocs\cmsms\plugins\function.content.php:100 - DoActionBase
C:\xampp\htdocs\cmsms\tmp\templates_c\%%01^013^01360D26%%tpl_body%3A23.php:21 - smarty_cms_function_content
C:\xampp\htdocs\cmsms\lib\smarty\Smarty.class.php:1263 - include
C:\xampp\htdocs\cmsms\index.php:269 - fetch
string(43) "Smarty error: eval: missing 'var' parameter"
Return
If I try changing navigating to a valid url and just changing the first number, I get the same error only this time the page title is error 404.

I hope that this won't ever be a real problem but I just wondered if there's any way I could fix this? I suppose when the site goes live if a category was to get deleted one would redirect the articles to a different page, but what if somebody was to make a typo in their address bar? don't quite understand why it's not showing a normal 401 or 404.
Tried clearing site and browser cache but no change.
If anyone thinks they can advise but needs more info please let me know and I'll post code.
Last edited by ladyr0gue on Tue Apr 24, 2012 3:58 pm, edited 3 times in total.
ladyr0gue
Forum Members
Forum Members
Posts: 91
Joined: Fri Feb 17, 2012 4:25 pm

Re: smarty error if I call non-existing news category?

Post by ladyr0gue »

As far as I know there is nothing wrong with the news templates; I am using the default Sample templates for Summary, Detail and Category browse. The only modifications I have made is to put

Code: Select all

<h2 class="h21"><a href="{cms_selflink href='news'}">Latest News</a></h2>
at the top of the summary and

Code: Select all

<br />{CGFeedMaker action='rsslink' feed='news' text='RSS News Feed' image='uploads/images/rss.png' imageclass='rssImage' linkclass="rssLink"} 
at the bottom of the Detail template.

And there's something else I've noticed - when I try putting my CGFeedmaker tag into the category browse template it doesn't show up on the category 'page'. I wondered if this is all something to do with the way I have rewritten index.php pages thusly

Code: Select all

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)$ index.php?page=$1 [QSA]
# END CMSMS
- as the category url can't be prettified so starts /index.php?mact=News ... maybe this is causing issue somewhere?
User avatar
Jo Morg
Dev Team Member
Dev Team Member
Posts: 1973
Joined: Mon Jan 29, 2007 4:47 pm

Re: smarty error if I call deleted news category?

Post by Jo Morg »

ladyr0gue wrote:Tried clearing site and browser cache but no change.
Try clear CMSMS own cache (again? :) ). It seems that the temp file is still there. Otherwise it means that the cache file is being recreated, and that being the case, it may be a bug.
"There are 10 types of people in this world, those who understand binary... and those who don't."
* by the way: English is NOT my native language (sorry for any mistakes...).
Code of Condut | CMSMS Docs | Help Support CMSMS
My developer Page on the Forge
GeekMoot 2015 in Ghent, Belgium: I was there!
GeekMoot 2016 in Leicester, UK: I was there!
DevMoot 2023 in Cynwyd, Wales: I was there!
ladyr0gue
Forum Members
Forum Members
Posts: 91
Joined: Fri Feb 17, 2012 4:25 pm

Re: smarty error if I call deleted news category?

Post by ladyr0gue »

I tried again but no difference... :*(
User avatar
Jo Morg
Dev Team Member
Dev Team Member
Posts: 1973
Joined: Mon Jan 29, 2007 4:47 pm

Re: smarty error if I call deleted news category?

Post by Jo Morg »

Just to narrow it down a bit, comment the lines you added:
(like this)

Code: Select all

<h2 class="h21"><a href="{* cms_selflink href='news' *}">Latest News</a></h2>
and

Code: Select all

<br />{* CGFeedMaker action='rsslink' feed='news' text='RSS News Feed' image='uploads/images/rss.png' imageclass='rssImage' linkclass="rssLink" *} 
to see if the error persists. It may be a syntax error....
"There are 10 types of people in this world, those who understand binary... and those who don't."
* by the way: English is NOT my native language (sorry for any mistakes...).
Code of Condut | CMSMS Docs | Help Support CMSMS
My developer Page on the Forge
GeekMoot 2015 in Ghent, Belgium: I was there!
GeekMoot 2016 in Leicester, UK: I was there!
DevMoot 2023 in Cynwyd, Wales: I was there!
ladyr0gue
Forum Members
Forum Members
Posts: 91
Joined: Fri Feb 17, 2012 4:25 pm

Re: smarty error if I call deleted news category?

Post by ladyr0gue »

nope - did as you suggested and cleared cmsms cache - still the same error replicated with various versions on the same theme.
User avatar
Jo Morg
Dev Team Member
Dev Team Member
Posts: 1973
Joined: Mon Jan 29, 2007 4:47 pm

Re: smarty error if I call deleted news category?

Post by Jo Morg »

And, just to make sure I understood correctly, this is when you use directly this url: "http://localhost/cmsms/news/2/55/Old-Article.html", which points to an article that shouldn't even exist ('cause it was deleted)?
"There are 10 types of people in this world, those who understand binary... and those who don't."
* by the way: English is NOT my native language (sorry for any mistakes...).
Code of Condut | CMSMS Docs | Help Support CMSMS
My developer Page on the Forge
GeekMoot 2015 in Ghent, Belgium: I was there!
GeekMoot 2016 in Leicester, UK: I was there!
DevMoot 2023 in Cynwyd, Wales: I was there!
ladyr0gue
Forum Members
Forum Members
Posts: 91
Joined: Fri Feb 17, 2012 4:25 pm

Re: smarty error if I call deleted news category?

Post by ladyr0gue »

Jo Morg wrote:And, just to make sure I understood correctly, this is when you use directly this url: "http://localhost/cmsms/news/2/55/Old-Article.html", which points to an article that shouldn't even exist ('cause it was deleted)?
Yes, in fact "http://localhost/cmsms/news/2/55/Old-Article.html never existed, it's just an example of course but that url still triggers the error, the problem lies with the first number (2) being a category does not exists. Same if I try any other number that points to a non-existing category. It's different if I change the article id (55) to say, 99, and have 1 as the category (1 exists) this fake url sends me to the detail view of the first article in that category with Error 404 as the title. Well thats fine - but the smarty error worries me!
User avatar
Jo Morg
Dev Team Member
Dev Team Member
Posts: 1973
Joined: Mon Jan 29, 2007 4:47 pm

Re: smarty error if I call deleted news category?

Post by Jo Morg »

I may very well be wrong, but... It does seem to be a bug.
"There are 10 types of people in this world, those who understand binary... and those who don't."
* by the way: English is NOT my native language (sorry for any mistakes...).
Code of Condut | CMSMS Docs | Help Support CMSMS
My developer Page on the Forge
GeekMoot 2015 in Ghent, Belgium: I was there!
GeekMoot 2016 in Leicester, UK: I was there!
DevMoot 2023 in Cynwyd, Wales: I was there!
ladyr0gue
Forum Members
Forum Members
Posts: 91
Joined: Fri Feb 17, 2012 4:25 pm

Re: smarty error if I call deleted news category?

Post by ladyr0gue »

eep. is there anything I can do about that? does anyone else have this bug or am I special? thanks for your time btw it's appreciated :)
User avatar
Dr.CSS
Moderator
Moderator
Posts: 12711
Joined: Thu Mar 09, 2006 5:32 am

Re: smarty error if I call deleted news category?

Post by Dr.CSS »

First, no one is going to guess URLs for News, second you can't expect smarty to do anything other than tell you what you are looking for doesn't exist...
ladyr0gue
Forum Members
Forum Members
Posts: 91
Joined: Fri Feb 17, 2012 4:25 pm

Re: smarty error if I call deleted news category?

Post by ladyr0gue »

Dr.CSS wrote:First, no one is going to guess URLs for News, second you can't expect smarty to do anything other than tell you what you are looking for doesn't exist...
well yes you are right, I suppose :) thanks - I guess I just thought that it may be a problem in the future if a category got deleted rather than replaced and if a website user had stored the url in their browser they would then get this smarty error if I had failed to 301 redirect the old pages. Guess they're some pretty big ifs ;)

I was rather hoping for my custom error page to come up - but at least the smarty error appears within the page template so the user can just navigate away from that page without too much trouble.
ladyr0gue
Forum Members
Forum Members
Posts: 91
Joined: Fri Feb 17, 2012 4:25 pm

Re: smarty error if I call deleted news category?

Post by ladyr0gue »

You know, I don't think my category browse template affects anything. I just tried adding <h1> tags, rss feed link tags to it in all sorts of silly places - deleting parts of it and then all of it and nothing I did made a difference to anything. I wonder if this is a piece of the puzzle....
ladyr0gue
Forum Members
Forum Members
Posts: 91
Joined: Fri Feb 17, 2012 4:25 pm

Re: smarty error if I call deleted news category?

Post by ladyr0gue »

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 just read this topic Trigger Error instead of 404 Error? where JackOutoftheBox has noticed similar issue http://forum.cmsmadesimple.org/viewtopic.php?t=58681 and found this reply from Dr.CSS -
http://forum.cmsmadesimple.org/viewtopi ... 84#p269184
Dr.CSS wrote:Almost looks like it is trying to pull the old page, have you cleared your site cache in admin, maybe even going to site, FTP or server file manager, and deleting all files from tmp/cache and tmp/templates_c, except the dummy index.html files...
well I did tried that too, deleting all but the index.html files - but no matter what, calling a category that doesn't exist triggers the smarty error rather than a 404/401. And it doesn't look like the OP of that post ever figured this either. Would anyone have any idea if it's possible to tell this type of error to call an error page? Or am i just making a mountain out of a molehill.... :)
User avatar
Jo Morg
Dev Team Member
Dev Team Member
Posts: 1973
Joined: Mon Jan 29, 2007 4:47 pm

Re: smarty error if I call deleted news category?

Post by Jo Morg »

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.
8)
"There are 10 types of people in this world, those who understand binary... and those who don't."
* by the way: English is NOT my native language (sorry for any mistakes...).
Code of Condut | CMSMS Docs | Help Support CMSMS
My developer Page on the Forge
GeekMoot 2015 in Ghent, Belgium: I was there!
GeekMoot 2016 in Leicester, UK: I was there!
DevMoot 2023 in Cynwyd, Wales: I was there!
Post Reply

Return to “CMSMS Core”