By terre on
I've decided to use blogs on my community forum. I also intend to only have certain blocks appear on the blog pages. Problem is that the blog links to the individual entries use "node" in the url and not "blog."
I've read the documentation and learned that it takes advanced knowledge to create mass url aliasing so that all nodes of the blog type will be aliased to something like /blogs/nodeID.
Has anyone else done this for 4.5 and would be willing to provide the coding? Or anyone have another suggestion to work around this ("blogs" in the url would be nice, but I mainly want to have custom blocks on the blog pages.)
Comments
custom blocks on indiv. forum and blog pages
In the past it was ok for the site to have pretty much the same blocks on all pages. But now that I'm going to set up blogs and forums, I would like to be able to control what blocks appear on those pages.
Since all blog and forum entries use node/# in the url, I can't setup blocks to not show on those pages. Not without assigning a url alias to every single post, which is not feasible.
On the main forum pages I can customize the blocks - "forum" appears in the url as forum/#. But the individual forum posts are simply node/# and my block configuration will not be honored (because "forum" is not in the url.)
Is there a way to specify which blocks show up based on the type being viewed (blog, forum, story etc.) ?
Check in admin/help/block of
Check in admin/help/block of your Drupal install (assuming 4.5)
Here's a snippet
If the block should only show up on blog pages, use <^blog>. To display on all node views use <^node>. The angular brackets are used as delimiters of the regular expression. To show up on either forum or book pages use <^(forum|book)>. The round brackets form a group of expressions, divided by the | character. It matches if any of the expressions in it match. A more complicated example is <^node/add/(story|blog|image)>. Blocks which have their paths set to this expression will show up on story, block, or image composition pages. If you want to show a block an all pages, but not the search page, use <^(?!search)>.
-Steven Peck
---------
Test site, always start with a test site.
Drupal Best Practices Guide
only works if the term is in the URL
I can't see the code you posted, but if it's what's in the help here on drupal.org then that does not work. That is what I have been using and it only works if those terms are in the *URL*, which they are not when you view indiv. forum or blog posts.
I'm just not seeing a way around this yet by using the regular expressions since the terms "forum" and "blog" are not included as part of the URL. Which is why I originally asked about mass aliasing becuase that seems to be the answer, unless I misunderstood the use.
perhaps more clarification on my problem customizing blocks
The regular expressions only apply to the main forum, blog, etc pages where a list of content is supplied and the term is in the path/URL. Ex:
yoursite.com/forum/#oryoursite.com/blog/#But once you click on the actual content page then you seem to no longer have control over what goes on the page because everthing is a "node." (Unless you go in and alias *every* single forum or blog post which is not feasible. For the past year I've done this when posting a "story", assigning an alias to get the blocks to show where I want. I can't see doing that for every forum post or blog post or event post.)
View a forum entry - then the path is just
yoursite.com/node/#View a blog entry - then the path is just
yoursite.com/node/#View an event entry - then the path is just
yoursite.com/node/#So there is no way, using the reg expression on the blocks setup page, that I can specify which blocks should only be seen on forum pages or only on blog pages or only on event pages.
Any suggestions, please?
I have the weblinks module.
I have the weblinks module. In order to make it appear only on blog pages in the path of the block Latest Weblinks I added
<blog>The latest weblinks blog now appears only on the blog pages.
-Steven Peck
---------
Test site, always start with a test site.
Drupal Best Practices Guide
It used to be easy
Before 4.5 e.g. a book page (at least one accessed from another book page) was book/view/123. Now with 4.5 all pages are in the form node/123. I had to simplify my layout to compensate.
the url I posted is on your s
the url I posted is on your site. It's from the Drupal default install help files.
Go to Administer
Then Blocks
Then the help link
http://www.sample.com/index.php?q=admin/help/block
-Steven Peck
---------
Test site, always start with a test site.
Drupal Best Practices Guide
check your path.module help text
This is from the help section of path.module:
KC
powershotblog.com | adsensed.com | alafranga.com | gift and home decor
seems mass url aliasing may not apply?
I appreciate the response to my post, but I'm not sure if I'm explaining it correctly. The code above from manual, posted by KC, would only convert all types to some selected alias - in the example, that would be "display."
hrouland, I see that you see the problem. Since all node types are given the generic path/url
yoursite.com/node/#I can not use the strategies listed in the manual to customize what blocks show up on individual forum, blog, or event pages.What is needed it seems is to modify node.module so that it inserts the node type as part of the url. ??? So you would have a path/url like this:
yoursite.com/forum/node/#oryoursite.com/event/node/#oryoursite.com/blog/node/#ormaybe it would need view in it, I don't know -
yoursite.com/forum/node/view/#If drupal could be made to insert the node type as part of the path when viewing individual posts, then the regular expressions used on the blocks configuration would be honored.
Possible?
found a way with phptemplate
hi!
I need something similar as you do, so I looked into it... I use Drupal 4.5 with the phptemplate engine. into my node.tpl.php file, located in my theme folder, I put the following code right before everything else:
---code ommitted because I can't post it even between code tags---
here it is: http://www.femfatal.hu/code.txt (code edited some half hour later, so recheck :))
If we are viewing a standalone node page, and we are also dealing with a forum type node, the sidebar div will be hidden. Anything in your css can be overriden this way, so, e.g. you could have a different color scheme if you're viewing a forum page.
Of course, the above code will not work for the main forum page and those that have forum in their path... for that, I suggest tweaking the playing with the block paths for the side blocks.
I hope this helps.
It would be nice if they
It would be nice if they gave some examples to work from to get this working (taxonomy based urls) this is extremely popular and here seems to be asked for quite a bit. Anyone care to try their hand at working this out?
It's still like this, huh?
Well, the help section for that block stuff is pretty misleading then, because it sounds like it would work out of the box (but it only works for the blog "overview" page). I wasted several hours with searching the forums and trying everything, because I thought I broke it... I guess I'm not the only one who felt for that "trap".
I still don't know how to fix that :/
I also don't understand why drupal doesn't use that naming convention (from the example) as default. Everything would then work as advertised.