1
freemenn
How to use Javascript in Blocks? -- Please Help!
  • 2007/4/24 22:39

  • freemenn

  • Just popping in

  • Posts: 13

  • Since: 2007/4/24


Hi all,
how can i use Javascrpt in a block?
I like to show latest news on my site tha is delyverend with a javacode but it seems ot does not work. Is there any way to put the java code in a blockor is tehre any additional Modula available to do this?
Thanks a lot

2
Quest
Re: How to use Javascript in Blocks? -- Please Help!
  • 2007/4/25 1:39

  • Quest

  • Friend of XOOPS

  • Posts: 1034

  • Since: 2005/11/19


sometimes there are parts of the java code which will need to be in the <head > part of your theme. Then the rest which would normally be in the <body > is what you put in the block and save the custom block as html type.

hths
Quest

3
freemenn
Re: How to use Javascript in Blocks? -- Please Help!
  • 2007/4/25 8:20

  • freemenn

  • Just popping in

  • Posts: 13

  • Since: 2007/4/24


what i like to do is to show news in a block. tHe script is as following (usualli can just put in the html page at any point)
-----------

<!--
START OF NEWSFEEDMAKER.COM CUSTOM CODE

Newsfeed Maker,http://www.newsfeedmaker.com
- Service for creating customized RSS, JS, IFrame
and HTML newsfeeds for your website or blog.

Visit our support forum at:
http://www.newsfeedmaker.com/forum.php

Your use of this code indicates your agreement
to the terms and conditions found at:
http://www.ipdgroup.com/user_agreement.php

Copyright (c) 2005-2006 IPD Group, Inc.
http://www.ipdgroup.com
-->

<script type="text/javascript" language="JavaScript">
//<!--
function nfm_articles(a)
{
for(i=0;i<a.length;i++) {
document.writeln('<p style="padding:0.5em 1em;margin:0px;">');
document.writeln('<a style="color:#CC0000;font-size:11px;text-decoration:underline;" target="_blank"'
+'href="'+unescape(a[i][0])+'&code=d06ea890">'+unescape(a[i][1])+'<'+'/a>');
if(a[i][4].length) a[i][2]=a[i][2]+',';
document.writeln('<span style="color:#E1771E;font-size:9px;text-decoration:none;">'
+unescape(a[i][2])+'<'+'/span>');
document.writeln('<span style="color:#E1771E;font-size:9px;text-decoration:none;">'
+unescape(a[i][4])+'<'+'/span>');
if(a[i][3].length) {
document.writeln('<br>');
document.writeln('<span style="color:#333333;font-size:9px;text-decoration:none;">'
+unescape(a[i][3])+'<'+'/span>');
}
document.writeln('<'+'/p>');
}
}

function nfm_articles_error(e)
{
document.writeln('<p style="padding:0.5em 1em;margin:0px;">');
document.writeln('<span style="color:#333333;font-size:9px;text-decoration:none;">'
+e.replace(/a href/g,'a style="color:#CC0000;font-size:9px;text-decoration:underline;" href')+'<'+'/span>');
document.writeln('<'+'/p>');
}
//-->
</script>
<div style="font-weight:normal;font-style:normal;font-size:9pt;text-decoration:none;background-color:#FFFFFF;">
<script type="text/javascript" language="JavaScript" src="http://www.newsfeedmaker.com/feed_basic_js.php?site=einnews&type=n&id=35270&num=10&abstract=1&code=d06ea890">
</script><div class="nfm_more" style="text-align:center;padding:2px;color:#CC0000;font-size:9px;text-decoration:none;"><a style="color:#CC0000;font-size:9px;text-decoration:underline;" href="http://www.einnews.com/east-north-central-us/newsfeed-east-north-central-us">More news</a> >>
<br><br>
Powered by <a style="color:#CC0000;font-size:9px;text-decoration:underline;" href="http://www.newsfeedmaker.com/">Newsfeed Maker</a>
</div></div>
<!-- END OF NEWSFEEDMAKER.COM CUSTOM CODE -->

4
Quest
Re: How to use Javascript in Blocks? -- Please Help!
  • 2007/4/25 23:51

  • Quest

  • Friend of XOOPS

  • Posts: 1034

  • Since: 2005/11/19


Works for me. XOOPS version 2.16.

5
Quest
Re: How to use Javascript in Blocks? -- Please Help!
  • 2007/4/25 23:57

  • Quest

  • Friend of XOOPS

  • Posts: 1034

  • Since: 2005/11/19


Go to your xoops/administration/system/blocks

Scroll down until you see the custom block area.
Set the location where you want the block to display.
Set the page/pages and or modules you want the block to display on.
Make sure YES is check for visible.
Paste the code you provided in your post in the text area.
Make sure the type is set to HTML
Click on Submit

It should work. Webmaster will be granted permissions by default to view the block. In order to give others access to view the block you need to go to your xoops/administration/system/groups and make sure you give permission to your other groups you want to be able to view the block. Like Registered Users and Anonymous.

Quest

Login

Who's Online

141 user(s) are online (96 user(s) are browsing Support Forums)


Members: 0


Guests: 141


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Apr 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits