Pass a multiline text block as MediaWiki template parameter - templates

I wish to make a collapse template to hide a block of text and show it by clicking on expand.
I found such code as follows
<div class="mw-collapsible mw-collapsed" style="background-color: #E6E6E6; border-style: thin black; font-style:italic; ">
<p><i>Try it by yourself before expanding on the right!</i></p>
<div class="mw-collapsible-content">
some text or wiki encoded text content (better for formatings and images)
that will remain hidden
until expand is clicked
</div>
</div>
which I tried to make a template for (Collapse)
<div class="mw-collapsible mw-collapsed" style="background-color: #E6E6E6; border-style: thin black; font-style:italic; ">
<p><i>Try it by yourself before expanding on the right!</i></p>
<div class="mw-collapsible-content">
{{{1}}}
</div>
</div>
My currently failing call would be
{{Collapse|some text or wiki encoded text content (better for formatings and images)
that will remain hidden
until expand is clicked}}
but I do not succeed to pass the input text block using {{{1}}} because my content is full of line feeds and other formatting tags.
Do I need to act in the template or in the call to wrap and with which tag?
any help welcome.

You need create two templates:
{{Collapse Begin}}
With contents:
<div class="mw-collapsible mw-collapsed" style="background-color: #E6E6E6; border-style: thin black; font-style:italic; ">
<p><i>Try it by yourself before expanding on the right!</i></p>
<div class="mw-collapsible-content">
And:
{{Collapse End}}
With contents:
</div>
</div>
And then on pages add:
{{Collapse Begin}}
some text or wiki encoded text content (better for formatings and images)
that will remain hidden
until expand is clicked
{{Collapse End}}

Apparently, naming the parameters allows using multiline input (do not ask me why!).
The following code does the job for me but thank you ankap for the smart idea, I will reuse it somewhere else.
I added an optional margin to indent the coloured box when used in lists and a separate parameters for the message shown in collapsed-mode.
<!-- takes tup to three parameters
* margin: to indent the block in the page, useful if the collapse is within a bullet list
* comment: to show a warning on the expand line
* content: the actual content to hide
# adding additional div improved support for lists etc...
-->
<div class="mw-collapsible mw-collapsed" style="background-color: #E6E6E6;
border-style: thin black; font-style:italic; margin-left: {{{margin|0px}}}; ">
<includeonly><i>{{{comment|<nowiki>
Try it by yourself before expanding on the right!</nowiki>}}}</i><includeonly>
<div class="mw-collapsible-content"><div>{{{content|{{{1}}}}}}</div></div>
</div>
enjoy!

Related

Foundation 6: top-bar-right and left stack when wrapping

When designing a webpage using Zurb Foundation 6, top-bar-left and top-bar-right of the navigation menu stack when put into a wrap class, even when scaled to full screen. The top-bar-right ends up being just below and indented from top-bar-left. How do I fix this issue so that the top-bar-right section stays in line with top-bar-left and is not stacked?
The top-bar-right section works fine when the wrap class is not applied to a div within the nav class. I've tried only applying the wrap class to top-bar-left only instead of the entire nav class, and also tried a "float: right" for top-bar-right in CSS, but neither method solved the problem.
HTML code:
<!-- DESKTOP NAVIGATION -->
<nav class="top-bar">
<div class="wrap">
<div class="top-bar-left">
<h3>Site Title</h3>
</div>
<div class="top-bar-right">
<ul class="menu">
<li>About</li>
<li>Services</li>
<li>Contact</li>
</ul>
</div>
</div>
</nav>
And the CSS:
/*GENERAL*/
.wrap {
width: 90%;
max-width: 1100px;
margin: 0px auto;
}
There are attributes on top-bar that are making its dependents display inline and stack for narrow displays (display: flex for one). You could apply all the appropriate attributes to the wrap class as well but why reinvent the wheel? Doesn't that negate the whole reason for using a grid system in the first place? Try removing the extra div and put the wrap class on the nav element instead:
<nav class="top-bar wrap">
<div class="top-bar-left">
<h3>Site Title</h3>
</div>
<div class="top-bar-right">
<ul class="menu">
<li>About</li>
<li>Services</li>
<li>Contact</li>
</ul>
</div>
</nav>
Or to simplify things, you could just put those attributes on .top-bar and not have a wrap class:
.top-bar {
width: 90%;
max-width: 1100px;
margin: 0px auto;
}
If you need a wrapper div, put it outside top-bar, not inside.

