Problems with News and Search page

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.
Post Reply
Kristian
Forum Members
Forum Members
Posts: 12
Joined: Wed Sep 08, 2010 4:46 pm

Problems with News and Search page

Post 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.
lewishowles
Forum Members
Forum Members
Posts: 52
Joined: Tue Oct 25, 2011 4:45 pm

Re: Problems with News and Search page

Post 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

Code: Select all

{get_template_vars}
for good measure.
Kristian
Forum Members
Forum Members
Posts: 12
Joined: Wed Sep 08, 2010 4:46 pm

Re: Problems with News and Search page

Post 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.
lewishowles
Forum Members
Forum Members
Posts: 52
Joined: Tue Oct 25, 2011 4:45 pm

Re: Problems with News and Search page

Post by lewishowles »

Did you put the debug line inside your news detail template?

Try putting {get_template_vars} inside there too.
Kristian
Forum Members
Forum Members
Posts: 12
Joined: Wed Sep 08, 2010 4:46 pm

Re: Problems with News and Search page

Post 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?
JohnnyB
Dev Team Member
Dev Team Member
Posts: 731
Joined: Tue Nov 21, 2006 5:05 pm

Re: Problems with News and Search page

Post 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
"The art of life lies in a constant readjustment to our surroundings." -Okakura Kakuzo

--
LinkedIn profile
--
I only speak/write in English so I may not translate well on International posts.
--
Kristian
Forum Members
Forum Members
Posts: 12
Joined: Wed Sep 08, 2010 4:46 pm

Re: Problems with News and Search page

Post 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.
JohnnyB
Dev Team Member
Dev Team Member
Posts: 731
Joined: Tue Nov 21, 2006 5:05 pm

Re: Problems with News and Search page

Post 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.
"The art of life lies in a constant readjustment to our surroundings." -Okakura Kakuzo

--
LinkedIn profile
--
I only speak/write in English so I may not translate well on International posts.
--
Post Reply

Return to “CMSMS Core”