I have a site of news... which I would like to use different templates depending on the section of the web they are in each moment (a new might be a homepage new when it's published but then passed to a different section where it has a different design).
I know how to create the templates and all, but... is there a way to apply it to the very same new depending of the situation?
Thanks for the answers and sorry to bother again...
The thing is this goes within a masterpage. I mean... the masterpage could hold the "breaking news" section (which is a separate umbraco template) and the "not so breaking news" page (the same of above). Depending on which section the new is it should display it differently according to the section's template.
If I did it that way, I wouldn't be needing to do anything more as long as the new support both section's templates... Am I right or even with that approach I would need to specify anything related to how to display the new?
Thanks a lot... It's my first site with Umbraco and these are small quirks in the learning process... but all in all, I'm impressed at how good it's been built, really.
You would need to put some logic in your XSLT file.
So your master page would contain a macro that uses this XSLT file, when your XSLT file gets called it knows which section of the site it is being called from, therefore you can use this info combined with your logic to determine how to display the news.
So in the XSLT file you would have logic like:
- What section are we in?
- If we are in section A,B or C then show news as "breaking news"
Apply a template dynamically?
Hello all!
I have a site of news... which I would like to use different templates depending on the section of the web they are in each moment (a new might be a homepage new when it's published but then passed to a different section where it has a different design).
I know how to create the templates and all, but... is there a way to apply it to the very same new depending of the situation?
I have read this thread: http://our.umbraco.org/forum/templating/templates-and-document-types/8247-Template-alias-as-URL , but I don't know if that's really the topic treated.
Any help? Thank you!
Yes, it's possible.
The answer is in the link you've posted, you can do this using 'altTemplate'
So for your current news article the URL maybe
http://www.website.com/news/some-news.aspx
When this news expires within your XSLT you would show it using a different template like this
http://www.website.com/news/some-news.aspx?altTemplate=newsarchive
Rich
Or use the more seo friendly url for alternate template, in that case url would become
http://www.website.com/news/some-news/newsarchive.aspx
Cheers,
/Dirk
Thanks for the answers and sorry to bother again...
The thing is this goes within a masterpage. I mean... the masterpage could hold the "breaking news" section (which is a separate umbraco template) and the "not so breaking news" page (the same of above). Depending on which section the new is it should display it differently according to the section's template.
If I did it that way, I wouldn't be needing to do anything more as long as the new support both section's templates... Am I right or even with that approach I would need to specify anything related to how to display the new?
Thanks a lot... It's my first site with Umbraco and these are small quirks in the learning process... but all in all, I'm impressed at how good it's been built, really.
Cheers!
You would need to put some logic in your XSLT file.
So your master page would contain a macro that uses this XSLT file, when your XSLT file gets called it knows which section of the site it is being called from, therefore you can use this info combined with your logic to determine how to display the news.
So in the XSLT file you would have logic like:
- What section are we in?
- If we are in section A,B or C then show news as "breaking news"
- else show news as "not so breaking news"
Make sense?
Rich
Aaaaal l the sense in the world Rich. Thanks for it.
I guess XSLT macros are my next homework then... ;).
Thank you! Cheers!
is working on a reply...