Is there a way to have a top-bar with a header image that are sticky together at the top of the page?

I'm building a website for a friend's film production company using Foundation 6. I created a top-bar navigation bar with his logo image above the top-bar and made them both sticky. It seems to work fine on large screens and small screens but if viewed on anything in between the logo separates from the top-bar. This is most evident when you stretch and squish the page.
I've tried to include the image in the top-bar div but it aligns it to the left and I haven't been able to align it to the top as it is currently. This is the first time I've worked with the sticky function in Foundation. I've looked through the Foundation docs, Google, and StackOverflow but haven't found anything quite like this.
This is my top-bar section.
<div data-sticky-container>
<div class="title-bar" data-responsive-toggle="example-menu" data-hide-for="medium">
<button class="menu-icon" type="button" data-toggle="example-menu"></button>
<div class="title-bar-title">Menu</div>
</div>
<div class="grid-y">
<img src="images/safe_image.jpeg" style="width: 100%; height: auto"; data-sticky data-options="marginTop:0;">
<div class="top-bar" data-sticky data-options="marginTop:10.2;" style="width:100%; background-color: white; padding-top: 10px;" id="example-menu">
<!-- <div class="top-bar" style="width:100%; background-color: white; padding-top: 10px;" id="example-menu"> -->
<div class="top-bar-right" data-dropdown-menu style="display: table; margin: 0 auto;">
<ul class="dropdown vertical medium-horizontal menu" style="background-color: white;">
<li>Home</li>
<li>Current News</li>
<li>Film/Media</li>
<li>Photography</li>
<li>Publicity</li>
<li>Misc</li>
<li>Contact</li>
</ul>
</div>
</div>
</div>
I would like the logo image and the navigation bar to look the way they do at larger screen sizes but minimize together to the point where the data-toggle kicks in instead of separating, as they are doing currently.

Implementing a sticky footer in Orchard CMS

Can somebody please explain how a sticky footer:
<div id="container....
...content
</div>
<div id="footer"....
</div>
CSS:
#container
{
height: 100%;
margin-bottom: -height of footer
}
might be implemented in Orchard CMS?
The problem I can't manage is to envelop some main content layouts in a wrapper.
Currently I have:
<div id="aside-1 ...
<div id="layout-navigation
<div id="layout-main-container
<div id="layout-footer
So main problem is to customize layouts rendering.
In your Layout.cshtml file, use the Display method to render zones. The primary zone where content gets rendered is the Content zone, which you render like this:
<div id="container....
#Display(Model.Content)
</div>
<div id="footer"....
</div>
You can also define your own custom zones (via your Theme.txt manifest file).
For example, in your Theme.txt file, define a Footer zone like this:
Zones: Content, Footer
Then in Layout.cshtml, render that zone like this:
<div id="container....
#Display(Model.Content)
</div>
<div id="footer"....
#Display(Model.Footer)
</div>
You have complete freedom on how you want to layout content.

Creating Footer using ZURB Foundation CSS Framework

