[SOLVED] How can I use different styles for different news?

For discussion and questions related to CMS Specific templates and stylesheets (CSS), and themes. or layout issues. This is not a place for generic "I don't know CSS issues"
Post Reply
Apprentice
Forum Members
Forum Members
Posts: 20
Joined: Tue Nov 11, 2008 11:25 pm

[SOLVED] How can I use different styles for different news?

Post 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
Last edited by Apprentice on Thu May 07, 2009 11:04 am, edited 1 time in total.
RonnyK
Support Guru
Support Guru
Posts: 4962
Joined: Wed Oct 25, 2006 8:29 pm

Re: How can I use different styles for different news?

Post by RonnyK »

two news-templates....

Ronny
Apprentice
Forum Members
Forum Members
Posts: 20
Joined: Tue Nov 11, 2008 11:25 pm

Re: How can I use different styles for different news?

Post by Apprentice »

Ok. Is it summary template, detail template, form template or browse category template that I should create? Or all of them?
RonnyK
Support Guru
Support Guru
Posts: 4962
Joined: Wed Oct 25, 2006 8:29 pm

Re: How can I use different styles for different news?

Post 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
Apprentice
Forum Members
Forum Members
Posts: 20
Joined: Tue Nov 11, 2008 11:25 pm

Re: How can I use different styles for different news?

Post 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.
Apprentice
Forum Members
Forum Members
Posts: 20
Joined: Tue Nov 11, 2008 11:25 pm

Re: How can I use different styles for different news?

Post by Apprentice »

My current CMSMS version is 1.5.1

I would apprecieate some further advice very much.

Thank you

- A
User avatar
neophron
Forum Members
Forum Members
Posts: 145
Joined: Sun Feb 12, 2006 12:11 am

Re: How can I use different styles for different news?

Post 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.
Last edited by neophron on Fri Feb 13, 2009 9:02 pm, edited 1 time in total.
Apprentice
Forum Members
Forum Members
Posts: 20
Joined: Tue Nov 11, 2008 11:25 pm

Re: How can I use different styles for different news?

Post 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
User avatar
neophron
Forum Members
Forum Members
Posts: 145
Joined: Sun Feb 12, 2006 12:11 am

Re: How can I use different styles for different news?

Post 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?
rANE
New Member
New Member
Posts: 2
Joined: Sat Feb 28, 2009 1:07 am

Re: How can I use different styles for different news?

Post by rANE »

I also have the same problem. Is there no way to do this?
User avatar
tophers
Forum Members
Forum Members
Posts: 218
Joined: Thu Jun 07, 2007 7:25 pm

Re: How can I use different styles for different news?

Post 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).
rANE
New Member
New Member
Posts: 2
Joined: Sat Feb 28, 2009 1:07 am

Re: How can I use different styles for different news?

Post by rANE »

Thanks, this worked.
Apprentice
Forum Members
Forum Members
Posts: 20
Joined: Tue Nov 11, 2008 11:25 pm

Re: How can I use different styles for different news?

Post by Apprentice »

Hey,

this really works. I had already lost hope...

Thank you very much!

-A
Post Reply

Return to “Layout and Design (CSS & HTML)”