Tell TYPO3 extension to use different template using Typoscript - templates

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.

Related

'$' is undefined in SharePoint Search Display Template

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>

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.

TYPO3 custom extension templates

I am currently working on a new website with TYPO3 and now I am facing a big problem with template/cache.
Environment:
Extension "Portfolio" adds a new content element with Extbase/Fluid-Template. The template contains only the sentence "Create custom template" because I don´t want to provide a default template.
Extension "Layout A" contains the main template for the website, as well as the template for "Portfolio".
Cases:
When I am logged in as admin always the correct template is used.
When I am logged out and make "Clear all cache" in install tool the first page I load afterwards gets the correct template. The second/third/... page uses the first and wrong template.
Settings:
"config.no_cache = 0" is disabled
TYPO3 6.2.2
RealURL enabled
I added a TypoScript Text-Object with the template path to my fluid template and printed it in fronted. Always the path of the correct, second template.
Does anybody have an idea what´s the problem?
Thanks in advance!
Best regards
Boris
Install Tool Clearcache will clear the extbase cahe, so maybe the tempalte paths might be lost.
You should set the path to the templates explicitly via:
plugin.portfolio.view {
layoutRootPath = {$path}
partialRootPath = {$path}
templateRootPath = {$path}
}

How can I develop a list template for a dynamic list in Liferay with action buttons?

List template in dynamic data list in Liferay
I have already read this post and also another webapplicationdeveloper blogpost but not find any idea to get action button in customly applied template to dynamic data list.
I have also tried including that default record_action.jsp of dynamicdatalist portlet in vm template but its not working and also set the property below
journal.template.velocity.restricted.variables =
in portal-ext property but still I am not getting the action button in my custom template
I have already tried this :
#
set (
$categoriesService = $portal.getClass().forName("com.liferay.portlet.asset.service.AssetCategoryLocalServiceUtil").getMethod("getService", null).invoke(null, null))
My answer is: Yessss, it works. But I want use a jstl lib (e.g. <aui> or <ui>) as well. In my opinion the simpliest way to do it is include jsp file to themeServletContext. Put your file.jsp into your theme:
your-theme/docroot/path/to/your/jsp/file.jsp
and paste this piece of code into your vm (for example portal_normal.vm):
$theme.include($themeServletContext, "/path/to/your/jsp/file.jsp")
In this case it unable to find the $theme variable my page displaying the $theme as it is...:(
Please help:
Leave velocity, it's too poor to use taglib, and switch to freemaker language: more powerfull and full support of taglib.
Here there is an example to use freemaker for theme develment, but it's good starting point also to template in dynamic data list.
https://www.liferay.com/it/web/mika.koivisto/blog/-/blogs/using-freemarker-in-your-theme-templates
Look also freemaker guide: http://freemarker.org/docs/index.html

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.