Questions tagged [drupal-blocks]

Blocks are self-contained collections of content and functionality that are displayed from Drupal within theme regions.

Blocks are self-contained collections of content and functionality that are displayed from Drupal within theme regions.

See also

162 questions
2
votes
1 answer

How to add a body class with php inside a block in drupal 6?

I have a block in drupal 6 with php code which I would like to add a certain class to the body, but how can I achieve this? Is it even possible to do this outside the preprocess function? Show if the following PHP code returns TRUE (PHP-mode,…
Alex
  • 9,911
  • 5
  • 33
  • 52
1
vote
1 answer

Programmatically set the value of a block in Drupal

Can we programmatically set the value of a block in drupal?? We could do that via the admin section, but I am looking to see if there is a way, where we could programmatically say that if($block=="sidebar") { // do this } I could then put this in…
macha
  • 7,337
  • 19
  • 62
  • 84
1
vote
1 answer

Why doesn't this code work to check if a region is occupied?

I have the code below in my theme to detect if there is a block in the leftsidebar region. The problem is that this HTML code still gets output on pages that do not have a block in the leftsidebar region. I am at a complete loss as to what the…
Dustin
  • 4,314
  • 12
  • 53
  • 91
1
vote
1 answer

How do I make a template file for a specific display in a view when I have multiple displays of the same type

I have a view that I am using for articles on the front page (View called Frontpage Top). in one BLOCK display (named: Top Story) it just selects the most recent article. in the other BLOCK display (named: Top 5 Stories) it selects the 2nd-6th most…
Jerzakie
  • 115
  • 1
  • 9
1
vote
1 answer

How to create different page styles in drupal 7 site?

i want to make drupal pages that has got different structures. Like on the first page i want to place many 'views blocks', and after pages i want to show other banners and some other blocks not placed on other pages. How can i do it?
Enkuushka
  • 425
  • 1
  • 5
  • 12
1
vote
1 answer

Menu block plugin like functionality

I've installed the "Menu block" module, and it is doing a great job in creating levels 2+ menus inside pages. However, I want to know whether I can imitate a similar functionality. In first level menu pages I want to create large boxes that contain…
tomor
  • 1,765
  • 2
  • 16
  • 21
1
vote
1 answer

Create a block for a specific page in Drupal

I want to have a sidebar for certain pages, each sidebar would contain different information. The problem is that I don't seem to be able to add blocks for a specific page but for all of them.
Noivy
  • 23
  • 3
1
vote
1 answer

Drupal block which filter content type by taxonomy

I am using Drupal 9. I want to give the ability to the admin to place a block and select from the block a taxonomy term in which will filter a content type. I did the above by creating a custom block with the taxonomy "Sponsor Type" as you can see…
1
vote
2 answers

Drupal6: How to programmatically style a block?

In Drupal6, I basically have a block (a hierarchical menu structure) that turns out like this in HTML:
1
vote
2 answers

Drupal show block data in a template region

i have a dynamic block data (from database) for one of my modules and it is displayed in the right sidebar. Now my template is changed and i want to integrate this block data into one of my .tpl files. How can i proceed?
shasi kanth
  • 6,987
  • 24
  • 106
  • 158
1
vote
1 answer

Why are block settings lost after Drupal upgrade?

This is a new one for me. I upgraded a Drupal site from 6.20 to 6.22. After the core upgrade, the block visibility settings are all goofed up. Quite a few that were enabled prior to the upgrade are now disabled. Additionally, the "Page specific…
Mark
  • 1,129
  • 2
  • 12
  • 25
1
vote
1 answer

Drupal: Views combine multiple blocks output

I am looking at creating three different blocks, combining them and then randomizing the output. EG: Block 1:
Block 2:
Block 3:
Combine the three and randomize so output looks like
,…
canintex
  • 638
  • 1
  • 7
  • 21
1
vote
2 answers

how to overide simplenews for drupal tpl and subscribe without being registered

How do I make a simple block to subscribe myself by providing my email in simlenews, without having to register myself. i'm using drupal 6
PartySoft
  • 2,749
  • 7
  • 39
  • 55
1
vote
0 answers

How to access Attributes from within a Block in Drupal 7.x

So I'm calling a block within a HTML container in Drupal 7.x with a shortcode. There is an option for a Dynamic Shortcode as well but alas there is no documentation in the code base. [block admin_url = "admin/structure/block/manage/block/244"…
Pocketninja
  • 395
  • 1
  • 12
1
vote
2 answers

Block overriding

i have a footer block which look like that
1 2
3
10 11