I'm using the Business Template fo Umbraco 4.7. I've made a bunch of custom user controls. For different sections of the site, I'd like to have different views for the right rail which is part of the master page.
First thought is to add a user control that would accept a parameter and display a view based on the given site section.
For example, if I had four different sports, based on the sport section, I would display the teams for that sport.
What is the best way to achieve this? Thanks in advance for any insight on this.
Is there any reason you are using user controls rather than Macros (either XSLT or Razor)? Generally, it's easier to do stuff in a macro as you automatically get a reference to the current node and can use that as a starting point.
If you really need to do stuff in a user control then you may want to look into using the Umbraco Node API. You can use Node.GetCurrent() to work out where you are and use that as a basis for what you display.
Partly because I'm more comfortable, but in this instance, I'm not sure Embraco will do what I need it to do (emphasis on not sure).
I wouldn't know where to store lists of groups, then lists of other items that belong to those groups along with other data points. So, I've made my own schema to hold this data and the only think I need to do is figure out which section I'm in.
If usng xslt or razor is better suited here, I'm all for it, but have no idea how I would save this data to begin with (using the current schema). I appreciate an insight on this, not looking for code or anything, just a better understanding of what's possible.
What you are doing is perfectly valid, but you may well be able to use Umbraco to store data for you. There's something called "the container pattern" that may fulfill your needs. Basically you just create document types to store your data (since a document type is rather similiar to a database table) and then create nodes in the tree to store that data - you don't even need to make templates for the data if they won't actually appear directly as pages in your site. You can also nest nodes to effetcively make categories.
For instance, imagine you had typical product and category data to store. You'd create two document types - one called category and one called product. You'd give the product one some attributes, such as size, colour etc. Then your tree would look like:
Home
-- Products
----- Fruit (category)
------ Apples
------ Pears
------ Bananas
---- Operating Systems
------ Windows
------ Linux
------ OsX
You can then have each category list products (which is just a list of child nodes). If you don't want the data to appear in that structure then hide it from your navigation and simply pull it in from a macro and use XSLT/Razor to select what you want.
Obviously this may not work for you, but it's quite common to use Umbraco in this way. Good luck!
Using Section ID/Name for Custom User Control
Hi All,
I'm using the Business Template fo Umbraco 4.7. I've made a bunch of custom user controls. For different sections of the site, I'd like to have different views for the right rail which is part of the master page.
First thought is to add a user control that would accept a parameter and display a view based on the given site section.
For example, if I had four different sports, based on the sport section, I would display the teams for that sport.
What is the best way to achieve this? Thanks in advance for any insight on this.
Is there any reason you are using user controls rather than Macros (either XSLT or Razor)? Generally, it's easier to do stuff in a macro as you automatically get a reference to the current node and can use that as a starting point.
If you really need to do stuff in a user control then you may want to look into using the Umbraco Node API. You can use Node.GetCurrent() to work out where you are and use that as a basis for what you display.
Partly because I'm more comfortable, but in this instance, I'm not sure Embraco will do what I need it to do (emphasis on not sure).
I wouldn't know where to store lists of groups, then lists of other items that belong to those groups along with other data points. So, I've made my own schema to hold this data and the only think I need to do is figure out which section I'm in.
If usng xslt or razor is better suited here, I'm all for it, but have no idea how I would save this data to begin with (using the current schema). I appreciate an insight on this, not looking for code or anything, just a better understanding of what's possible.
What you are doing is perfectly valid, but you may well be able to use Umbraco to store data for you. There's something called "the container pattern" that may fulfill your needs. Basically you just create document types to store your data (since a document type is rather similiar to a database table) and then create nodes in the tree to store that data - you don't even need to make templates for the data if they won't actually appear directly as pages in your site. You can also nest nodes to effetcively make categories.
For instance, imagine you had typical product and category data to store. You'd create two document types - one called category and one called product. You'd give the product one some attributes, such as size, colour etc. Then your tree would look like:
You can then have each category list products (which is just a list of child nodes). If you don't want the data to appear in that structure then hide it from your navigation and simply pull it in from a macro and use XSLT/Razor to select what you want.
Obviously this may not work for you, but it's quite common to use Umbraco in this way. Good luck!
is working on a reply...