Trying to build my first extension, but need help

In this section you can share self-made extensions with other users of WYSIWYG Web Builder.
There is a dedicated section for commercial extensions.
Post Reply
supersonictt
 
 
Posts: 398
Joined: Sun May 15, 2011 10:27 am

Trying to build my first extension, but need help

Post by supersonictt »

Hello,
I am very new to EB, and the extension I build is very simple, it doesn't have any javascript files, just <script>.
So there is a variable:
var my_str = "Hello, try it yourself";
In EB, how do I allow users to change "Hello, try it yourself" so the user can put whatever they wish?
Thanks.
User avatar
Adendum
 
 
Posts: 725
Joined: Fri Apr 22, 2011 4:50 pm
Location: London, UK
Contact:

Re: Trying to build my first extension, but need help

Post by Adendum »

Hi,

Two things needed.....

[1] set the variable string in my_str between $ in the whatever section the variable needs to appear - so it will look like $my_str$

[2] In the Properties section you need to allow the user to specify the value of $my_str$. So add a category and then add a property. Enter a name for the property (which gets transcribed as the variable name - but you can edit that after), enter the other values, make the TYPE and edit field and you're done.
Aditerum - No longer supporting WWB extensions - refer to CJS.
Aditerum - No longer supporting WWB templates - refer to CJS.


WWB 9.4; Ext Builder 4.2; Windows 10 64bit; Intel Core i7-3770 Processor 3.40Ghz; 16.0Gb RAM
Death to Internet Explorer!
supersonictt
 
 
Posts: 398
Joined: Sun May 15, 2011 10:27 am

Re: Trying to build my first extension, but need help

Post by supersonictt »

Adendum wrote:Hi,

Two things needed.....

[1] set the variable string in my_str between $ in the whatever section the variable needs to appear - so it will look like $my_str$

[2] In the Properties section you need to allow the user to specify the value of $my_str$. So add a category and then add a property. Enter a name for the property (which gets transcribed as the variable name - but you can edit that after), enter the other values, make the TYPE and edit field and you're done.
Thanks for the reply :)
hmmm, that didn't work properly!!
Should it be like this:
var my_str = "$here$";
and in properties: Type: edit
Variable: $here$
?
User avatar
Adendum
 
 
Posts: 725
Joined: Fri Apr 22, 2011 4:50 pm
Location: London, UK
Contact:

Re: Trying to build my first extension, but need help

Post by Adendum »

supersonictt,

Yes, sorry I didn't properly read the first post. As the code is actualy script the variable will have to go between " marks so where you want

var my_str = "Hello, try it yourself";

to be a variable you would replace it with

var my_str = "$my_variable$";

And you can have whatever name you want for that variable string - doesn't have to be my_var. When you specify the name in the properties you'll probably use something sensible and easy to understand, like Name of Country which will result in a variable name of $nameofcountry$ so your script code would then read

var my_str = "$nameofcountry$";

:)
Aditerum - No longer supporting WWB extensions - refer to CJS.
Aditerum - No longer supporting WWB templates - refer to CJS.


WWB 9.4; Ext Builder 4.2; Windows 10 64bit; Intel Core i7-3770 Processor 3.40Ghz; 16.0Gb RAM
Death to Internet Explorer!
supersonictt
 
 
Posts: 398
Joined: Sun May 15, 2011 10:27 am

Re: Trying to build my first extension, but need help

Post by supersonictt »

Yes, that worked that way :)
Initially, the extension works, but still, it has other variables which will need more testing... Plus, I could make it work when page loads as an event.
Would you like to have a look at it? Personally, I liked the script :) that's why am trying to make it as an extension for WWB users to use it.
Thanks a lot for your help :)
User avatar
Adendum
 
 
Posts: 725
Joined: Fri Apr 22, 2011 4:50 pm
Location: London, UK
Contact:

Re: Trying to build my first extension, but need help

Post by Adendum »

Sure. As the PM system is disabled you will need to contact me via my web site. Email me from there so I get your email address and then you will be able to email me back with an attachment.
Aditerum - No longer supporting WWB extensions - refer to CJS.
Aditerum - No longer supporting WWB templates - refer to CJS.


WWB 9.4; Ext Builder 4.2; Windows 10 64bit; Intel Core i7-3770 Processor 3.40Ghz; 16.0Gb RAM
Death to Internet Explorer!
User avatar
BaconFries
 
 
Posts: 5364
Joined: Thu Aug 16, 2007 7:32 pm

Re: Trying to build my first extension, but need help

Post by BaconFries »

@ supersonictt can I bring this to your attenion before building and sharing extensions. please ensure that you have permission to use the script, do not use scripts that you have scraped for another site HTML source code, please provide a link back to the original author of the script, check the copyright can it be distributed freely etc etc.... you can read more about the rules of this at the following
viewtopic.php?f=42&t=17899
supersonictt
 
 
Posts: 398
Joined: Sun May 15, 2011 10:27 am

Re: Trying to build my first extension, but need help

Post by supersonictt »

@BaconFries
Thanks for pointing this out. I will do this for sure, and now, I am just trying things out with EB.
I will contact the developer of the script and ask him for permissions to use it :)
Thanks a lot for reminding me :)
Post Reply