Is there a way to show news summaries on the home page without creating a separate template for my home page? I've been looking all over for some sort of smarty syntax that will let me do some sort of "if pagealias equals home then show {news}" test.
Thanks,
Tim
Show news on home page without separate template for home page?
Re: Show news on home page without separate template for home page?
Are you meaning something like this
Code: Select all
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<__html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<!-- Change lang="en" to the language of your site -->
<head>
<title>{sitename} - {title}</title>
<!-- The sitename is changed in Site Admin/Global settings. {title} is the name of each page -->
{metadata}
<!-- Don't remove this! Metadata is entered in Site Admin/Global settings. -->
{stylesheet}
<!-- This is how all the stylesheets attached to this template are linked to -->
{cms_selflink dir="start" rellink=1}
{cms_selflink dir="prev" rellink=1}
{cms_selflink dir="next" rellink=1}
<!-- Relational links for interconnections between pages, good for accessibility and Search Engine Optmization -->
{literal}
<__script__ type="text/JavaScript">
<!--
//pass min and max -measured against window width
function P7_MinMaxW(a,b){
var nw="auto",w=document.documentElement.clientWidth;
if(w>=b){nw=b+"px";}if(w<=a){nw=a+"px";}return nw;
}
//-->
</__script>
<!--[if lte IE 6]>
<style type="text/css">
#pagewrapper {width:expression(P7_MinMaxW(720,950));}
#container {height: 1%;}
</style>
<![endif]-->
{/literal}
<!-- The min and max page width for Internet Explorer is set here. For other browsers it's in the stylesheet "Layout: Left sidebar + 1 column" -->
<!--[if IE]>
<__script__ type="text/javascript" src="modules/MenuManager/CSSMenu.js"></__script>
<![endif]-->
<!-- The above JavaScript is required for CSSMenu to work in IE -->
</head>
</__body>
<div id="pagewrapper">
<!-- Start Content (Navigation and Content columns) -->
<div id="content">
{news'}
</div>
<!-- End Content -->
</div><!-- end pagewrapper -->
<__body>
</__html>
Re: Show news on home page without separate template for home page?
No, I was thinking like this (pardon the PHP syntax, I don't smarty all that well):
Code: Select all
<!-- Start Content (Navigation and Content columns) -->
<div id="content">
{content}
if($pagealias = 'Home') {
{news number="3" category="General"}
}
</div>
<!-- End Content -->
Re: Show news on home page without separate template for home page?
I guess I should have said why I'm looking to do this...I want to be able to export the theme. Therefore, I want everything in one template. Perhaps that doesn't matter.
Tim
Tim
-
- Support Guru
- Posts: 8169
- Joined: Tue Oct 19, 2004 6:44 pm
Re: Show news on home page without separate template for home page?
I think you're missing the point of templates and content.
If something is only to be on one page, then it falls under content, and you'd put the news tag in the Home page only. If you want something on every page, then you'd put it in the template.
If I was receiving a theme from somebody that had hard coded things in it like this, I might be a little miffed.
If something is only to be on one page, then it falls under content, and you'd put the news tag in the Home page only. If you want something on every page, then you'd put it in the template.
If I was receiving a theme from somebody that had hard coded things in it like this, I might be a little miffed.
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
Re: Show news on home page without separate template for home page?
The default templates include the {news} output in them. So, perhaps your comment should be directed at the CMS authors and not me. 
That said, I don't see a problem with wanting news headlines to appear on only the home page and not others, yet wanting everything on the site share the same look and feel. I can accomplish that by having separate templates for the various pages. But, that becomes a bit of a confusion point for non-technical users adding pages later who will have to choose which templates to apply and so forth.
I also don't want the {news} tag in the content of the home page. If it's there, it's likely to be accidentally removed or changed by one of my users who won't have a clue why it's there.
I want to construct the site with a single template that embeds the {news} tag to avoid all such problems. This is for my own use and not distribution anyway. So, you won't have to worry about being miffed by this.
Tim

That said, I don't see a problem with wanting news headlines to appear on only the home page and not others, yet wanting everything on the site share the same look and feel. I can accomplish that by having separate templates for the various pages. But, that becomes a bit of a confusion point for non-technical users adding pages later who will have to choose which templates to apply and so forth.
I also don't want the {news} tag in the content of the home page. If it's there, it's likely to be accidentally removed or changed by one of my users who won't have a clue why it's there.
I want to construct the site with a single template that embeds the {news} tag to avoid all such problems. This is for my own use and not distribution anyway. So, you won't have to worry about being miffed by this.

Tim
-
- Support Guru
- Posts: 8169
- Joined: Tue Oct 19, 2004 6:44 pm
Re: Show news on home page without separate template for home page?
Okay, I see your point now, fair enough..... you want to use the {get_template_vars} plugin, to show you exactly which variable to put your condition on, and then something like the syntax you mentioned below should work just fine.
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.