When creating template files, when is it preferable to create a view-block template instead of a regular block template?
To be specific:
block--views--{view's machine_name}-block.tpl.php
VS.
block--myblock.tpl.php
From what I understand, views block templates are specific blocks generated with views. You'd never use a views block template to control a normal block. Normal block templates would be used to control the output of normal blocks (blocks generated from the Structure > Blocks > Add block control panel.
Related
I have a multilingual site in EpiServer 7.
I have a block.
This block has some culture specific properties.
The block is only on-page editable in the language that it was created on.
Why aren't the borders showing up in the other languages and how to enable them?
Are you using a ContentArea or a local block (i.e. a strongly typed property of the block type)?
Either way it should work if you use the [CultureSpecific(true)] attribute on the Content Area or block property.
I'm rather impressed with AngularJS, but one of a few things that is bothering me is that it isn't as easy as some other frameworks to discover the linkages between code and templates. For example, a template for a directive can contain many other directives, and those directives can be tags, attributes, even id or class names, so they are not immediately visible when looking at the template file. The only way I know to discover all the directives in a large template file is to painstakingly look at every line of markup. I suppose I could write a program to discover all the directives I define and then search all my templates for uses of those directives, but is there another way?
I am attempting to create a custom region for my Drupal 7 sub theme. The process I am following is:
1) Specify sub region in .info file of subtheme like this:
regions['sub_region'] = Sub region
2) In the page.tpl.php file,
print render($page['sub_region']); at the location where I wish the sub region would appear.
3) Cleared the Cache
However, this new sub region does not appear in my Blocks.
Anybody have pointers as to what I am doing wrong ? Or need to do more
Thanks
Your syntax for the region declaration in .info is incorrect. There should not be single quotes wrapping the region name.
regions[sub_region] = Sub region
Documentation for .info file
It might be worth having a read of this, specially this section.
Region inheritance
Sub-themes do not inherit custom regions from a parent theme. If you
are using custom regions, you should copy the region declarations from
the parent theme's .info file. Be sure your sub-theme's page.tpl.php
file matches the sub-theme's region settings.
EDIT
On your blocks page in the top right corner are tabs so you can set different blocks on different themes. Are you selecting the sub theme?
I'm starting a Drupal 7 site and have noticed that almost every page will require a separate layout.
in order to style an individual node do i just name a template mode-NID-page.tpl.php or is there more to it?
I think i will also need to add gallery widgets, etc.. but i think that's a separate matter. But would this involve displaying fields in the above template?
First off: I don't think it's a good idea to theme pages based on their NID.
That aside, here are two possibilities how you can achieve something like this:
Theme the normal node template, but include some logic there. You could for example include specific template files based on the NID. Not a clean separation of course, as such code should not go into templates. For a cleaner separation you could attach a custom field to the pages that holds the template file used for themeing.
As you want to create individual styles for different NIDs I assume that the number of those is not exorbitantly large. In that case, you could create separate content types. Each of the NIDs should then be converted into a node of that content type and of course each content type can have its own theme template then.
Downside of the second approach is that there might be some work involved if you have a lot of settings that would need to be transferred to the content types (e.g., permissions). But then again, the new pages will be nodes too, so most things should just work out of the box as they did before.
Suppose I have a loose xaml file with one resource in it, keyed "MyResource", and that I pull that loose xaml file into two other xaml files via ResourceDictionary.MergedDictionaries. Now suppose I put the following line of code in both of the code-behind files for the two xaml files:
object obj = FindResource("MyResource");
Will both references be to the same object, or will they be to distinct objects?
Thanks,
Dave
The answer depends on how you load the loose XAML file. If you load it once and the same reference is added to two different MergedDictionaries, then by default you'd get the same reference to your "MyResource".
If you load the XAML file twice, you will effectively create two instances of the ResourceDictionary (and thus two instances of your resource).
In a single ResourceDictionary, you can specify if a resource is shared using the x:Shared attribute, which is true by default. Setting this to false, will force new instances to be created for each request of the resource. There are some restrictions on the use of this attribute, which are explained on the MSDN page.