Kentico Macro to Get Page Type - macros

I'm new to Kentico and am using version 9 for a website. A graphic designer asked me if I could create a macro or code that adds the page type of a page to the body tag as a css class. Has anyone done this before?

Following is a macro, that gives you page type info object:
{% DocumentContext.CurrentDocument.NodeClass #%}
Go to System -> Macros -> Console to see/try available macros.

<body class="{% CurrentDocument.NodeClass.ClassName.ToString() #%}">

I use Kentico 8.2 version and I can get this using:
<body class="anotherClass {% ClassName #%}">...</body>
Maybe this work also in Kentico 9.
Hope this help!

DocumentContext.CurrentPageInfo.ClassName

Related

How to remove More help link from moodle 2.8 help popup?

I want to remove More help link from moodle 2.8 help pop up.
I am attaching screenshot:
After click on this link, open docs.moodle.org/28/en/mod/lesson/view page
Got solution from moodle forum but not working for me.its for moodle 2.7
There is no option to remove the help link without modifying Moodle code. However you could either:
Define $CFG->docroot in your config.php to customise the URLs, or
Use CSS to hide the link.
If modifying core is not an issue, the easiest way is to modify the function get_formatted_help_string so that it never looks for the language string ending in _link. You would remove the following block:
$helplink = $identifier . '_link';
if ($sm->string_exists($helplink, $component)) { // Link to further info in Moodle docs.
...
}

FLUID Link with target and class

I wrote a small Frontend Plugin "Text+Image+Link".
If my editor choose a file link or an external Link, he also assign to open the target in a new window: _blank
In my Fluid-Tempalte I wrote
<f:link.page pageUid="{txtTarget}" class="btn btn-default">{txtLink}</f:link.page>
But there's no support to the link target, here's the output:
<a class="btn btn-default" href="http://kbs2015.com">Read more</a>
There's no target-attribute, but I chose it at Link Wizard (flexform): target:_blank !?
-
I try it like this:
<f:format.html><link {txtTarget}>{txtLink}</link></f:format.html>
There's the right link and target but no CLASS! Output:
Read more
-
How can I use target (from wizard) and two classes for a Link in FLUID?
DO I need a new ViewHelper? I don't know? Can I solve my problem with Fluid?
Thanks for your help.
( TYPO3 6.2.8 )
It depends on which TYPO3 version you use. TYPO3 7.0 has a new ViewHelper (TypolinkViewHelper) which handles Typolinks created with the link wizzard and respects link targets. In TYPO3 4.5 and TYPO3 6.2 there is no such viewhelper, so you should try to backport the viewhelper from TYPO3 7.0 to your extension.
Copy the content from the linked viewhelper to the Viewhelpers directory of your extension and adjust the namespace to match the one from your extension. Then you can use the viewhelper in your extension.
It won't work if I copied the TypolinkViewHelper from TYPO3 CMS 7.0
I've got always the error
Error Warning: Could not analyse class:Tx_MyExtension_ViewHelpers_Link_TypolinkViewHelper maybe not loaded or no autoloader?
I try it successfully with a Test-ViewHelper, but they not with the TypolinkViewHelper.php
Anyway ... I solve it with this FLUID-Snippet:
<f:format.html><link {txtTarget}><span class="btn btn-default">{txtLink}</span></link></f:format.html>

Wicket AjaxLink generates no JavaScript

I started experimenting with Wicket AJAX functionality and wanted to implement an AjaxLink.
This is the associated markup/java-code:
<a wicket:id="testlink"></a>
---
AjaxLink<Component> link = new AjaxLink<Component>("testlink") {
#Override
public void onClick(AjaxRequestTarget target) {
System.out.println("called");
}
};
add(link);
But the onClick-method is never called, I guess because the generated HTML looks like this:
<a wicket:id="testlink" id="testlink7" href="javascript:;"></a>
Any ideas on what I am doing wrong?
This href="javascript:;" works because Wicket 6 uses JavaScript Event registration. Look at your webpage in some browser dev tool like in firefox. Point the inspector to the link and read it's id, then go the the head section and expand one of the <script type= text/javascript></script> tags. There you should find the id of the link and see that there is an line where a click event is attached to the id of the link. The URL there is executed when you click the link.
Thanks Robert for clarifying the ajax mechanisms of Wicket 6 - I'm rather new to this topic and the insights you gave me helped solve the problem.
Actually it was caused by some jQuery inconsistency I still haven't fully untangled, apparently coworkers used different jQuery-versions within different of our Wicket modules and somehow Wicket used not the one it was shipped with but a wrong one when trying to attach the event listener to the component.
When removing the unneccessary old jQuery libraries Wicket started to work fine - now I just have to get the components depending on the other jQuery libraries working again, but thats a different story :)
In my situation, I removed the following onload on body tag and the AjaxLink onclick function worked again.
<body onLoad="MM_preloadImages('template-image/searchbto.png');">

