2sxc DNN objects on Hybrid templates - 2sxc

Having just the #inherits Custom.Hybrid.Razor12 at the top of the template breaks it when using DNN objects.
... The type or namespace name 'Portal' does not exist in the namespace 'Dnn' (are you missing an assembly reference?)...
Adding #inherits ToSic.Sxc.Dnn.RazorComponent fixes it, everything displays properly.
My question is do I need both or just the latter? Everything seems to work fine if I remove #inherits Custom.Hybrid.Razor12, but perhaps there's a better way to have the DNN objects without breaking the template. Or it may be a bug?

I think Daniel (iJungleBoy) already answered this in the comments here.
Correct way to get access to Dnn Stuff while using Modern 2sxc Hybrid Views
"to get the Dnn object you must use the base class Custom.Dnn.Razor12 - it's only difference is the Dnn object. That cannot work on Hybrid, because Oqtane won't have a Dnn object - otherwise it's the same as Custom.Hybrid.Razor12"

Related

Could not navigate to "view"

I am using vaadin 10. I would see this error on my login view class if I used #Route("") but when I write it as #Route(value="") it worked. But doing that to another view I get this error. Most questions asked are way too advanced. I just have a simple project with vaadin and springboot.
With the source code you provided as link in the question's comments, I cannot reproduce your issue. However, there were 2 problems with your code before I was able to run the application:
the #Theme annotation needs to be placed on a view or router layout; I moved it to your LoginView
the Valo theme is not available in Vaadin 10, so the reference on ValoTheme class was a compile error; I removed it
After fixing these problems everything ran fine, #Route(value="") and #Route("") were both working. Which Java version are you using? Java 8 is required minium for Vaadin 10. Also please try to remove lombok for testing, maybe it is causing a problem.
Try annotating your EmployeeDisplay class with #Route(value = "employeeDisplay") instead of #Route(value = "/employeeDisplay"). In other words, remove the /.

Freemarker / Spring MVC / Dojo integration

has anyone been successful in using dojo > 1.6 to declaratively build widgets with the spring MVC toolkit inside of Freemarker templates ?
More precisely, Freemarker chokes when transitioning from old style dojo (which we used until now) as in :
<#form.select path="fruit" dojoType="dojo.dijit.Select"/>
to the new dojo syntax (which we would like to use), as in :
<#form.select path="fruit" data-dojo-type="dojo/dijit/Select"/>
It is worth mentioning that the transition works with plain HTML elemnts, as in :
<div data-dojo-type="dojo/layout/TabContainer"/>
Hence, it seems the use of "dashed attribute names" is not possible for external taglibs included in FTL pages.
Can anyone confirm this, or, by any chance, show how it can be done ?
Many thanks.
Yip, the FreeMarker 2.3 syntax can't handle dashes in parameter names as those are subtractions and then a comparison in it. That can't even be changed without breaking backward compatibility. As things stand, FreeMarker 2.4 target that and some other problems that require syntactical changes, but that's far away.
What most do is using date_foo instead of data-foo and then replace the _ with - when they print the attribute name. However, #form.select wasn't written by you, so it can get tricky. Well if you are lucky, it's a TemplateDirectiveModel and then you can write your own TemplateDirectiveModel that delegates to it after doing the replacements... but if it's a macro, you are out of luck.
I wonder if 2.3.21 should just allow foo\-bar\-baaz or something like that as an identifier... ugly but at least a solution before 2.4.

Trying to override templates in FOSUserBundle, but having no effect

I'm trying to modify the skin of the register.html.twig template found in FOSUserBundle/Resources/views/Registration/register.html.twig.
I've basically followed the instructions in the documentation down to a T.
Like it told to do so, I created /app/Resources/views/FOSUserBundle/views/Registration/register.html.twig.
Cleared the cache (and browser cache just to be sure)
NO effect! I've put a blank file in register.html.twig, but no matter what I put there, when I go to /register/, I still see the default template.
Yep, these things happen all the time.
It should be:
/app/Resources/FOSUserBundle/views/Registration/register.html.twig
Reference

Pretty dump variable/object in Symfony 2.*?

