I have two nodes, one is kind of a parent to the other node. For example, I'm displaying information about Plants. There are two nodes, Plant_Parent which has the latin name and some common names which is moderated, and then there is the Plant_Info which is not moderated and it has information like bloom time, growing experience, water requirements, stuff that's user specific. However, I want to be able to display the two together, i.e. someone selects a Plant_Parent node, and all the plant_info nodes are display as well.
Drupal doesn't seem to support this, is there a why I can do this?
The heavily-used CCK module has a Node Reference field type that's perfect for this.
Node reference as ceejayoz says can do two nodes displayed together. However you could also just have different permissions on fields within a node. Have a look at content_permissions which is part of CCK, or look at the sparsely documented hook_field_access() if you wish to have even more custom permissions.
Related
I need some help figuring out the best way to sctructure content using Expression Engine. I've red the documentation, looked at all information I could find but I haven't found the answer. I hope someone here could help.
What I want to create is a product catalogue that would look like this:
/bikes (product category, displays the product families, two-wheelers, three wheelers etc.)
/bikes/two-wheelers (product family, displays the products in the family)
/bikes/two-wheelers/red-bike (product)
/bikes/two-wheelers/red-bike/wheels (optional product details page)
I understand that EE URI's are template-group/template based and that the content is in channels. I'm not yet sure how categories can be used in this.
Essentially I would like to create "simple" parent-child relationschips between the entries and I found a plug-in called Structure that does something like that. Unfortunately, this project needs to be done without additional (payed) plug-ins.
Is it possible for the product to be the channel, and product-family and product-category to be attributes of the product in EE? Would that work? Is there a better way to structure that?
I realise that this isn't a straight-forward question, but I'm still hoping to be pointed in the right direction.
Thanks for reading!
Probably what you'll want to do is use categories to break your products up into families. You can nest the categories like so:
Bikes
Two Wheelers
Three Wheelers
Tall
You'd then assign your "Red Bike" channel entry the category of "Bikes" and "Two Wheelers".
For the extra product detail page, you could probably use related entries. Set up a channel called "Wheel Types", then publish entries for all the different kinds of wheels. Then use a relationship field type in your "Products" channel to associate a specific wheel type to your "Red Bike" entry. You can then link to that detail page using a related entries tag in your template.
The Structure module would really help you easily craft the URLs you are looking for, but if you can't use it then the Freebie extension should help. But of course the time it takes you to figure out how to use Freebie for your needs would probably be worth far more than the cost of a Structure license.
I was wondering if their was any sort of way to detect a pages genre/category.
Possibly their is a way to find keywords or something?
Unfortunately I don't have any idea so far, so I don't have any code to show you.
But if anybody has any ideas at all, let me know.
Thanks!
EDIT #Nican
Perhaps their is a way to set, let's say 10 category's (Entertainment, Funny, Tech).
Then creating keywords for these category's (Funny = Laughter, Funny, Joke etc).
Then searching through a webpage (maybe using a cUrl) for these keywords and assigning it to the right category.
Hope that makes sense.
What you are talking about is basically what Google Adsense and similar services do, and it's based on analyzing the content of a page and matching it to topics. Generally, this kind of stuff is beyond what you would call simple programming / development and would require significant resources to be invested to get it to work "right".
A basic system might work along the following lines:
Get page content
Get X most commonly used words (omitting stuff like "and" "or" etc.)
Get words used in headings
Assign weights to different words according to a set of factors (is used in heading, is used in more than one paragraph, is used in link anchors)
Match the filtered words against a database of words related to a specific "category"
If cumulative score > treshold, classify site as belonging to category
Rinse and repeat
Folksonomy may be a way of accomplishing what you're looking for:
http://en.wikipedia.org/wiki/Folksonomy
For instance, in Drupal they have a Folksonomy module:
http://drupal.org/node/19697 (Note this module appears to be dead, see http://drupal.org/taxonomy/term/71)
Couple that with a tag cloud generator, and you may get somewhere:
http://drupal.org/project/searchcloud
Plus, a little more complexity may be able to derive mapped relationships to other terms, especially if you control the structure of the tagging options.
http://intranetblog.blogware.com/blog/_archives/2008/5/22/3707044.html
EDIT
In general, the type of system you're trying to build relies on unique word values on a page. So you would need to...
Get unique word values from your content (index values or create a bot to crawl your site)
Remove all words and symbols you can't use (at, the, or, and, etc...)
Count the number of times the unique words appear on the page
Add them to some type of datastore so you can call them based on the relationships you're mapping
If you have a root label system in place, associate those values with the word counts on the page (such as a query or derived table)
This is very general, and there are a number of ways this can be implemented/interpreted. Folksonomies are meant to "crowdsource" much of the effort for you, in a "natural way", as long as you have a user base that will contribute.
i've a Drupal theory/strategy related question. First i want to say that i'm very new to the drupalling world, so this question can be quiet stupid. I'm trying to develop/make a part of a site that has the following structure:
(level one) virtual_exhibitions: shows an overview of exhibition categories.
(level two) themes, places, people: which is an exhibition category.
(level three) love, belgium, napoleon: which are exhibitions, every one of there will give a list of photos related to the exhibition subject.
now i created a new node-type: virtual-exhibition.
and i created a vocabulary: exhibition-categories.
now to create the structure i used views:
one view to list all the nodes from a selected category with a link to the node.
one view to list all the categories.
now i was wondering if this is the drupal way to do this, or are there better alternatives. This is working, but i'm not sure if this is the right way.
Another question related to this, i want to use clean urls:
virtual_exhibitions
virtual_exhibitions/themes, virtual_exhibitions/places, ...
virtual_exhibitions/themes/love, virtual_exhibitions/places/belgium, ...
The first one is easy, i can configure this in the views UI. The second one is a bit harder because the categories can have special characters like a ' or a , etc. So i need a raw version (as can be used in path auto) in fact it would be best that my default link of the vocabulary term redirects to this view. because the url of the vocabulary term is very easy to configure using path auto and then i can just use the vocabulary term url in stead of always building it manually.
The reason why i'm using a view for the second level is because it needs a custom layout and as far as i know it isn't possible to style a vocabulary-term of a specific vocabulary. When you style it this style will be used for all the vocabulary-terms.
i hope my description is a bit clear and that somebody can give me some remarks on how i best do this.
I think you might want to take a look on views arguments.
What is the best way of implementing multi-level lists/bullets in php?
What I'm trying to implement is a system to take in short phrases, and categorize them within sections. However, at the same time, I would like to have each section to be collapsible and capable of having sub-sections within them.
For Example:
Section 10
Section 10.X
Section 10.X.X
I was thinking of having each sub-layer as an array, but I realize that I've seen the same type of collapsibility in many places, and they all seem to be similar. Maybe there already is a package or library that does this? And if there is, how should my data-structure for keeping each entry be structured?
Your bullets are being done in HTML, as PHP merely generates HTML code. Consider using nested <ul> tags.
The collapsing is most probably going to be javasscript. (Although I wonder if the CSS :active psuedoclass would work in supportive browsers...)
Regarding the package, I'm not sure. You essentially need a recursive list generating function.
For the kind of structure you mentioned, i think you need what is know as Tree View. Check it out on how to implement that.
Screenshot:
Anything to do with toggling, display lists, indenting etc should be achieved relatively easily with HTML/CSS/Javascript.
Inside your category table, you could create a parent_id field which matches to your primary ID. Then run loops to display your TLD as well as another loop to display the categories within the parent.
My view holds a list of nodes ranked by rating (vote-API/Fivestar).
I wish user to hide nodes they do not wish to see in this view. Can this be done?
I'd use flag module. Users flag content (nodes), then you hide it using view filters.
If you want to be really lazy (and future-proof), use taxonomy.
Create a vocabulary called "Visible" and add a "No" term.
Then filter out all the nodes tagged with Visible/No with views.
Always better to use plain language with newb users anyway.
Is it completely arbitrary which nodes they don't want to see? Like they just want to hide an single node they already read on don't care about? If so then there is no easy way that I know of. That would require some sort of custom module that I've never come across.
If it is more predictable and consistent like the user wanting to change the view to only show nodes that are rated 3 or above or 4 or above then you can do that by creating a filter for and exposing it.
Hope that helps.