Placing a Module to a Certain Block in Drupal 7 - php

I'm new to drupal and familiar with Joomla and Wordpress. I'm little bit confused with how drupal works when placing some kind of module to a certain block in drupal 7. Say that I want to place the search box in a footer block of the theme, what are the steps for doing that?. Or may be is it depending on the theme how modules will be placed. Please guide...
Thanks

Drupal 7 have "Regions" , it's like a grid , you can add block in regions. You can add block via admin interface /admin/structure/block/add , you a part for regions who can receive your block.
Also if you need to create a custom block programmatically, you can follow this link https://drupal.stackexchange.com/questions/5582/easy-way-to-create-blocks-programmatically

Drupal uses blocks and they can be placed in regions. Regions are defined in your theme info file and printed from your theme page template.
You can place existing blocks to some regions at "Structure -> Blocks" admin page.
When you are on blocks page there is a table where every row is for a single block. You can place block to some region by dragging it to some region or by changing drop-down in it's Region column (don't forget to save after that).
Also, you can configure every block to be displayed by specific criteria (page, user role...). On same blocks page there is "configure" link for every block and on configure page there is "Visibility" section at bottom of edit page.
But you can use additional modules like Context to place blocks to region with more choices.

Related

Drupal - how to hide headbar Menu in a page?

my website is : https://www.edqm.eu/
I need to create a new page, but I want a page without headbar menu.
Is it possible ?
If Yes, How is it possible to do it ?
the website is built with Drupal 7.
I'm not expert in dev and in Drupal.
Thank you for your help.
it should be possible and depending on your site setup, it can be even pretty simple. You have to find the menu block in /admin/structure/blocks and go to configure on the block, there you should see visibility settings and you can filter out your page.
Hope this helps.
Your header menu can be in:
Some block - just go to Structure -> Blocks from admin menu, find that block, click "Configure" link and in "Visibility settings" hide it by some criteria that is most suitable for your case (content type, page path..). If you have hard time finding which block is that use some inspection tool like Firebug or similar, to see block id. But if site is made well, when you are logged in as admin you'll have that "Configure" gear icon when hovering the block.
Menu can be part of some template file, most likely page template (/sites/all/themes/your_theme/templates/page.tpl.php). If that's the case then you can clone the template file and name the clone following the special naming convention so just the page you want to change will use that template. Then you can modify the clone and remove part that generates the menu. Check out this page for theming names suggestions:
https://www.drupal.org/docs/7/theming/template-theme-hook-suggestions

moodle frontpage show categories list as button

I need to change my theme to show the categories list on frontpage as buttons like this image instend of show only a simple categories list:
Which file I need to edit? Where can I find documentation about this? I just searche google but I did not find nothing about
There isn't standard functionality for this.
Here is an overview though.
First you will need to create a central region for displaying blocks, some instructions here
How to add a block to the center of a page in Moodle?
Then create your own block with the layout you want. Follow the instructions here
https://docs.moodle.org/dev/Blocks
Then once installed, add your new block to the frontpage and move it to the central region.

How to make WordPress pages where only certain (multiple) areas of content are editable

It has been a few years since I properly worked with WordPress. Now I have a proposal to build a WordPress site where every page has a custom design and only some areas of each page is editable.
The reason for this is to build a bespoke layout on each page which cannot be messed up by someone non-technical editing it in the CMS, except for small areas which they can customise.
e.g. A page contains one div which has some text in it, which can be edited in the WP admin backend, but the rest of the page cannot be edited.
Can this be done? How?
Edit: There needs to be multiple editable areas not just one. I know how to make custom pages/templates.
One method may be to create new page templates. Just create a new file in your main theme folder (or the templates folder if there is one). As long at the top of that file contains the line:
/*
Template Name: <your template name>
*/
You can design the page however you want. The data pulled from the admin section will go wherever you invoke
the_content();
The rest of the page can be hardcoded.
Then on the post edit page, on the right side (usually), you can choose the template with your template name for that page. It may be a good idea to copy the current post.php or single.php into your custom file and work from there.
For restricting access you can look at setting up user levels and keep your content contributors as "Authors" instead of "admins" so they can't change themes or edit settings.
(See https://codex.wordpress.org/User_Levels)
For creating specific unique pages with an area that gets changed you should look into custom Page Templates. You can create a page template by dropping a php file with the right naming structure into your theme hierarchy and it will get picked up by the back-end as template option when you create a page.
(See https://developer.wordpress.org/themes/template-files-section/page-template-files/page-templates/)
I solved this problem using a plugin called Advanced Custom Fields which does exactly what I required.

Magento - list specific cms page link in left hand block

I want to list specific CMS pages LINKS to lefthand side of block in magento.
eg. suppose i have added 10 cms pages in admin and now i want to list 2 to 3 specific cmspages which i want. How can i do it ?
There are many ways to do this task using Widgets -
Process 1: We can add Widgets for specific CMS page as "CMS Page Link".
Magento provides the facility to add many kind of Widgets.
Process 2: We can create a Static block where we can put the Code for Link of CMS pages.
And we can call this Static Block using Widget on Left/Right Column or the position where we want.
Hope it'll be Helpful :)
Thanks.

Require and place block in a drupal theme?

In a theme I'm creating I'm wanting to place blocks in locations that are different from the default ones. Eg place the search block in the header.
Is there any way to do this from a theme: Be able to require a block and place it somewhere?
The theming system of Drupal is flexible enough to turn exactly that part of the page into a region where you want your block to appear. For this you need to add the region to the theme's .info file as described on Assigning contents to regions, e.g regions[foobar] = Foobar. This will make a new variable $page['foobar'] available to your page.tpl.php. You can then assign content to the region the same way as with Drupal's builtin regions.
If you want to circumvent this system and display a block ad-hoc, have a look at how _block_render_blocks renders blocks.
It defeats the idea of configurable blocks but nevertheless it's possible: You have to create empty block templates for all but the allowed region. Or you provide/override the theme function for this very block and return nothing for prohibited regions.
In D7 you can add a placeholder region in your themes .info file, clear the cache and put your block in there you can then output the region's content.
print render(block_get_blocks_by_region('region_name'));

Categories