When developing stuff I need to output the state of some instance in order to inspect it.
While using CakePHP I always had a debug() function which does some kind of var_dump inside a <pre> html element, so the content is readable.
Is something similar in Symfony 2.x too?
exit(\Doctrine\Common\Util\Debug::dump($someVar));
use
\Doctrine\Common\Util\Debug::dump($user);
As of today, one of the best ways to debug in Symfony that I know of is the Ladybug Bundle. Its output is similar to xdebug's, but it has some nice features, like a collapsible tree structure for arays or automatically linking to documentation pages (supporting standard PHP, Doctrine and Symfony).
You can find some great examples of its use on the README.
Now there is a new function in Symfony - dump(), have a look at http://symfony.com/blog/new-in-symfony-2-6-vardumper-component

Could not resolve * to a component implementation

I'm a wee bit stuck on this, and was hoping you might have some input to help me.
I'm getting the "Could not resolve * to a component implementation." error message. However, everything I've read about this via Google hasn't helped my case in the slightest. I presume I'm just missing something obvious, but maybe its something more serious.
So, to solve this problem, I've tried two things, and both work, as far as they take me. First, I added a new component, of the exact same variety, and then copied the contents of the erroring component into it. I replace the viewstack 'page' with the new component (which as near as I can tell is IDENTICAL, but with a different name), and the compiler error goes away.
I can also solve this by simply renaming the original component & letting FB4 refactor for me. The error goes away again. But if I then re-rename back to the original name, I get the compiler error again.
I've tried to clean the project several times, and that doesn't help. Neither does deleting the workspace, and re-importing the project.
I'd really like to understand what I've done wrong here. What am I missing?
Thanks much!
Try the following:
Right-click on your project in the
Package Explorer.
Select "Properties" in the pop-up
menu (last item).
Click "Flex Library Build Path"
Click the "Classes" tab
Try to find the name of your new component in there. If you do, see if it is checked or not. If it is not, check it. That should solve the problem right there, but you may have to clean and (sometimes) quit FB4 and relaunch.
Usually errors like this means you have two components named similarly and the compiler couldn't tell which one you wanted to use.
Do you have another component with the same, even in a different package? Or do you have a variable in your component the same name as the component? Be sure to check your SWCs and/or Library projects.
I'm assuming this is a compile time error; is that correct?
In my case the problem was solved by changing the SDK version of the Flex Compiler to 4.5
You can try with different SDK versions, until you get your component to compile or until the error changes to something related to a theme related error.
After changin this I got an error related to a propertie that is not supported by the current theme, so I open the component in design view and in the Properties View selected the Appearance tab and changed the theme from SPARK to HALO
Hope this is usefull for somebody else
One cause of this error is that the default xml namespace for the component is not the same as the the package in which the component resides.
Check to make sure that the default xmlns entry in the component definition is the same as the package.
For example:
If you have an component MyControl.mxml located in the package com.company.components.controls
The mxml opening tag might look something like this:
<MyControl xmlns:mx="http://www.adobe.com/2006/mxml"
xmlns:util="com.company.components.util.*"
xmlns:components="com.company.components.*"
xmlns="com.company.components.controls.*">
Note how the default xmlns entry points to the same package.
Why this happens:
What often happens is that after you refactor an MXML class by moving it to a new package you will end up with a an valid but not correct mxml definition.
For example say I refactor and move the MyControl.mxml from the com.company.components package to the com.company.components.controls package. The xmlns definitions will not be updated so they will look like this:
<controls:MyControl xmlns:mx="http://www.adobe.com/2006/mxml"
xmlns:util="com.company.components.util.*"
xmlns="com.company.components.*"
xmlns:controls="com.company.components.controls.*">
Note how the default namespace still points to the com.company.components package and the mxml tag MyControl has to be prefixed by the namespace controls this is an indication of the issue.
Now here is the catch; This is technically valid and will often work. The reason is that it is valid and the components can all be found in their defined xmlns locations.
The problem comes when you try to use a component that is expected to be found, by the framework or parent component, in the default namespace. A good example of this is and other subcomponents of the parent mxml component you might be extending.
To fix this you should modify the mxml tag and namespaces so that the default namespace is the same as the current package. (As in the first example)
Might be I am very late to answer this question, but this might be because the package name which is associating with your class is not the exact and appropriate.

Resources