[solved] News module: broken return to homepage

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
luya
Forum Members
Forum Members
Posts: 91
Joined: Wed Jan 23, 2013 1:34 am

[solved] News module: broken return to homepage

Post by luya »

Greetings,
I have encountered an issue with the news module. After applying {news} on home page and selected the article, the layout broke only to display text mode. Here is the code I used inside summary_news templated based on Simplex.

Code: Select all

{strip}

<!-- .news-summary wrapper -->
<article class='news-summary'>
<span class='heading'><span>News</span></span>
        <ul class='category-list cf'>
        {foreach from=$cats item='node'}
        {if $node.depth > $node.prevdepth}
            {repeat string='<ul>' times=$node.depth-$node.prevdepth}
        {elseif $node.depth < $node.prevdepth}
            {repeat string='</li></ul>' times=$node.prevdepth-$node.depth}
            </li>
            {elseif $node.index > 0}</li>
            {/if}
            <li{if $node.index == 0} class='first'{/if}>
        {if $node.count > 0}
                <a href='{$node.url}'>{$node.news_category_name}</a>{else}<span>{$node.news_category_name} </span>{/if}
        {/foreach}
        {repeat string='</li></ul>' times=$node.depth-1}</li>
        </ul>
    {foreach from=$items item='entry'}
    <!-- .news-article (wrapping each article) -->
    <section class='news-article'>
    <a href='{$entry->moreurl}' title='{$entry->title|cms_escape:htmlall}'>
        <header>
            {CGSmartImage filter_croptofit="256,180,c" quality='65' src="{$entry->file_location}/{$entry->fieldsbyname.Images->value}" alt="{$entry->title}"}
            <h2>{$entry->title|cms_escape}</h2>     
             <div class='meta cf'>
                <time class='date' datetime='{$entry->postdate|date_format:'%Y-%m-%d'}'>
                    <span class='day'> {$entry->postdate|date_format:'%d'} </span>
                    <span class='month'> {$entry->postdate|date_format:'%b'} </span>
                </time>
                <span class='author'> {$author_label} {$entry->author} </span>
                <span class='category'> {$category_label} {$entry->category}</span>
            </div>
        </header>
        {if $entry->summary}
            <p>{eval var=$entry->summary|strip_tags}</p>
            <span class='more'>{$entry->morelink} →</span>
        {else if $entry->content}
            <p>{eval var=$entry->content|strip_tags}</p>
        {/if}
    </a></section>
    <!-- .news-article //-->
    {/foreach}
        <!-- news pagination -->
        {if $pagecount > 1}
        <span class='paginate'>
            {if $pagenumber > 1}
                {$firstpage} {$prevpage}
            {/if}
                {$pagetext} {$pagenumber} {$oftext} {$pagecount}
            {if $pagenumber < $pagecount}
                {$nextpage} {$lastpage}
            {/if}
        </span>
        {/if}
</article>
<!-- .news-summary //-->

