Using node.js and hexo log I want to add a function to the one of the ejs files like post-details.ejs:
<div class="post-date info-break-policy">
<i class="far fa-calendar-minus fa-fw"></i><%- __('publishDate') %>:
<%- getSomething() %>
</div>
the getSomething function is my custom function which I'm unable to find a solution to use it inside the ejs file ...
I created a plugin and I extend the helper as the documents of hexo said but I get an error which says cannot find getSomething function...
How can I simply use a custom function in ejs files ?
You need to customize your syntax.
<div class="post-date info-break-policy">
<i class="far fa-calendar-minus fa-fw"></i><%- __('publishDate') %>:
<% getSomething() %>
</div>
I think this should work.
I have two different kinds of indexes both are working fine at least in the search preview of my local index.
I added both of them to my smart search part in indexes area, one is a page crawler and the second is a custom index that searches in the media library.
The issue is that the results just match with the results of the crawler and are not showing anything of the custom index.
I think the problem is my smartSearchResults transformation because each time that I try to add a field from the custom index I'm getting an error that the value does not exist.
my question is how to use both indexes to retrieve all the results in the same web part?
this is how looks the trasformation
<div class="result">
<!-- Search result title -->
<div>
<a href='<%# SearchResultUrl() %>'>
<%#SearchHighlight(HTMLHelper.HTMLEncode(CMS.Base.Web.UI.ControlsHelper.RemoveDynamicControls(DataHelper.GetNotEmpty(Eval("Title"), "/"))), "<span style='font-weight:bold;'>", "</span>")%>
</a>
</div>
<p class="content">
<%#
IfCompare(GetSearchValue("UseCustomContent"), true,
SearchHighlight(LimitLength(HTMLHelper.StripTags(Eval<string>("Content")), 280), "<strong>", "</strong>"),
SearchHighlight(LimitLength(HTMLHelper.StripTags(GetSearchValue("CustomContent").ToString()), 280), "<strong>", "</strong>")
)
%>
</p><!-- content -->
<%-- MEDIA LIBRARY CONTENT--%>
<div>
<%#GetSearchValue("FileName") %>
</div>
<div class="file">
<i class="<%# GetFileIconClass(Eval<string>("documentExtensions")) %>"></i>
</div><!-- file -->
</div>
</div>
But I'm getting no results message
When getting specific field values from a search index you cannot use the simple Eval("ColumnName"). You have to use another method, GetSearchValue("ColumnName"). The Eval() method works mainly with the following columns Title, Content, Image. If you're already using the GetSearchValue() method then you need to update your question to reflect what you're using or have already tried.
You will have to check if the value exists before you try to use it. You can use IfEmpty for this. An Example:
<%# IfEmpty(GetSearchValue("Email"),"","<span class='label'>Email</span>")%>
<%# IfEmpty(GetSearchValue("Email"),"",GetSearchValue("Email"))%>
Example:
dashboard.html.twig:
<% extends layout.twig.html %>
<% include ('filter.html.twig') %>
<% block javascripts %>
< %endblock >
filter.html.twig:
filter form definition and html
filter form definition and html
filter form definition and html
<% block javascripts %>
javascript for use in filter form
javascript for use in filter form
<% endblock %>
I want the filter's javascript to be set in the layout, because that way it is loaded AFTER the JQuery.
But the Javascript is rendered right after the filter form, so getting $ is undefined.
So whatI want is the Javascript defined in filter.html.twig to override the block in layout.html.twig, same as extends.
Thanks!
Included templates can't alter the blocks of their includer. The "best" way I found i using the deferred block extension. It delays the render of a block. If you follow the advanced example in my link you can see how you could solve it
I want to produce output like <% name %> which is for Backbone.js template with EJS. I can use
<%- "<%= name %>" %>
to solve it, but I think it makes some trouble.
EJS has no way to escape open and close tags. You can specify another open and close tags like {{ and }} that not confused with another document content.
I am calling jsp on <a href> tag like this
<div align="left"><%=searchList1.getProjid()%></div>
I want to get the value of searchlist1.getProjid in UpdateProject.jsp
How can I do it... please suggest me with example code.
You can send it as parameter:
<div align="left"><%=searchList1.getProjid()%></div>
And then use it in the new jsp like:
request.getParameter('projid');