I'm new to Drupal and Drupal 8 and I want to add areas(blocks?) that I can easily add to a page that pulls in and has access to selected view data and fields. What's the easiest way to get this done? It seems like it should be something that's easy to do but Drupal seems to make this really hard to achieve.
I've tried making custom blocks and types via the CMS but then it'd mean editing the content in 2 different places when we need to update areas or add new areas.
I've also tried building a block via a module but I cant seem to pass the information from a view into my template that way.
The blocks will potentially need to be added to more than one page if that' possible too.
What am I missing, why is this so difficult?
Thanks
Although the question is not so specific I would recommend to start from here Understanding Drupal > Overview > The Drupal flow and then move to Drupal Glossary (it is almost the same for 8.x).
This way it will be more easy to understand Drupal parts such as Theme, Region, Block, Template (using Twig for 8.x) etc.
Use the views module to create the block, then use the block layout page admin/structure/block to place the block in an appropriate region. Edit the block and configure the block and set its visibility settings.
Related
I have 3 nodes in my sites.
node/1 - Login
node/2 - Contact
node/3 - Register
I want to have different template for different nodes. If I do as page-node-1.tpl.php , page-node-2-tpl.php , its for the entire page, I don't want that, I want specifically override for node content.
I have already tried the following links:-
Custom template for specific node in Drupal 6?
Using different templates for different nodes in Drupal 7
I am using Drupal 6
I have not used Drupal 6 in a while, but from what I realized, Drupal 6's default node templates will not have a node ID based template suggestion.
That does not mean you cannot do it from a custom theme.
<?php
function THEMENAME_preprocess_node(&$vars) {
$vars['template_files'][] = 'node-' . $vars['nid'];
}
?>
In your theme's template.php, add the above code, replacing the theme name (or merge the function contents if you already have that function). This will make the Drupal check for node-123.tpl.php file (123 being an example node ID), and will use it for in place of node.tpl.php.
Since you mentioned you'd be using node/1 or any node contents to embed a login form, let me tell you that this isn't exactly a good idea. The login form needs to be accessible when the site is in maintenance mode, and it can be hard to manage them later with different deployment environments. This part is completely irrelevant to the question though.
I come from a Wordpress background and i'm trying to wrap my head around content-types and templates.
My issue is that if I have 2 pages which are slightly different in layout, let's call one 'Wide' and one 'Narrow' then I need a content type for both. But if I change my mind and want 'Narrow' to be 'Wide' as well then I need to delete the page and re-add it as the other content type.. which seems very long winded.
In wordpress you build you templates and then assign each page to a template, and if you don't then it defaults to the default template (which in drupal would just be page.tpl.php) I'm just wondering whether there is anything similar in Drupal?
Thanks for any help
Dan
You can do this using a module called Display Suite https://drupal.org/project/ds
If used in conjunction with other modules such as Context or Panels you can create multiple templates and then assign them by Node type, URL etc
I am to develop a Joomla 3.1 Template. The template should consist of a static header and footer, as well as multiple pages, all of which need their own styling. Further, the client would like to be able to add 'events' to a specific listings page. Customers should be able to book said events via a simple form.
Thanks to some really basic guides, I have the header and footer down, as well as some simple template options. However, I am now running into some problems;
How would I approach the content section? Ideally, a page would consist of multiple, editable sections. The client would be able to edit said sections in the backend without having to deal with or accidentally changing the layout or styling of the page itself. Since there are multiple pages, I obviously need different views/containers for each of them. Is this possible and if so, how?
Another problem is the documentation, which I found to be very lacking. Even google only got me so far (basic structure, index.php, templateDetails.xml and so forth). Are there any other resources I may have missed or do I really need to refer to other templates (most of which, obviously, aren't free) and use var_dump all the time?
Writing this, I just realized that I could theoretically build a template for every single page but ... that surely can't be right, right?
If someone could provide a basic outline or at least tell me how you personally would tackle a project like this, it'd be very much appreciated.
All the best
Edit;
I just found some video tutorials but since my bandwidth is limited, I cannot watch them. Please take this into account when writing an answer. Thanks.
I have only one word for you :
GANTRY :D
gantry-framework.org
Joomla revolves around menu items that point to components. For each menu item, you can assign modules to different positions within the template to create a unique page. You only need one template if you really understand how Joomla templating works.
Joomla has very good documentation here - http://docs.joomla.org/
Few things to remember -
Component - this is a type of content or app of sorts. A component will define what content is and how it is displayed. This can be anything from blog articles and categories to an event registration system to a message board or social network. Menu items generally will point to a view in a component.
Modules - these are used to display additional content around the component output. This can be a menu, or a login box, or a weather widget or anything else you can come up with. Modules can be assigned to or excluded from the various menu items on your site.
Plugin - plugins are used to change the final output on a site. They can be used to insert Youtube videos, or forms within content, or even to alter the meta tags on a page.
Understanding how extensions work is an important first step. Once you get how those work, learning how templates and template overrides work will give you most of what you need to know to build a basic Joomla site.
I would like to know if there's a PHP CMS which makes things like editing a block of text easy.
It also should let the user separtare content in columns.
I'm using Wordpress right now, but it seems like the only way of letting the user add content is in form of posts.
Any suggestions?
Take a look at MojoMotor it's different from the standard CMS packages and is based off CodeIgniter.
Joomla is the Answer. It has all the properties you mentioned
Wordpress allows adding pages too. These live outside the blog and are not automatically shown in the blog index.
If you decide to drop WordPress after all, you could take a look at 9 alternatives to WordPress.
Greetings all,
I just wanted to know what is the proper way to do template's in Joomla?
If i have four boxes in footer (4 columns) how can i automate them in the template so their content inside can be managed from the back-end?
So far, i have seen custom html block modules and using those. But wouldn't it be funny if there are loads of such blocks and than managing them from modules individually?
Now suppose if i have a slogan/tag line for my website; and i want it to be managed from backend.. Do i need to create that custom block even for such single line?
May be i am going to wrong direction. Can someone guide me please?
Regards,
Jhon.
A Joomla template is simply a map the outlines the various positions that available to put modules in. These positions are built around the component display area. You can load basically anything you want in to a module position. You will probably need to download some modules from the Joomla Extension Directory, there are tons of options.
The Custom HTML module is appropriate for simple content that is not going to change very often. This would be good for a company tag line that doesn't ever change. There are various modules that would allow you to load content from the latest Joomla articles based on section or category. There are modules for login forms, stock prices, RSS feeds, weather, all kinds of stuff.