Skin Extension tutorial

Prior to getting started with the Skin Extensions tutorial here:

http://www.xwiki.org/xwiki/bin/view/Documentation/DevGuide/Tutorials/SkinExtensionsTutorial/

I went through a similar set up like the FAQ tutorial:

  1. Created a SkinExt class
  2. set parent to SkinExt
  3. set name to SkinExt
  4. clicked ‘create this class’

On the next page:

  1. #set($defaultSpace = ‘SkinExt’)
  2. #set($defaultParent = ‘SkinExt.WebHome’)
  3. clicked ‘save and view’

After that I followed the tutorial:

  1. created an JavaScript Extension object
  2. wrote the hello world code
  3. set the rest of the settings as instructed
  4. was on my home/SkinExt page and hit edit in Xwiki
  5. dropped the velocity code in there as is
  6. hit save and view
  7. no pop up with hello world

am I missing something? Any help is appreciated–trying to create a custom skin/get a feel for writing extensions!

Thanks in advance!

Hi,

I don’t get what you want to achieve here? why do you create a class as your first steps? Maybe your are biting off too big chunks to swallow?

Why don’t you first try to follow the tutorial you linked to, to have one page that shows your alert?

Maybe then you should try to combine your extension with classes.
If you try to include your extension in your class you want to add the reference to your extension in the sheet, so that instances of your class execute the code. Then you need to create an instance…

Walk slowly, step by step, xwiki is a too powerful tool to manage it in one go. At least this is my experience.

Good luck

rbr

1 Like

Understood! You’re definitely right–XWiki is a lot to take down. I’ll be stepping through these tutorials slower for sure.

With that said, I went back through the tutorial:

I followed the instructions on setting up the javascript extension object and dropped this code into the wiki editor of main:

{{velocity}}
#set ($discard = $xwiki.jsx.use(‘XWiki.Home.WebHome’))
{{/velocity}}

However, no pop up occured–where am I going wrong here? If this helps, I’m using Google Chrome but I don’t have any pop up blockers on.

Make sure you are calling the correct page. Do you have a page Home inside the XWiki page?
Maybe you want to call a JSX from “Main.WebHome”?

1 Like

The XWiki page I’m using is the Home or landing page that shows up when you first create the XWiki. I did also attempt dropping this code into the XWiki editor (I saw that the link in the navbar read Main/WebHome) :

{{velocity}}
#set ($discard = $xwiki.jsx.use(‘XWiki.Main.WebHome’))
{{/velocity}}

I’ll try and create a new page and see if that works.

I just created a page called SkinExt, created the javascript object and adjusted the settings as per the tutorial, and dropped this code in the XWiki editor:

{{velocity}}
#set ($discard = $xwiki.jsx.use(‘XWiki.SkinExt.WebHome’))
{{/velocity}}

I then hit ‘save and view’ and the pop up didn’t make an appearance unfortunately.

I apologize for the rapid posts!

I changed the setting for ‘use this extension’ to ‘On this Page or on demand’ instead of ‘on demand’ like the tutorial, and the message popped up right as the page loaded.

If that was the langing page of XWiki, than it’s reference is “Main.WebHome”, not “XWiki.Main.WebHome”. Read more about references at https://www.xwiki.org/xwiki/bin/view/FAQ/How%20can%20I%20get%20the%20reference%20of%20a%20page

1 Like