What is the purpose of compulsory sections? - asp.net

I understand the benefit of required: false sections in MVC4. They are simply optional parts of a layout that will not display if the View does not contain them. But what is the benefit of required: true sections? Shouldn't something in a required: true section simply be put directly into the layout itself?

Just as an example, you could have a menu that would be required for each page but would also differ between controllers and/or areas.

Related

How to apply css to particular selected child in ivh-treeview?

<div class="box-body">
<div ivh-treeview="dTree"
ivh-treeview-id-attribute="'uic'"
ivh-treeview-use-checkboxes="false"
ivh-treeview-on-click="my_tree_handler(ivhNode)">
</div>
</div>
and function in controller class:
$scope.my_tree_handler = function (branch) {
branch.style.color = "red"; // "branch" is an object by the way
};
I want to apply css styling features to particular selected item, but I don't know how to do that. Documentation of this plagin "ivh-treeview" is not that helpful
welcome to Stack Overflow!
It would be very helpful if you filled us in on what you've tried or specifically how the ivh-treeview documentation is not clear. As one of the project maintainers I would love to know where our docs are falling short :).
Have you looked at the templates and skins section of the docs? This directive supports a default set of classnames which you can use to style your tree. When that's not enough, as in your case, you may provide your own node templates for the directive to use. There are a number of examples which demonstrate how custom templates can be used to create more or less arbitrary tree views.
Here's an example where custom templates are used to apply different styles to selected vs non-selected nodes. In this case we're doing some fun ascii checkboxes but the general idea is the same: observe some node property to affect the node representation.

How to put pictures in a single row using semantic view?

I'm trying to put these pictures in a single row using semantic view in drupal7. I just created this view named try and put 2 pictures in it.
After that, I'm editing this view->format-format->setting->row (this is asking for class attribute, not mandatory) and I don't know what to write in this class attribute.
How do I put these pictures in a single row?
Make custom template for that view. Open "Advanced settings" on right side of view editing page and at bottom find "Theming information". There you can see template file suggestions. There if you can see the code of default templates (and copy it to clip board) but you can also see naming suggestions for overriding default templates. So copy code from default template, make from it file with some suggested name, save file in your theme...and clear the cache.
Then change the file as you wish, depending on your needs....
The CSS 'display:inline-block' is a good way to make rows. CSS Flexbox is more difficult to understand, but very powerful. Occasionally, the CSS 'float:left' will do what you need, but it has a tendency to 'log jamb' on differing element heights.
I have used Semantic Views to create continuous, wrap-around content from multiple View rows. I removed the View row element by deleting the default 'div' in the 'Format settings'. That way only a continuous stream of fields appears within the '.view-content' tag.
A custom template is also good.

CakePHP : Difference between " $this->fetch('css') & $this->Html->css('cake.generic') in cake php

Can Someone please Explain this two line used in CakePHP layout.ctp file. It seems both line used for adding css .Then what is the difference ? How they works.
$this->Html->css('cake.generic')
$this->fetch('css')
See the documentation on using blocks for script and CSS files.
In your view(s) you can use:
$this->Html->css('cake.generic')
In your layout(s), you can use:
$this->fetch('css')
A layout contains presentation code that wraps around a view. Anything
you want to see in all of your views should be placed in a layout.
What this means is that when defining your layout, using $this->fetch('css') will add in any css blocks used in your views, so if in your views you'd put both:
$this->Html->css('cake.generic')
$this->Html->css('cake.special')
Using $this->fetch('css') in your layout would include both. Note that without defining the block content first, it will not call anything. The addition of $this->Html->css('cake.generic') in the layout file before the block call ensures it is added if it is not already included in a defined view.

Creating custom layouts for Images in page content TYPO3 6

Typo3 provides option to add multiple images to a page content, but all the images are wrapped under some default <div> tags. I want these images to be wrapped under <ul> and <li> tags instead and giving my own custom CSS ids and classes to it.
There are not many resources on TYPO3 for me to approach this issue. Can TYPO3 allow to use custom tags for the page content elements?
UPDATE
From Jost's answer was able to get my images displayed, but how do I split the image details?
My each image will have title, alt-text, image-path and image-link. Now, using TypoScript how do I retrieve this, because each details has to go in separate tags.
Check the TypoScript object browser. There you will find the object tt_content, which contains the rendering definitions for content elements. The rendering definition for images is found at tt_content.image.20, for example
tt_content.image.20.imageStdWrap.dataWrap = <div class="csc-textpic-imagewrap" style="width:{register:totalwidth}px;"> | </div>
The default definitions given there are usually provided by the static TypoScript of CSS-styled-content. You can overwrite them in your own TS, but when updating to a newer TYPO3-version, the default template may change, which could result in additional wrappers.
Update
Most content rendering in TYPO3 is defined in the TypoScript object tt_content. You can browse all TS-objects that will be used on a page by selecting the "Template" module and the page in question, and then choose "TypoScript Object Browser" in the selectbox at the top of the window. To understand what that stuff means, knowledge of TypoScript is necessary (Tutorial, Reference).
You can add your own TypoScript, which may override existing settings. You can do that in the Template-module too, but usually this is done by creating a file containing the script somewhere in the fileadmin folder and including it from the Template module.
The above enables you to edit the markup of the page. (Additional) CSS is usually defined in external files, that are included by a PAGE object (see the reference about that).
This post is a bit older but I want to add the following:
If you want to understand how the different content elements are wrapped, you may have a look into the css_styled_content extension. I assume that you have included the "Static Template (from extension)" in your main Typoscript template.
You can find the setup.txt here:
typo3/sysext/css_styled_content/static/setup.txt
There you´ll find the line Jost mentioned in line 860 (TYPO3 version 6.1), for example. And of course a lot of other definitions, too.
But check to read the documentation and tutorials on typo3.org.
HTH
merzilla

Using template inheritance with Assemble

Is is possible to define regions in the template, that would pull content from the page?
Let's say I have in my template the following structure:
<div class=sidebar></div>
<div class=content></div>
And from the page content, I would like to pull some html content to the sidebar, and other content to content div.
Is this possible?
With Swig as the Engine
Yes, this is possible. Seehttps://github.com/assemble/boilerplate-swig, in particular, this example, which shows how to use {% macro %} tags to accomplish what you're asking about.
If you want to use Swig, be sure to look at the readme as the assemble-swig repo as well. You have to register swig as the current engine in assemble:
assemble: {
options: {
engine: 'swig'
}
}
With Handlebars as the Engine
If the sidebar content will always be the same, on every page then you can use partials for this. Even if the URLs or active classes change on each page, this should work.
However, dynamic content using template or "block" inheritance, e.g. extend can be achieved with Handlebars helpers.
But since layouts are used with assemble this is a bit trickier to do with "out-of-the-box" helpers. To clarify, just about any helper I can think of will work great with assemble out-of-the-box, except for this - specifically because of how layouts work.
My suggestion is that you add to the existing feature request(s) for this on assemble and/or the handlebars-helpers project to add your use case and thoughts on what you want to achieve:
https://github.com/assemble/assemble/issues/38
https://github.com/assemble/handlebars-helpers/issues/16
#jonschlinkert You should update assemble's documentation, cause start with Assemble isn't so easy and a lot of things are little hidden.
So Luis, you can try this method, which currently works great for me too!
Assemble: Multiple points of content insertion in layout?

Resources