Recent Topics

Javascript on Sidebar

Started by on Feb 25, 2008 – Contents updated: Feb 25, 2008

Feb 25, 2008 21:08    

My b2evolution Version: Not Entered

Hi group,

Has anyone used Javascript? I have a script:

<script language="JavaScript" Type="Text/JavaScript">
<!-- Pledge Pop-up Window
function ChargeWindow(OrgID)
{
window.open('https://128bit.clickandpledge.com/Default.asp?ID='+OrgID,'ChargeWindow','toolbar=no,location=no,directories=no,status=yes,menubar=no,resizable=yes,copyhistory=no,scrollbars=yes,width=720,height=595');
}
//-->
</Script>

... that I'd like to use on the Sidebar. Can any one help me with how to do this?

Site: http://mynatt.no-ip.info/blogs
Version: 2.02 Alpha

Help much appreciated of course,

Dave

Feb 25, 2008 21:28

First, you should seriously consider upgrading. 2.0.2 will never see any support, and it's an "alpha" that got replaced 3 weeks later. You, and all users of "alpha" releases, should upgrade to 2.4.0-RC2 as soon as possible.

As to adding that script: simple. Use the "Free HTML" widget to add the script to wherever you want in whichever container you like.

Feb 26, 2008 00:09

Thank you; appears to be working fine. Is there a way to center the title or the icon? <center> didn't appear to work...

Dave

Feb 26, 2008 00:12

In the widget setting for the Free HTML widget you can name the class of the div the widget appears in.
That class / div you can style through css.
That;s about it.

Good luck

Feb 26, 2008 00:19

I don't see it in the link supplied above.
SideBar h3's have a css style already. You would need to give this a specific style but without seeing your source code it's just a guess to best solve the issue

Feb 26, 2008 00:39

Add

.widget_core_free_html {
text-align: center;
}

to your skins/custom/style.css file and your javascript-generated image in the free html widget will be centered.

Feb 26, 2008 14:54

EdB wrote:

As to adding that script: simple....

I added the "Free HTML" widget to my Sidebar 2 in skin Evocamp but I don't know what to do next if I want to add the script above (or another one) to this Sidebar 2 ?: What should I write in the "Params" boxes ? Should I customize some php.file ?

Feb 26, 2008 15:14

This is the Widget setting for the Free HTML widget in B2evo 2.4

http://www.blog.hemminga.net/B2evoforum/FreeHTML.png

In Block Title you put the title to appear in the sidebar
In Block Content you put the java code
In Name you put the title for the Widget to appear in the Dashboard Widget List
In CSS Class you put a class name for the div that will contain the widget. Only override this if you want a dofferent name from the default "widget_core_free_html"

Good luck

Feb 26, 2008 16:14

That was what I first tried with no luck. Now I've been trying with various Javascripts (only 1 part) and that works perfectly, thx.

I was confused, because lots of scripts from eg. DynamicDrive are in 2 parts: One for the header and one for the body.

I still haven't found out how to add these to my blog.......IF I can ?

Feb 26, 2008 16:19

This works like this:
There is a file /skins/_html_header.inc.php that will be used as default for every skin. If you want to change the html header for a particular skin, you copy this file to the folder of that skin. Now you have /skins/YOURSKIN/_html_header.inc.php. This file will override the file from the /skins/ folder but only for that skin.

In this file is the "normal" <html> tag that you can edit and add javascript to.

Good luck


Form is loading...

Run your own website! – This forum is powered by b2evolution CMS, a complete engine for your website.