Page 1 of 1
Problems with News and Search page
Posted: Wed Oct 07, 2015 5:49 pm
by Kristian
Hi,
I am running cmsms 2.0.
I have used the following code in my templates for news and search respectively:
Code: Select all
{News summarytemplate='Simplex News Summary' number='2' detailpage='news' detailtemplate='Simplex News Detail'}
Code: Select all
{Search|strip formtemplate='Simplex Search' resultpage='search' searchtext="Søg"}
I have then created two pages, one with news as alias and one with search as alias.
On the News page i have added the following code:
Code: Select all
{News detailtemplate='Simplex News Detail'}
(The Content Manager adds <p></p> around the code)
When I see a Preview of the page, it shows what I want to see: My news. And if I access the page directly (
http://xn--jordemoderhnder-7lb.dk/index.php?page=news) it shows the news as well.
However, when I press on the news in the News Summary or on More, then i get a blank page:
http://xn--jordemoderhnder-7lb.dk/index ... eturnid=49
As you can see, the URL it leads to is very long and completely different. However, it shows the same page, just without any news stories.
I have not yet figured out what code to use on the Search page, as it is also just blank when i search something.
Thank you in advance for your help.
Re: Problems with News and Search page
Posted: Mon Oct 12, 2015 9:39 am
by lewishowles
Just a tip on the <p></p> that's added around content (Magento does the same thing) - if you put your own <div></div> around it, it won't add the <p> - it's not ideal, but it's better than having a paragraph there, which can cause issues in templates.
The long url is because pretty URLs isn't turned on, and it's passing information to the page to tell it things like what page template to use, which module to load, whether or not to replace the main content area with the module and so forth. The reason it's showing the same page is the cntnt01returnid value at the end.
It's difficult to tell what's going on without access to the templates, but in situations like this what I'd normally do is debug the news detail template. Something like:
Code: Select all
<pre>{$entry|@debug_print_var:4:400}</pre>
If that shows null then something else is going wrong. You could also add
for good measure.
Re: Problems with News and Search page
Posted: Mon Oct 12, 2015 11:08 am
by Kristian
The debug thing returns a null.
And the template vars returns the following:
Code: Select all
$sitename (string) = Jordemoderhænder
$actionid (string) = m93a2b
$actionparams (array) = [
.detailtemplate (string) = Simplex News Detail
.module (string) = News
.action (string) = default
]
$returnid (string) = 49
$actionmodule (string) = News
$mod (object of type: News) = {}
$SCRIPT_NAME (string) = /index.php
$app_name (string) = callable$content_obj (object of type: Content) = {}
$content_id (string) = 49
$page_id (string) = news
$page_alias (string) = news
$lang (string) = da_DK
$encoding (string) = utf-8
It does not really tell me anything though.
Re: Problems with News and Search page
Posted: Mon Oct 12, 2015 3:54 pm
by lewishowles
Did you put the debug line inside your news detail template?
Try putting {get_template_vars} inside there too.
Re: Problems with News and Search page
Posted: Mon Oct 12, 2015 6:24 pm
by Kristian
I just tried adding both the debug and get template vars, which changed nothing. It still shows the same on the news page.
How do I turn on the smart URLS so that the more will link to the right page?
And how do i make the search show search results?
Re: Problems with News and Search page
Posted: Tue Oct 13, 2015 12:10 am
by JohnnyB
Set the Detail page preference in the News settings to your detail page.
Then, check what pretty url method you are using, if any and be sure that the config.php and htaccess files are correct for your chosen method.
See:
http://docs.cmsmadesimple.org/configura ... ews-module (Default page to use for detail views)
http://docs.cmsmadesimple.org/configuration/pretty-url
Re: Problems with News and Search page
Posted: Wed Oct 14, 2015 9:36 am
by Kristian
I already did set my the default search page to my news page.
When I add the extra lines of code to the config file, the URLS do change to Pretty-URLS. However, I am denied access.
When i copy the .htcaccess file into the root folder, I am not allowed access to the backend of the site.
I am running on a Linux server, so i followed the steps for an Apache server. I hope that is the same.
Re: Problems with News and Search page
Posted: Wed Oct 14, 2015 1:36 pm
by JohnnyB
There is a News setting to set the news detail page (not related to the search page).
Your config.php has to be writeable. Usually 0644 or 0664 will work.
What htaccess file did you copy? You should write your own. You can use the htaccess.txt example from the docs but each environment is different so you will need to test each set of rules separately. Start by only using the mod rewrite rules.