I'm using Umbraco 4.7 to develop a website. There are certain common elements across some pages like 'Contact Details', 'Latest News', 'Latest Products', etc. For example, one page can have contact details while other may have news. I want to create some sort of macros (HTML or Razor) and want to add these on the required pages. But I also want this content to be editable by content editor. How shall I create such editable macros?
I will assume that you are familiar with Razor and creating macros. If not, there is a reasonable article here.
There are several ways to do this, but each depend on the type of content you wish to display. For example, a 'Latest news' macro can be created with only code by just specifying in the razor to select the top 3 news articles, ordered by date descending. Likewise, if the contact details data already exists on another page (e.g. About us or Contact us), then you can just use the Razor to locate the page and pull the field values you wish to display in your macro.
However, as soon as you want to have some control over which items are displayed in your macro, you will need to create some additional means of controlling this. In the case of your products, you will probably want to select which are displayed in the macro, and therefore across the site. Therefore, you can:
Add a yes/no field to each product (e.g. called 'Display in side bar') and this can then be used the macro to filter the products display; or
Create a new document type called 'Side bar products' that contains a uComponents multi-node picker that will allow you to select products. You can then create a node from this document type and in your macro you will use Razor to query the products in this node. (You will obviously have to ensure that this node is not displayed in the navigation of the site!)
This second option is by far the better option as it is easier to maintain, provides a little scalability and also allows you to potentially have multiple 'Side bar products' nodes, so you could have differing sets of products in different sections of the sites. The first option is certainly easier to implement, but can get difficult to maintain since you have to remember which product is ticked.
Related
I'm making a site wherein I want to show the current course that I'm gonna teach to my pupils.In this page there should also be links provided to my previous courses. Now when I'm done with this course I want to transfer it to a previous course or rather automatically create a link for it and get the new course content in it's place. I just think doing manually is kind of stupid. Rather I want to have a form where i can create my new course then click on make current course as previous and this course as new whenever i wish.How can I do this.Is this even possible
Pretty open question ... One way would be to work with views when showing a node.
In the view you should use a custom php field, which collects the record (nid) within the course-node table. And then create a link using the drupal path_alias function or by using node/nid ...
You could use panels-module as well. Where you have a view with the latest course, and under the latest course you have a view of a link to the latest course -1 . (I think you can set an offset in views to get the previous course) The view should accept an argument, namely the nid of the currently loaded node.
If you use this method, do check if your panels is giving the arguments to the views module.
Another way would be to use node reference as to what is the previous course (but you don't want it to be manual). The advantage of node_reference is that you don't need to enter your courses in a certain order. If you make it automatically, then the order in which you fill in the courses should be correct.
Easy man. Just create a content type called "course" and using CCK, add all the fields to capture information you want about the course.
Now you have the content. Using Views, create a simple view page displaying course content type and sort it on descending order, set it to display one item at a time and add a mini pager. That way the new course will be the first one displayed and the other ones will be behind it. You might need to customize the pager a bit ^^
Does Concrete5 have something similar to Drupal's CCK and Views? How can I create a new custom content type (like catalog or product) in Concrete5?
Concrete5 is more page-focused than data-focused (because its emphasis is on ease-of-editing, and most people's mental model of their website is a bunch of pages, not a single template dynamically populated with content based on input variables etc. etc.).
Hence you treat each page as a "record". Concrete5 has a concept of "page types", which usually are equated to "theme templates", but also serve the purpose of defining a set of data through attributes.
So... you create a page type for the type of data (let's say a product), and you create custom attributes for product meta-data (name, price, etc.). Then to add a product to the system, you just add a new page and choose the "product" page type. This page serves as both the "view" page for that product, and also as the anchor for its data (in the "Properties" dialog when you create or edit the page). Now, instead of a "view" query to present a listing of data, you use the "Page List" block and tell it to only show pages of the "product" page type. To customize the output of the page list, you can create a custom template for it -- in which, among other things, you can output the custom attributes of the page (name, price, etc. -- by calling this: echo $cobj->getCollectionAttributeValue('myattributename'); )
All that being said, there is a plugin available (although it's not free) that works more like CCK/Views: http://www.concrete5.org/marketplace/addons/data-display/
And of course if this is actually for a product catalog, you probably want to use the eCommerce plugin (also not free, but well worth it when building sites for clients who are paying you) -- sorry can't post link due to StackOverflow spam filter, but it's very easy to find in the concrete5 markeplace.
If you have a very complicated and extensive database to display in the website, then Concrete5 is probably not the best tool for the job. But for simpler content-focused sites (for example, artist portfolios, record labels, staff listings under a few dozen people), I find it to be much easier to set up and maintain than more database-focused CMS's such as Drupal (especially if giving to a non-technical client to manage).
I have something in Drupal (v6) that i'm trying to nail, but having a little difficulty. I am laying out a list of products which have the following taxonomy vocabularies attached to them:
Manufacturer
Product Type
Use
When entering a product, which uses a custom content type, the admin can select one or more terms from each of these vocabs.
I then need to lay the front-end out using Views as follows:
List of Manufacturers displayed to the user - user clicks one
List of Product Types displayed to the user that have a product contained within that matches the chosen Manufacturer - user clicks one
List of Uses displayed to the user that have a product contained within that matches the chosen Manufacturer and Product Type - user clicks one to view full node details
The tricky bit is making the link between each of these vocabs using Views. The taxonomy vocabs have no hierarchy defined within them, I just need to be able to display them to the user in the order above. I can't change to using a nested hierarchy in just one vocabulary as the 3 seperate vocabs are used elsewhere on the site for other purposes and need to stay as they are.
Is it possible to create what i'm after with Views? Any tips on how best to rig it together?
Could use 3 views, with the 2nd and 3rd taking arguments.
So a url could look like:
/products/ - 1st view
/products/Ford - 2nd view, one argument
/products/Ford/Cars - 3rd view, two args
That said, for something like this I'd probably just write a custom module. How practical that is depends on how comfortable you are with Drupal and PHP.
I'm displaying cars on a page created with a view and displays. I want to be able to create a form on the home page to allow people to select the 'make', which will then update the 'models' list based on the 'make' the user selects, 'year' to and from, and 'amount' to and from. What the user selects will of course alter the list of used cars, whether that's on the existing used cars page or a new page.
I would be happy to create a custom module if required, just need some direction.
Thanks !
When using views, what you need to do is to use exposed filtes. Inside your view you can setup filters like normally, only when you expose them, the user get to change the value of the filter.
How the filters will be themed to the user will depend on how you store the values, so it's a bit hard to say how to progress from there. It might be a bit tricky to get a select and not a textfield. Once you get select fields, this could probably be done with either some theming or form_alter, all you need is to add some js to change the options. The js part should be pretty normal, you will probably need to fetch the model names and values using ajax.
I have a website where users register their projects for a certain event. I'd like to highlight certain projects on certain days on the front page.
What's the easiest way to add a "Featured Section" that accomplishes this? I know I can go through and make the post sticky but that seems tedious. Is it possible to use Views to do this or is there some other module available?
As long as the 'certain days' part of that is a manual process, this sounds like a perfect fit for the Nodequeue module, which integrates very nicely with views (and even automatically creates one for each separate queue). So, in your example, you might create a Nodequeue called 'Featured Section', that accepts nodes of a certain type, and then you can quickly add content to that. A view on the home page would pull in only nodes in that queue.
Modules for events: Views (for displaying in front page) + CCK (for featured and date fields) + calendar (for showing events as calendar (page or block))
You could use Views to do this, and add a CCK field (or taxonomy if you like) to flag a node as 'Featured'.