{/strip}
Inside the article (displayed link: ;http://localhost/~luya/cms/index.php/ne ... -test.html) the logo leading to the root page is now ;http://localhost/~luya/cms/index.php/news/3/60 instead of ;http://localhost/~luya/cms/. I think I encountered a bug. Does anyone know what happened?

Here is my current template layout

Code: Select all

{strip}
{process_pagedata} <!-- Adds page specific metadata to the page -->
{MleCMS action='init'}
{cms_lang_info assign='nls'}
{/strip}
    
<!doctype html>
<__html lang="{$nls->htmlarea()}"> 
<head>
<title>{title} | {sitename}</title> <!-- Title of the page | Site name from Global Settings -->
<meta name='viewport' content='initial-scale=1.0 maximum-scale=1.0 user-scalable=no' />
<meta name='HandheldFriendly' content='true' />
{metadata} <!-- Adds Global Metadata to the page -->
{cms_stylesheet} <!-- Adds attached stylesheets to the page -->
{* learning IE lower then Version 9 some html5 *}
	<!--[if lt IE 9]>
	<__script__ src="//html5shiv.googlecode.com/svn/trunk/html5.js"></__script>
	<![endif]-->   
</head>
    	 
</__body>
<header role="banner">
<div class="container centered">
<div class="ads">[..insert advertisment...]</div>
<hgroup>
<h1>
<a href='{root_url}' title='{sitename}'>
<img src='{uploads_url}/images/cwlogo-a.png' width='379' height='90' alt='{sitename}' />
</a>
</h1><!-- .logo //-->
 <!-- Site name from Global Settings -->
<p>For the Woman of Success, Style & Substance</p>
</hgroup>
 </div>
</header>
     
<nav role="navigation">
{menu number_of_levels="1"} <!-- Show all the menu buttons -->
</nav>
     
<div id="main-content" class="container centered"> 
<section id="content">
<!-- h2>{title}</h2 --> <!-- Title of the page -->
<article role="main">
{content} <!-- Page content -->
</article><!-- end [role="main"] -->

</section>
     
<aside>
{content block=second_content label="My second content block"} <!-- Create a second content block -->
{global_content name='social-network'}
{global_content name='videoclip'}
</aside>
</div> <!-- end #main-content -->
     
<footer>
<div class="container centered">
{global_content name="footer"} <!-- Extract all footer code to a global content block -->
</div>
</footer>
<__body>
</__html>
Last edited by luya on Fri Feb 22, 2013 3:03 am, edited 1 time in total.
luya
Forum Members
Forum Members
Posts: 91
Joined: Wed Jan 23, 2013 1:34 am

Re: News module: broken return to homepage

Post by luya »

Here is a screenshot of rendering issue after clicking an article from news module
Attachments
Rendering bug after selecting an article. The page somehow refused to use css.
Rendering bug after selecting an article. The page somehow refused to use css.
User avatar
manuel
Power Poster
Power Poster
Posts: 353
Joined: Fri Nov 30, 2007 9:15 am

Re: News module: broken return to homepage

Post by manuel »

Dear Luya,
Here is my current template layout
I can't see any {news} tag in this template?

If you are showing the news detail on a specific page, verify that page has stylesheets associated with it.

I don't know if you are using template inheritance, but every template needs it's own associated stylesheets. They are not inherited from the main stylesheet.

Greetings,
Manuel
Do you like your open source cms? Buy from the CMSMS partners || Donate
luya
Forum Members
Forum Members
Posts: 91
Joined: Wed Jan 23, 2013 1:34 am

Re: News module: broken return to homepage

Post by luya »

Hi Manuel,
The {news} tag is located on the home page associated with the template.
See the pictures.
Attachments
Layout css
Layout css
Template selected for home page
Template selected for home page
{news} tag in home page
{news} tag in home page
User avatar
Dr.CSS
Moderator
Moderator
Posts: 12709
Joined: Thu Mar 09, 2006 5:32 am
Location: Arizona

Re: News module: broken return to homepage

Post by Dr.CSS »

Do you actually have a page called News, look at the page source to see if the paths/links to the CSS is correct...
User avatar
manuel
Power Poster
Power Poster
Posts: 353
Joined: Fri Nov 30, 2007 9:15 am

Re: News module: broken return to homepage

Post by manuel »

Dear Luya,

As Mark said: Please verify the presence of the stylesheets for the page without the styles :)
As you have specified the detailpage to be "news", that's the page you need to check. (does it exist & what template/stylesheets are being used for that page)

Greetings,
Manuel
Do you like your open source cms? Buy from the CMSMS partners || Donate
luya
Forum Members
Forum Members
Posts: 91
Joined: Wed Jan 23, 2013 1:34 am

Re: News module: broken return to homepage

Post by luya »

Dr.CSS and Manuel:
News page is already created attached with the template (Diversity in this case), there is currently no content other than commented tag. Do I need to add a news tag inside new page too?

Greetings,
Luya
Attachments
News page option
News page option
News page Main
News page Main
News page highlighted with attached template
News page highlighted with attached template
User avatar
Dr.CSS
Moderator
Moderator
Posts: 12709
Joined: Thu Mar 09, 2006 5:32 am
Location: Arizona

