'$' is undefined in SharePoint Search Display Template - templates

I customized a display template. The html display template code is exactly the same as UAT. When I deployed to Prod, I got this error when ran a search:
Display Error: The display template had an error. You can correct it by fixing the template or by changing the display template used in either the Web Part properties or Result Types.
'$' is undefined (CoreRender: ~sitecollection/catalogs/masterpage/Display Templates/Search/Item***.js)
I checked in both the html page and js file, there is no extra $ in the file. One time I fat fingered an extra $ to the html page but couldn't find anything wrong this time.
What could be the issue?

This sounds you used jQuery library in your template, if so, try to include it in your display template as the demo
<body>
<script>
$includeScript(this.url,"~sitecollection/style library/js/jquery-1.10.2.min.js");
</script>

Related

How to modify a pyramid template on the fly before rendering

please I am working on a site where I would scrap another website's html table source code and append it to my template before rendering my page.
I have written the script which stores the html code in a variable but don't know how to appendix it.
Kindly suggest.
If you're using jinja, try this:
<div class="html-content">{{scraped_html|safe}}</div>
Here is the code for the chameleon template system. HTML is the variable that contains your html code that is passed to the template.
<div>${structure: HTML}</div>
Or I believe this will work also
<div tal:content="HTML"></div>

Shopify: Include a template into another template

I'm trying to customize a Shopify theme and I want to include a template into another template, but this seems to work for snippets only.
Detailed: I want to add the login / register forms into a dropdown menu in the header which appears onlick.
So I added to my theme.liquid file the following code:
{% include 'customers/login' %}
But this returns the following error:
"Liquid error: Could not find asset snippets/customers/login.liquid"
This means that include can be used only for snippets? No template can be included / called into another? Or am I missing something?
Any way around this or a direct command for templates / pages?
No Shopify template can be included / called into another template. You should rely on snippets.
Shopify {% include '' %} works only with snippets, hence why your returned error by defaults states that it looked into snippets folder and could not found what you have included as in:
"Liquid error: Could not find asset snippets/customers/login.liquid"
That pretty much says the liquid looked for the login.liquid file inside the customers folders in snippets, but could not find it!
In this case, you would want to go to templates ==> create new templates and duplicate the file you want to make changes on.

Tell TYPO3 extension to use different template using Typoscript

I'm trying to get an extension/plugin on a page to use a different template from the one its hardcoded with.
I made an html template stored in:
typo3conf/ext/myextension/pi1/new_extension_template.html
I made a typoscript template object in the root of my site (so it would definitely get picked up).
In it, I have defined the following simple Typoscript (names changed for demonstration)
plugin.tx_myextension_pi1 {
templateFile = typo3conf/ext/myextension/pi1/new_extension_template.html
}
However when I load the page containing the plugin, I get a "no typoscript template found" error on that black TYPO3 error page.
I have tried a bunch of alternative ways in case the syntax was wrong but the above worked for me when working with the tt_news plugin.
E.g I have tried these without success too:
templateFile.file = typo3conf/ext/myextension/pi1/new_extension_template.html
...
tempfile.template_file = typo3conf/ext/myextension/pi1/new_extension_template.html
Any ideas what I'm doing wrong?
Can html templates stored in typo3conf be called via typoscript stored outside the plugin?
I'm thinking perhaps html template files would have to be stored in fileadmin/plugin_templates/ for this to work.
You are mixing things: no typoscript template found means that on the page you inserted the plugin there is no TS template available.
Page with plugin isn't nested under the main page (which - as I assume - has main TS template and is displayed properly), so just drag it into the main page, or create new TS template on its level.

modx is only showing html code, not the template

I have installed ModX and Downloaded the "Basic" Template in the Extensionmanager! I chose the Basic Template at my first Page for the Resource! I cant find a Globalsetting to choose an Template? My problem is that if iam going to the site i only get the pure html code shown, no website! Why is this?
AFAIK there is no "Globalsetting" to choose a template. One of the nice things with MODX is that each resource can specify which template to use. So you can mix and match as required.
You could check if you have set the base href tag in head like this:
<base href="http://www.yoursite.com"/>
It will tell the site where to start looking for the other files that you have included in your markup.

PWC6228: #{...} not allowed in a template text body

I have a JS script which is called when a submit button action is fired successfully:
<h:panelGroup rendered="#{user$webreports$webfilteroverview.submitted}">
<f:verbatim>
<script type="text/javascript">alert('Done!');</script>
</f:verbatim>
</h:panelGroup>
the above code works perfect. What I want to do is to get the alert box text from resource bundle:
<script type="text/javascript">alert('#{msg.report_alert_text}');</script>
but I get error:
PWC6228: #{...} not allowed in a template text body.
I did this:
<h:commandbutton onClick="alert('#{msg.report_alert_text}');"/>
and it was working fine. I don't understand why the above code doesn't work. Is it possible to do this? If yes, what is wrong with the above code? Thanks in advance.
PWC6228: #{...} not allowed in a template text body.
You're apparently using the legacy JSP(X) instead of its successor Facelets. Deferred EL #{} in template text is not supported by JSP(X). It only supports standard EL ${} in template text (template text means outside tags / JSF components):
<script type="text/javascript">alert('${msg.report_alert_text}');</script>
If that doesn't work because ${msg} is not been prepared (the #{} will namely autocreate it if it does not exist yet at that point of the view), then you need <h:outputText> instead:
<script type="text/javascript">alert('<h:outputText value="#{msg.report_alert_text}" />');</script>
You'll only need to remove that <f:verbatim> tag in order to get JSF components to run there. The <f:verbatim> is a leftover from JSF 1.0/1.1 and not necessary anymore since JSF 1.2 and deprecated since JSF 2.1.
This problem has nothing to do with JavaScript. You got the error from the webserver, not from the webbrowser.