I am using ZURB foundation CSS framework to design a website. Currently I am trying to create a footer that will stay at the bottom of my page. I have the following code for the footer but its not going to the bottom, rather its showing up in the middle.
Could you please tell me how to create a footer (using ZURB foundation framework) that will stay at the bottom?
<div class="row">
<div class="twelve columns" style="background-color:#000000; height:30px; bottom:0;"></div>
</div>
Simple! Zurb Foundation is itself based on Compass. So you can use the 'Compass Sticky Footer' mixin.
http://compass-style.org/reference/compass/layout/sticky_footer/
There is an example of how to do it here:
http://compass-style.org/examples/compass/layout/sticky-footer/
But you just go:
<div class='example'>
<div id='layout'>
<div id='header'>
<h1>Sticky Footer Example</h1>
</div>
<p>
This is the main content area.
</p>
<p>
In this example you should pretend that the red box
is actually the browser window.
</p>
<p>
Because, being a contrived example, it's not actually sticking
to the bottom of the page.
</p>
<div id='layout_footer'></div>
</div>
<div id='footer'>
This is the footer area.
</div>
</div>
And in you SCSS
#import "compass/reset.scss";
#import "compass/layout.scss";
#include sticky-footer(72px, "#layout", "#layout_footer", "#footer");
#header {
background: #999999;
height: 72px; }
#footer {
background: #cccccc; }
.example {
height: 500px;
border: 3px solid red;
p {
margin: 1em 0.5em; } }
I would create two different footers - one for desktop & tablets - and one for phones.
Using Zurb's "show on and hide on options" it's very easy to do. You can have any graphics used by both footers so any "download penalty" is small.
To create a sticky footer for you website you'll have to add some CSS to Zurb. (You can add this to the app.css file, which is Zurb's repository for your extra CSS)
Also the Brad Frost article (posted by Ed Charbeneau) is a great read - I hadn't seen that before.
HTML:
<div id="footer">
My Awsome Footer 2014
</div>
CSS
#footer{
height: 50px;
position: fixed;
bottom: 0px;
left: 0px;
line-height: 50px;
color: #aaa;
text-align: center;
width: 100%;
}
working fiddle: http://jsfiddle.net/AunmM/
Check out this simple sticky footer for foundation, no need for a #wrapper or a fixed height! Works in mobile as well. http://tangerineindustries.com/download/sticky_footer/
For reference, here's how I accomplished this using Foundation 4.0.
Given a <footer> tag.
footer {
#include panel($panel-color, $panel-padding);
width: 100%;
margin: 0;
position: fixed;
bottom: 0;
}
With foundation 6 the compass import isn't possible out of box. And workaround is hard to find.
Good solution together with foundation can be this little helper:
http://tangerineindustries.com/download/sticky_footer/
Pro:
Developer created this for using together with ZF 6.
You only need a <footer> tag.
Works with responsive depending flexible height of footer, even with
window resizing.
You don't need any extra #wrapper, #pusher, #footer whatever
html-elements.
You don't need any extra CSS.
Contra:
Uses JavaScript.
What you are trying to do is create a "Sticky Footer" or "Fixed Position Footer". This is something which is independent of Foundation and instead is a function of CSS in general.
I would suggest reading this article by Brad Frost. It identifies the basic CSS involved in creating a Fixed Position element and the compatibility issues that arise from doing so.
http://bradfrostweb.com/blog/mobile/fixed-position/

How to put Text over the Image in Sitecore?

I need to create user control where <sc:text/> element should showed over the <sc:image>.
I know this can be achieved via CSS but in this case control cannot be configured as we cannot override inline styles.
Any hints?
You can achieve this using the sc:fld extension function and wrapping sc:text in markup, adding class names or ids (or inline styles if you must!).
<img src="{sc:fld( 'graphic', $sc_currentitem, 'src’ )}" class="head" />
<span class="txt"><sc:text field="txtField" /></span>
You can then style these as normal
img.head {}
span.txt {}
I don't understand the problem. This seems like more of a front-end problem than a Sitecore issue. CSS will work fine. Here's a rough example (not tested but gets you the idea):
Sample HTML:
<div class="my-container">
<div class="img">
<sc:image Field="Bar" runat="server" />
</div>
<div class="txt">
<sc:text Field="Foo" runat="server" />
</div>
</div>
Sample CSS:
.my-container {
position: relative;
}
.my-container .txt {
position: absolute;
z-index: 50;
top: 0px;
}
.my-container .img {
z-index: 10;
}