Re: News module: broken return to homepage

Post by Dr.CSS »

You don't really need the {news} tag on that page but most do put it there as it is a News page, but if you hide it from the menu and have nothing in it except the <!-- comment --> it should work fine...
User avatar
manuel
Power Poster
Power Poster
Posts: 353
Joined: Fri Nov 30, 2007 9:15 am

Re: News module: broken return to homepage

Post by manuel »

Dear Luya,
The index.php should indeed not be present in the URL.
Please verify that you have set up Pretty URL's correctly:

In the config:

Code: Select all

$config['url_rewriting'] = 'mod_rewrite';
+ use the contents of the "doc/htaccess.txt" file for your .htaccess file
(don't forget to change "RewriteBase /")

Also try manually visiting the "http://localhost/~luya/cms/news/3/60/Another-test.html" URL

Greetings,
Manuel
Do you like your open source cms? Buy from the CMSMS partners || Donate
luya
Forum Members
Forum Members
Posts: 91
Joined: Wed Jan 23, 2013 1:34 am

Re: News module: broken return to homepage

Post by luya »

Thanks for the clarification, Dr.CSS.
Manuel,
The config.php now uses

Code: Select all

$config['url_rewriting'] = 'mod_rewrite';
Unfortunately, once mod_rewrite is enabled, the page returns to not-found. Looking at the preview page inside news article, here is the traceback.

Code: Select all

#0 /home/luya/public_html/cms/lib/classes/class.Smarty_CMS.php(324): Smarty_Internal_TemplateBase->fetch('string:?<base h...', 'p60', NULL, NULL, false, false, false)
#1 /home/luya/public_html/cms/plugins/function.metadata.php(63): Smarty_CMS->fetch('string:?<base h...')
#2 /home/luya/public_html/cms/tmp/templates_c/931e1e9eac676a7613090088c9d8b4df6c1f1c50.tpl_head.24.php(32): smarty_function_metadata(Array, Object(Smarty_Internal_Template))
#3 /home/luya/public_html/cms/lib/smarty/sysplugins/smarty_internal_templatebase.php(180): content_510baac193da29_96759361(Object(Smarty_Internal_Template))
#4 /home/luya/public_html/cms/lib/classes/class.Smarty_CMS.php(324): Smarty_Internal_TemplateBase->fetch('tpl_head:24', 'p60', NULL, NULL, false, false, false)
#5 /home/luya/public_html/cms/index.php(239): Smarty_CMS->fetch('tpl_head:24')
#6 {main}
Here is the message (see also attached picture)

Code: Select all

Invalid compiled template for 'string:
<base href="http://localhost/~luya/cms/" />
<meta name="Generator" content="CMS Made Simple - Copyright (C) 2004-12 Ted Kulp. All rights reserved." />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
 
{* Add code here that should appear in the metadata section of all new pages *}'
Attachments
Preview mode from news article showed error coming from
Preview mode from news article showed error coming from
Not found after mod_rewrite enabled
Not found after mod_rewrite enabled
News summary test
News summary test
luya
Forum Members
Forum Members
Posts: 91
Joined: Wed Jan 23, 2013 1:34 am

Re: News module: broken return to homepage

Post by luya »

The issue turned out to be local server related from my laptop as I uploaded CMSMS into the server displaying no issue. For now I set this post as solved until the problem occurs.
User avatar
Dr.CSS
Moderator
Moderator
Posts: 12709
Joined: Thu Mar 09, 2006 5:32 am
Location: Arizona

Re: [solved] News module: broken return to homepage

Post by Dr.CSS »

If you are trying pretty URLs on an xampp type install where the link is localhost/somefolder you need to use the RewriteBase /somefolder in htaccess...

In your case RewriteBase /~luya/cms/
luya
Forum Members
Forum Members
Posts: 91
Joined: Wed Jan 23, 2013 1:34 am

Re: [solved] News module: broken return to homepage

Post by luya »

Greatly noted! =)
Post Reply

Return to “CMSMS Core”