Page 1 of 1
[SOLVED] How can I use different styles for different news?
Posted: Mon Feb 02, 2009 12:14 pm
by Apprentice
Hello,
I'm having bit of a conundrum with news. I'd want to have two kinds of news with different styles and lay-outs. How this can be accomplished? I have already made new field definitions. I tought that the different kind of news could be done with those, but I don't know how to customize them...
Thank you
Re: How can I use different styles for different news?
Posted: Mon Feb 02, 2009 12:18 pm
by RonnyK
two news-templates....
Ronny
Re: How can I use different styles for different news?
Posted: Mon Feb 02, 2009 3:39 pm
by Apprentice
Ok. Is it summary template, detail template, form template or browse category template that I should create? Or all of them?
Re: How can I use different styles for different news?
Posted: Mon Feb 02, 2009 7:54 pm
by RonnyK
Depends on what you want.... Normally the default showing is the summary-template, when clicked on the 'More'-link, you go to the detail-template. So you could make another summary-template and call that template using
{news summarytemplate="your-new-template"}
Ronny
Re: How can I use different styles for different news?
Posted: Wed Feb 04, 2009 1:20 am
by Apprentice
So,
this is the code that I have now on the page:
{news category="akatemia" summarytemplate="akatemiasummary2"}
I have two news categories General and akatemia. I made also akatemiasummary2 in Summary Templates. The problem is that the lay-out remains the same, although I have changed it in akatemiasummary2.
Makes me wonder.
Effects take place only if I switch akatemiasummary2 as default template in Summary Templates, but that is not what I want to do because it also effects news in General category.
Re: How can I use different styles for different news?
Posted: Tue Feb 10, 2009 1:55 pm
by Apprentice
My current CMSMS version is 1.5.1
I would apprecieate some further advice very much.
Thank you
- A
Re: How can I use different styles for different news?
Posted: Fri Feb 13, 2009 9:00 pm
by neophron
Create a new detail template (name it "sample-new" for example), and change all html elements and ids in it. After that, add to {news}
detailtemplate="sample-new"
in the page where the news (based on the new template) should appear.
It must look like this:
{news detailtemplate="sample-new"}
Read carefully in your admin-area (extensions --> modules --> news) all about the news module.
Re: How can I use different styles for different news?
Posted: Wed Feb 18, 2009 8:31 am
by Apprentice
Yeah,
thank you. This is how it would normally work, but when you should have two news styles simultaneously, it doesn't unfortunately. New templates just won't take effect if they aren't set as default in news templates section (in this case detail templates section) and only one can be set as default.
As far as I understand there is conflict between news module help and reality (next text concerns useage of detail templates):
"This template must exist and be visible in the form templates tab of the News admin, though it does not need to be the default. If this parameter is not specified, then the current template marked as default will be used."
So its a problem that I can't solve still...
- A
Re: How can I use different styles for different news?
Posted: Wed Feb 18, 2009 3:50 pm
by neophron
Ahh ok, I didn't realize that you want to display on the same page two different styled news. I can't see an option where to choose in the news a template (if there is more than one).
I'm not a php freek, may be someone could write a user defined tag?
Re: How can I use different styles for different news?
Posted: Sat Feb 28, 2009 1:09 am
by rANE
I also have the same problem. Is there no way to do this?
Re: How can I use different styles for different news?
Posted: Mon Mar 02, 2009 7:09 pm
by tophers
I'm not sure I understand exactly what you're trying to accomplish. If it's having two differently styled news feeds on the page then it's fairly straight-forward. To use Apprentice’s example above I would:
Code: Select all
<div id="news_general">{news number="2" category="General" summarytemplate="general_summary" detailtemplate="general_detail" detailpage="news"}</div>
<div id="news_akatemia">{news number="2" category="akatemia" summarytemplate="akatemia_summary" detailtemplate="akatemia_detail" detailpage="news"}</div>
This would result in two news feeds on the page (say the Home page, for example), that use different templates (for instance, I edit the summary template for a Blog to include the time posted, but use only the date posted for News). Since they are in different , you can style them however you like.
As for the Detail page, you can add in a specific encompassing to the individual detailtemplates, and style them accordingly. Just make sure to write your css very specifically - for example:
Code: Select all
#news_akatemia #NewsPostDetailTitle
With some tweaking this should do the trick. As for the actual News page itself (let's say you navigate to it directly, not through a Home Page link), just use the same structure - two separate divs, with unique names, and unique css. It will show listing for the two types of news, and receive a referring link (from Home, say).
Re: How can I use different styles for different news?
Posted: Thu Mar 12, 2009 5:46 pm
by rANE
Thanks, this worked.
Re: How can I use different styles for different news?
Posted: Thu May 07, 2009 11:02 am
by Apprentice
Hey,
this really works. I had already lost hope...
Thank you very much!
-A