Netbeans (7.0) HTML 'dynamic' code templates

I know how to define static, standard code templates in NetBeans and I am wondering whether it's possible to define more customized and dynamic templates.
For example, when i type div.className to generate me a HTML <div> element with the class I specify.
Start netbeans and go-to: Tools->Plugins menu,Available Plugins tab, then search for Zen Coding hit install.
type: div.className and hit: ctrl+alt+n to get: <div class="className">
You will notice the new Edit->Zen Coding menu.
Installation & usage: https://github.com/lorenzos/ZenCodingNetBeansPlugin#readme
Read more about Zen Coding at: http://code.google.com/p/zen-coding/

Custom Lift tags don't work

The following types of tags in Lift do not seem to work for me:
<lift:snippet type="MyClass:render" />
<lift:MyClass.render/>
<lift:MyClass/>
Using these tags results in a Class Not Found error. If I attempt to call a class using
<div class=lift:myclass.mymethod />
it can work. Or if I call it using span tags. For instance, the Hello World example in Pollak's Simply Lift works for me, successfully displaying the Howdy method with the following code:
<span class="lift:helloWorld.howdy">
Welcome to your Lift app at <span id="time">Time goes here</span>
</span>
Currently, my problem is coming from attempting to implement Exploring Lift's (aka The Lift Book) OpenID example in Chapter 13.1. I have downloaded OpenID4Java using sbt as well as the lift-openid library. That example can be found at http://exploring.liftweb.net/master/index-13.html. I have implemented the change to the Boot class, and created the OpenID class and the SimpleOpenIDVendor class. But creating an html file containing
<lift:OpenID.form>
<openId:renderForm/>
</lift:OpenID.form>
causes the following error to be displayed in the browser:
Error processing snippet: openid.form
Reason: Class Not Found
XML causing this error:
<lift:openid.form xmlns="http://www.w3.org/1999/xhtml">
<openid:renderform>
</openid:renderform></lift:openid.form>
The class OpenID was placed in a package that starts with the package code, which is being implicitly found by Lift. It is included in the Boot.scala file with the line
LiftRules.addToPackages("code")
So, I am at a loss. Any ideas?
Note that other lift tags such as lift:bind-at and lift:surround and the like work fine.
As dave posted under my original comment, the problem was the HTML5 parser. Lift is case-sensitive, and cannot find a class with varying case. Since the HTML5 parser automatically makes tags lowercase, you can't use custom lift tags anymore. Instead, you have to use something like
<div class="Lift:MyClass.render"></div>
Note that you CANNOT have
<div class="Lift:MyClass.render" />
as HTML5 apparently does not support such tags.
My OpenID4Java problem is therefore resolved by using:
<div class="lift:OpenID.renderForm">
</div>
Why I don't need to use openid.form still is uncertain. It could be possible I'm implementing it slightly off, but I confirmed that it will take me to an openid login page if I put in the openid link, so it is indeed functional.
Sources:
http://groups.google.com/forum/#!topic/liftweb/H-xe1uRLW1c
https://groups.google.com/group/liftweb/browse_thread/thread/3948df1eee6ec271/ (thanks fmpwizard)