Cant get the CUR status working. the menue always have the classes marked with 0 instead of those marked with 2. what i am doing wrong? My typoscript code:
10.marks {
MENU_OBEN = HMENU
MENU_OBEN {
special = directory
special.value = 10
1 = TMENU
1 {
wrap = <ul>|</ul>
noBlur = 1
NO = 1
NO {
allWrap = <li class="first0"> | </li> |*| <li class="normal0"> | </li> |*| <li class="last0"> | </li>
stdWrap.wrap = <strong> | </strong> |*| | |*| <b> | </b>
}
CUR = 1
CUR {
allWrap = <li class="first2"> | </li> |*| <li class="normal2"> | </li> |*| <li class="last2"> | </li>
stdWrap.wrap = <strong> | </strong> |*| | |*| <b> | </b>
}
}
}
Don't see anything obvious, but have you tried removing the NO = 1 line? IIRC the normal ("NO") state doesn't need to be explicitly set, as long as you set some properties for it... maybe by setting it explicitly you're overriding the state?
In my general ts template I have no NO=1. Instead I copy the NO status into CUR. I really dont know why, but it works for me this way.
e.g.
NO.wrapItemAndSub = <li> | </li>
NO.stdWrap.htmlSpecialChars = 1
CUR < .NO
CUR = 1
CUR.ATagParams = class="cur"
ACT < .NO
ACT = 1
ACT.ATagParams = class="act"
Keep in mind that for page shortcuts this cannot work, since if you klick on a shortcut you never are on the page which is supposed to become active/current.
Just change the page property to standard page and set "Display Content of Page" in "Apperance" Tab.
Related
I'm trying to do the following in Freemarker via NetSuite:
I have the following data on a transaction record i.e. imagine a payment record with a number of lines
Doc No. Amount
1 100
1 100
2 50
3 200
4 50
4 25
5 1000
and I want to be able to output:
Doc No. Total
1 200
2 50
3 200
4 75
5 1000
I think you need to use #list and #assign but not sure??
Here is a snippet that should help out with this question (I hope). This is pulled from one of my PDF templates, where I'm adding up the locationTotal variable.
<#list record.item as item>
<#assign currentLocation=item.custcol_location>
<#if currentLocation=="">
<#assign currentLocation=record.entity>
</#if>
<#if item.itemtype!="Discount" && locationsProcessed?seq_index_of(currentLocation)==-1>
<#assign locationTotal=0>
<#list record.item as item2>
<#assign compareLocation=item2.custcol_location>
<#if compareLocation=="">
<#assign compareLocation=record.entity>
</#if>
<#if compareLocation==currentLocation>
<#assign locationTotal=locationTotal+item2.amount>
</#if>
</#list>
<#assign newList=newList+[{"location":currentLocation,"total":locationTotal}] >
<#assign locationsProcessed=locationsProcessed+[currentLocation] >
</#if>
</#list>
For Ex. I have an arraylike this cids:Array=[{Id:1},{Id:2},{Id:3},{Id:4},{Id:5},{Id:6},{Id:7}---------etc..]
I want output as :
1 2 3 4
5 6 7 8
9
Using *ngFor in angular 4
One way is to convert your arrray[] in array[][4]. And then you will be able to use an imbricated ngFor (ngFor in another ngFor)
Pseudo code :
ngFor* {
ngFor* {
print value;
insert a space;
}
Insert a return line;
}
<span *ngFor="let cid of cids">
{{cid.Id}}
<br *ngIf="(cid.Id)%4==0" />
</span>
<ion-grid no-padding>
<ion-row>
<ion-col>col 1</ion-col>
<ion-col>col 2</ion-col>
<ion-col>col 3</ion-col>
</ion-row>
</ion-grid>
Above code works good, its respective styles are applied, but, below one doesn't work.
<div ion-grid>
<div ion-row>
<div ion-col>col 1 div</div>
<div ion-col>col 2 div</div>
</div>
</div>
When I tried to put it as attributes, styles are not applied for grid, I get something similar to
col 1 div
col 2 div
expected result: col 1 div col 2 div
What am I doing wrong?
ref: http://ionicframework.com/docs/v2/api/components/grid/Grid/#grid-size
In Jekyll, I would really like to have the date format as "2nd December 2012" — i.e. with the ordinal, rather than just "2 December 2012".
I see that there's an ordinalize function available in Ruby to do this, but I haven't had any luck combining it with Liquid and Jekyll.
How can I format dates as I would like?
I solved this by writing the following Jekyll plugin, which I placed in the _plugins directory with an arbitrary name, e.g. date.rb:
require 'date'
require 'facets/integer/ordinal'
module Jekyll
module DateFilter
def pretty(date)
"#{date.strftime('%e').to_i.ordinalize} #{date.strftime('%B')} #{date.strftime('%Y')}"
end
end
end
Liquid::Template.register_filter(Jekyll::DateFilter)
Then — having installed the facets Ruby gem — I was able to use {{ post.date | pretty }} in my site, and all was well.
In Jekyll 3.8 or higher (for example with GitHub pages) you can just use the new date_to_string filter options and just write:
{{ page.date | date: "%I:%M %p on %A" }}
{{ page.date | date_to_string: "ordinal" }}
This will output: 12:23 PM on Friday 16th Jan 2015
For people using GitHub Pages:
If you're hosting your site on GitHub you won't be able to use modules (I believe GitHub run jekyll build with the --safe option which excludes modules), which means if you were to use Christopher's answer you'd have to build your site locally and then push the contents of the _site dir to GitHub.
Here's a solution to get an ordinal number/date just using Liquid which will allow you to use GitHub Pages + Jekyll in the usual way:
{% capture day %}{{ page.date | date: "%-d" }}{% endcapture %}
{% capture dayLastTwoDigits %}{{ day | modulo: 100 }}{% endcapture %}
{% if dayLastTwoDigits >= "11" and dayLastTwoDigits <= "13" %}
{% assign ordinal = "th" %}
{% else %}
{% capture dayLastDigit %}{{ day | modulo: 10 }}{% endcapture %}
{% case dayLastDigit %}
{% when "1" %}
{% assign ordinal = "st" %}
{% when "2" %}
{% assign ordinal = "nd" %}
{% when "3" %}
{% assign ordinal = "rd" %}
{% else %}
{% assign ordinal = "th" %}
{% endcase %}
{% endif %}
{% capture ordinalDay %}{{ day | append: ordinal }}{% endcapture %}
<p class="post-meta">{{ page.date | date: "%I:%M %p on %A" }} {{ ordinalDay }} {{ page.date | date: "of %b, %Y" }}{% if page.author %} • {{ page.author }}{% endif %}{% if page.meta %} • {{ page.meta }}{% endif %}</p>
This will output something like:
12:23 PM on Friday 16th of Jan, 2015
If you want an entirely Liquid answer, you can do the following:
Create an include file, say for example: ordinalsuffix.html
Put the following code into that file:
{% assign numbertoordinal = (numbertoordinal | default: 0) | plus: 0 | modulo: 100 %}
{% assign ordinalresult = "th" %}
{% case numbertoordinal %}
{% when 1 or 21 or 31 or 41 or 51 or 61 or 71 or 81 or 91 %}
{% assign ordinalresult = "st" %}
{% when 2 or 22 or 32 or 42 or 52 or 62 or 72 or 82 or 92 %}
{% assign ordinalresult = "nd" %}
{% when 3 or 23 or 33 or 43 or 53 or 63 or 73 or 83 or 93 %}
{% assign ordinalresult = "rd" %}
{% endcase %}
Then you can essentially call it like a function, like such:
{% assign numbertoordinal = 101 %}
{% include ordinalsuffix.html %}
{% assign result = numbertoordinal | append: ordinalresult %}
Of course, you'll need to expand this for it to output fully formatted dates. But if you want to know what ordinal suffix any arbitrary number has, this is a reasonably clean answer.
Here is my attempt so far. I realise that there may be other ways to do this.
But why is my call to split failing?
{% capture path %}
{{ page.url | remove: ".html" | remove_first:"/" }}
{% endcapture %}
{% capture breadcrumbs %}
{{ path | split:'/' }}
{% endcapture %}
{% for crumb in breadcrumbs %}
{{ crumb }} »
{% endfor %}
I am uploading this to github and just getting nothing.
I've never been able to get split to work properly either, but breadcrumbs are still possible. The following is adapted from my code in that answer (note the section that should be modified in the if statement and that this is the readable version and doesn't work precisely as expected).
{% capture url_parts %} {{ page.url | remove: "/index.html" | replace:'/'," " }}{% endcapture %}
{% capture num_parts %}{{ url_parts | number_of_words }}{% endcapture %}
{% assign previous="" %}
{% if num_parts == "0" %}
<Handle being at the top of the site (i.e. "site.com/") here>
{% else %}
{% for unused in page.content limit:num_parts %}
{% capture first_word %}{{ url_parts | truncatewords:1 | remove:"…"}}{% endcapture %}
{{ first_word }} »
{% capture url_parts %}{{ url_parts | remove_first:first_word }}{% endcapture %}
{% endfor %}
{% endif %}
If the user is at /a/b/c.html this will print a » b » c », if they are at /a/b/ (or equivalently /a/b/index.html) it will just print a » b ».
At least, it will be close to that: for a Markdown file there are too many newlines between each time first_word is printed, so they are considered separate paragraphs and the output will be (this isn't a problem in an HTML file, but then more tags are needed to make it work properly):
a »
b »
c »
This can be solved by putting the whole for loop on one line (this is the code that should be used):
{% capture url_parts %} {{ page.url | remove: "/index.html" | replace:'/'," " }}{% endcapture %}
{% capture num_parts %}{{ url_parts | number_of_words }}{% endcapture %}
{% assign previous="" %}
{% if num_parts == "0" %}
<Handle being at the top of the site (i.e. "site.com/") here>
{% else %}
{% for unused in page.content limit:num_parts %}{% capture first_word %}{{ url_parts | truncatewords:1 | remove:"..."}}{% endcapture %}{{ first_word }} »{% capture url_parts %}{{ url_parts | remove_first:first_word }}{% endcapture %}{% endfor %}
{% endif %}
(NB. the page.content in the for loop is just to give something to iterate over, the magic is done by the limit:num_parts. However, this means that if page.content has fewer paragraphs than num_parts not all breadcrumbs will appear, if this is likely one might define a site variable in _config.yml like breadcrumb_list: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15] and use site.breadcrumb_list as the placeholder instead of page.content. (Lifted from my other answer.))
Here is an example (it doesn't use precisely the same code as above, but it's just a few little modifications, and it is in an HTML file, so the problem with new lines creating paragraphs is not there).