thymeleaf fragments include - include

I keep getting "Error resolving template "fragments/common", template might not exist or might not be accessible by any of the configured Template Resolvers". The path of common.html file is correct, fragments->common.html. My folder structure:
-- WEB-INF
---- templates
------ fragments
-------- common.html
------ index.html
Any help or pointers?

I know I'm late to the party but I thought I'd share what I'm doing which to me seemed somewhat easier.
I use a java config class to configure thymeleaf and I use the template alias to make it easier:
resolver.addTemplateAlias("footerTemplate","templates/footer");
Then I can simple do something like:
<div th:include="footerTemplate :: copy"></div>
assuming you have your suffix and prefix setup correctly.

Alright, I found the problem. Wrong syntax, the error message says it all. I was using common.html, the template name included in include statement is incorrect.

Related

What's the max number of folders nested in an ExtJS Application?

Well, turns out I have an ExtJS application. My views folder structure (if not the best), is this:
CE\app\view\process\Pre
OK, inside this folder, I created some components in some other folders, such as:
CE\app\view\process\Pre\StudentData\Tabs\GeneralDataTab.js
CE\app\view\process\Pre\StudentData\Tabs\AddressDataTab.js
CE\app\view\process\Pre\StudentData\Tabs\SchoolDataTab.js
CE\app\view\process\Pre\ParentData\Common\DataPanel.js
I define all of these componentes like this:
Ext.define("CE.view.process.Pre.StudentData.Tabs.GeneralDataTab", {
//some code to define and create my class
});
According to my research, I must name my class with the original folder structure, separared by dots.
Everything was fine while I was developing, but once I executed SENCHA CMD BUILD to test the results, I got this error:
Couldn't find "Tabs" of undefined/Couldn't find "Common" of undefined
I checked many times the paths, the names and everything was OK.
So, I remove the last folders (Tabs/Common):
CE\app\view\process\Pre\StudentData\GeneralDataTab.js
CE\app\view\process\Pre\StudentData\AddressDataTab.js
CE\app\view\process\Pre\StudentData\SchoolDataTab.js
CE\app\view\process\Pre\ParentData\DataPanel.js
And voila! My application was working.
Everything happened after I ran SENCHA CMD BUILD, 'cause not even with SENCHA CMD BUILD TESTING I got this error.
Do you know if I mustn't nest that much folder structure in a Sencha ExtJS app?
I know I can define paths in the paths configuration of the application. I tried this, and renamed my classes, but It didn't work either.
Do you thing I did something wrong? Is it a bug of Sencha CMD? I'm using the version 4.0.1.45.
Thank you in advance.
EDIT:
I would like you to let you know that I resolved this problem, and I hope this could help you too.
In fact the problem wasn't the nested folders but the name of the classes.
In my Application.js file I added a new path, like this:
paths: {
//...
'ProcessViews' : '../CE/app/view/process',
},
And now my classes name look like this:
Ext.define("ProcessViews.Pre.StudentData.Tabs.GeneralDataTab", {
//some code to define and create my class
});
And now I don't get any error message and the application runs OK.
So, looks like a class name can't be that long. If you need it to, then you should use a path defined in the Application.js to make a shorter name. :)
Thank you.

How to select module name in urlfor function inside template

Im working in a beego application with 2 modules, and has a controller with the same name in both modules.
When I use {{urlfor}} in template the generated url is linking with the other module.
Anybody know if its posible select module name in urlfor function? I search in the docs and cant see any reference about. Im currently use beego 1.4.3
Thanks in advance
For anybody with the same issue:
The problem is how I implemented the application folder structure for modules. It seems not be compatible with {{urlfor}}.
The correct answer come from github: https://github.com/astaxie/beego/issues/1100
In the link you can found the correct directory tree

Dojo File Caching in Worklight

When using Dojo file caching with Worklight receiving a 404 Error when running in Simulator. It appears the file being loaded is not being copied from the common area to the device. Is there something else I need to define in my project to make that happen? There must be a convention and I wanted to follow it going forward as I expect to have more template files in the project.
My define statement in a .js file:
define(["dojo/_base/lang", "dijit/layout/ContentPane", "dojo/dom", "dojo/text!./templates/Order.html"], function(lang, ContentPane, dom, template){
...
var cp1 = new ContentPane({
title:"Order",
content: lang.replace(template, someJson)
}).placeAt("temp");
My folder structure:
In the common/js directory I have the above code in a .js file and I have a templates folder to keep the Order.html and I would expect to have other template files stored there in the future.
Error on the console:
GET http://localhost:10080/DojoProject/apps/services/preview/DojoApp/windowsphone8/1.0/default/layers/templates/Order.html 404 (Not Found)
It seems that the way you are specifying the path, browser tries to find the file in the "layers" folder which is sibling to "templates".
Have you tried to modify the "dojo/text!./templates/Order.html" to something like: "dojo/text!./../templates/Order.html" to navigate one level up, then go into the templates folder?
I'm not sure this will work, but I think it worths a try.

Magento override abstract block

I need to override an abstract Block in Magento : app/code/core/Mage/Eav/Block/Adminhtml/Attribute/Edit/Options/Abstract.php
I need to add a function to this class similar as getOptionValues for a specific product type.
I tried to override by adding the same structure (folder creations and copy the Abstract.php file) in app/code/local/Mage/Eav/Block/Adminhtml/Attribute/Edit/Options/Abstract.php, but it seems not working.
Anyone can help me ?
Am I missing something ?
Do I need to create app/etc/modules XML or the app/code/local/Mage/Eav/etc XML ?
Thanks a lot !
In order to override the app/code/core/Mage/Eav/Block/Adminhtml/Attribute/Edit/Options/Abstract.php
abstract class, you need to place the file as: app/code/local/Mage/Eav/Block/Adminhtml/Attribute/Edit/Options/Abstract.php
which means your local pool path for Abstract.php is correct.
The only thing that i doubt why it's not loading is: may be Compiler is enabled for your store(be sure to check from System > Tools > Compilation > Status should be Disabled).
Additionally check your log files(var/log/*.log) if there are any errors.
I would refer the following article for configuring your magento for development / debug mode:
http://www.blog.magepsycho.com/configuring-magento-for-development-debug-mode/
Hope this helps a bit.
Regards

Changing static files directory in MVC3 causes 404

I'm attempting to set up my own directory structure for serving up static files:
\s (statics)
\c (css)
\j (js)
\i (images)
etc ...
The issue is that I'm seeing a 404 for this directory when referencing it. When I inspect the file path, it is pointing to the correct location localhost:port/s/c/style.css, but for some reason it can't find the file.
Is there a way that I can make this path available via my Web.config, or possibly through my Global.asax file via routes? I've heard there are performance penalties associated with using routes, so using the Web.config - or an alternative solution - is preferred.
http://localhost:port/s/c/style.css should work without any problems. It seems that you have specified a wrong filename which is the reason for the 404 error.

Resources