Stop data retention! Click here & act! Are you a webmaster and want to participate? Here you can find all necessary material for your website - Willst du auch an der Aktion teilnehmen? Hier findest du alle relevanten Infos und Materialien:
Chris Karakas Online Forum Index Karakas Online
 FAQFAQ   Forum SearchForum Search   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
How to use JavaScript in a PHP-Nuke block


Goto page 1, 2, 3 ... 10, 11, 12  Next
 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.
   Chris Karakas Online Forum Index -> PHP-Nuke Forum RSS Feed of this Forum
Share this page: These icons link to social bookmarking sites where readers can share and discover new web pages.Digg  del.icio.us  tc.eserver.org  Blinklist  Furl  Reddit  Blogmarks  Magnolia  Sphere  Yahoo!  Google  Windows Live  Technorati  Blue Dot  Simpy  Newsvine  Stumble Upon  co.mments.com  Blinkbits  BlogMemes  Connotea  View previous topic :: View next topic  
Author Message
koun
Second Lieutenant
Second Lieutenant


Joined: 19 Aug 2003
Posts: 110
Location: Greece

PostPosted: Thu Jan 22, 2004 12:17 pm    Post subject: How to use JavaScript in a PHP-Nuke block
Reply with quote

One of my sponsors is a music record shop. Recently they asked if its possible to put a block in my site where you could search for cds
and the results would be from there site.

In a block i made a put the following code that allready was in the music shop and that i know that is working.

Code:

$content.="


<html>

<SCRIPT>
var music=new Array(\"Επιλέξτε Πεδίο\",\"Ερμηνευτή\",\"Συνθέτη\",\"Στιχουργού\",\"Τίτλου Δίσκου\",\"Τίτλου Τραγουδιού\",\"Εταιρίας\");
var dvds=new Array(\"Επιλέξτε Πεδίο\",\"Ηθοποιού\", \"Σκηνοθέτη\", \"Σεναριογράφου\", \"Μουσικής\", \"Τίτλου\", \"Εταιρίας\");

function setOptionText(ExSelect, theArray) {
     for (loop = 0; loop < ExSelect.options.length; loop++) {
          ExSelect.options[loop].text = theArray[loop];
     }
}

function swapOpts(ArrayName) {
     var ExSelect = document.searchform.what;
     var theArray = eval(ArrayName);

     setOptionText(ExSelect, theArray);
}


</SCRIPT>         

<body>
               <table cellSpacing=0 cellPadding=0 border=0>
                  <tr>
                     <td valign=\"top\" bgcolor=\"#a39e8b\">
                     <div id=\"searchimg\" ><img src=\"images/searh_up.gif\"  border=\"0\"></div>
                     <table cellspacing=\"0\" cellpadding=\"0\" border=\"0\">
                        <tr>
                            <td height=\"1\" bgcolor=\"#ffffff\"></td>
                        </tr>
                        <tr>
                           <td height=\"67\" width=\"150\" align=\"center\" bgcolor=\"#ffffff\" valign=\"top\">
                           <form method=\"post\" style=\"font-size:1px;\" action=\"http://www.musical.gr/cd_search.scr\" name=\"searchform\">
                           <font style=\"font-family:arial; color:#213C7C; position:relative; top:-2px; font-size:10px;\">ΜΟΥΣΙΚΗ</font><input style=\"\" type=\"radio\" name=\"whatlist\" onChange=\"swapOpts('music');\" value=\"music\" checked><font style=\"font-family:arial; color:#213C7C; position:relative; top:-2px; font-size:10px;\">ΤΑΙΝΙΕΣ</font><input type=\"radio\" name=\"whatlist\" onChange=\"swapOpts('dvds');\" value=\"dvds\">
                           <select name=what style=\"font-size:9px; width:100px; height:17px;\">
                                      <option value=\"7\">Επιλέξτε Πεδίο</option>
                                      <option value=\"1\">Ερμηνευτή</option>
                                      <option value=\"2\">Συνθέτη</option>
                                      <option value=\"5\">Στιχουργού</option>
                                      <option value=\"3\">Τίτλου Δίσκου</option>
                                      <option value=\"4\">Τίτλου Τραγουδιού</option>
                                      <option value=\"6\">Εταιρίας</option>
                                 </select>
                                 <input name=words style=\"font-size:9px; width:100px; height:17px;\">                             
                           <div id=\"searchsub\" style=\"left:0;\"><input border=0 width=\"143\" src=\"http://www.musical.gr/images/search_down.gif\" type=image name=\"image\"></div>
                             </td>
                           </form>
                        </tr>
                     </table>
</body>
  "; 


The code seems to work fine in my phpnuke site 2. The problem is that when i made that block in the page i have a lot of empty space before i can see the administration panel.
I mean the admin panel has moved down alot!

Help is needed!
Back to top
View user's profile Send private message Visit poster's website
chris
Dark Lord of the Sith


Joined: 10 May 2003
Posts: 6267
Location: Outer Space

PostPosted: Thu Jan 22, 2004 4:59 pm    Post subject:
Reply with quote

That's not the way you put Javascript code in a block. You have to put it exactly as any other code into the $content variable.

For better separation of presentation and functions, you could do thie following:

Insert whatever is between the <script> tags in the includes/javascript.php file, before the closing ?> as follows:

Code:

echo "<SCRIPT>\n";
echo "var music=new Array(\"Επιλέξτε Πεδίο\",\"Ερμηνευτή\",\"Συνθέτη\",\"Στιχουργού\",\"Τίτλου Δίσκου\",\"Τίτλου Τραγουδιού\",\"Εταιρίας\");\n";
echo "var dvds=new Array(\"Επιλέξτε Πεδίο\",\"Ηθοποιού\", \"Σκηνοθέτη\", \"Σεναριογράφου\", \"Μουσικής\", \"Τίτλου\", \"Εταιρίας\");\n";
echo "\n";
echo "function setOptionText(ExSelect, theArray) {\n";
echo "     for (loop = 0; loop < ExSelect.options.length; loop++) {\n";
echo "          ExSelect.options[loop].text = theArray[loop];\n";
echo "     }\n";
echo "}\n";
echo "\n";
echo "function swapOpts(ArrayName) {\n";
echo "     var ExSelect = document.searchform.what;\n";
echo "     var theArray = eval(ArrayName);\n";
echo "\n";
echo "     setOptionText(ExSelect, theArray);\n";
echo "}\n";
echo "\n";
echo "\n";
echo "</SCRIPT>\n";


Notice the echo's and the newline \n at the end of each echoed Javascript line.

Then, your block should include the HTML code, without the <body> tags, into the $content variable, as follows:

Code:

$content .= "               <table cellSpacing=0 cellPadding=0 border=0>";
$content .= "                  <tr>";
$content .= "                     <td valign=\"top\" bgcolor=\"#a39e8b\">";
$content .= "                     <div id=\"searchimg\" ><img src=\"images/searh_up.gif\"  border=\"0\"></div>";
$content .= "                     <table cellspacing=\"0\" cellpadding=\"0\" border=\"0\">";
$content .= "                        <tr>";
$content .= "                            <td height=\"1\" bgcolor=\"#ffffff\"></td>";
$content .= "                        </tr>";
$content .= "                        <tr>";
$content .= "                           <td height=\"67\" width=\"150\" align=\"center\" bgcolor=\"#ffffff\" valign=\"top\">";
$content .= "                           <form method=\"post\" style=\"font-size:1px;\" action=\"http://www.musical.gr/cd_search.scr\" name=\"searchform\">";
$content .= "                           <font style=\"font-family:arial; color:#213C7C; position:relative; top:-2px; font-size:10px;\">ΜΟΥΣΙΚΗ</font><input style=\"\" type=\"radio\" name=\"whatlist\" onChange=\"swapOpts('music');\" value=\"music\" checked><font style=\"font-family:arial; color:#213C7C; position:relative; top:-2px; font-size:10px;\">ΤΑΙΝΙΕΣ</font><input type=\"radio\" name=\"whatlist\" onChange=\"swapOpts('dvds');\" value=\"dvds\">";
$content .= "                           <select name=what style=\"font-size:9px; width:100px; height:17px;\">";
$content .= "                                      <option value=\"7\">Επιλέξτε Πεδίο</option>";
$content .= "                                      <option value=\"1\">Ερμηνευτή</option>";
$content .= "                                      <option value=\"2\">Συνθέτη</option>";
$content .= "                                      <option value=\"5\">Στιχουργού</option>";
$content .= "                                      <option value=\"3\">Τίτλου Δίσκου</option>";
$content .= "                                      <option value=\"4\">Τίτλου Τραγουδιού</option>";
$content .= "                                      <option value=\"6\">Εταιρίας</option>";
$content .= "                                 </select>";
$content .= "                                 <input name=words style=\"font-size:9px; width:100px; height:17px;\">                             ";
$content .= "                           <div id=\"searchsub\" style=\"left:0;\"><input border=0 width=\"143\" src=\"http://www.musical.gr/images/search_down.gif\" type=image name=\"image\"></div>";
$content .= "                             </td>";
$content .= "                           </form>";
$content .= "                        </tr>";
$content .= "                     </table>";
$content .= "               </table>";


By the way, you seem to be missing a </table> at the end, I have added it in the above block code.
_________________
Regards

Chris Karakas
www.karakas-online.de
Back to top
View user's profile Send private message Send e-mail Visit poster's website
koun
Second Lieutenant
Second Lieutenant


Joined: 19 Aug 2003
Posts: 110
Location: Greece

PostPosted: Thu Jan 22, 2004 5:25 pm    Post subject: Thanks
Reply with quote

thank you verry much!
Back to top
View user's profile Send private message Visit poster's website
Beridox
Corporal
Corporal


Joined: 06 Nov 2004
Posts: 12
Location: Sweden

PostPosted: Fri May 20, 2005 9:18 pm    Post subject:
Reply with quote

I have a easy javascript that I want to have in a block but i cant get it to work Sad

Code:
<script language="JavaScript" src="http://pf.tradedoubler.com/pf/pf2?a=1038079&cuid=73875&tid=1005&oe=UTF-8&js=true" charset="UTF-8"></script>


I have tried many diffrent ways,but something like this????:

Code:
<?php

if (eregi("block-product.php", $PHP_SELF)) {
    Header("Location: index.php");
    die();
}


$content .= "<script language=\"javascript\">";


$content  .= "src=\"http://pf.tradedoubler.com/pf/pf2?a=1038079&cuid=73875&tid=1005&oe=UTF-8&js=true\">\n";


$content  .= "</script>";



?>


Someone that knows what I have missed?
Back to top
View user's profile Send private message Visit poster's website
chris
Dark Lord of the Sith


Joined: 10 May 2003
Posts: 6267
Location: Outer Space

PostPosted: Fri May 20, 2005 10:31 pm    Post subject:
Reply with quote

Try

Code:

<?php

if (eregi("block-product.php", $PHP_SELF)) {
    Header("Location: index.php");
    die();
}

$content  = "<center>";
$content .= "<script language=\"JavaScript\" src=\"http://pf.tradedoubler.com/pf/pf2?a=1038079&cuid=73875&tid=1005&oe=UTF-8&js=true\" charset=\"UTF-8\"></script>\n";
$content .= "</center>";

?>

_________________
Regards

Chris Karakas
www.karakas-online.de
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Beridox
Corporal
Corporal


Joined: 06 Nov 2004
Posts: 12
Location: Sweden

PostPosted: Fri May 20, 2005 10:39 pm    Post subject:
Reply with quote

Thanks it works now Very Happy Very Happy
Back to top
View user's profile Send private message Visit poster's website
Liqid
Sergeant
Sergeant


Joined: 13 Jul 2005
Posts: 24

PostPosted: Wed Jul 13, 2005 12:23 pm    Post subject:
Reply with quote

can i have help with a script i have on hand to use?


i didnt want to over shoot and start up a new thread w/o it being proper

so
is there a section or couple of people that can lend a hand with this one? Rolling Eyes

let me know where
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address
arnoldkrg
President
President


Joined: 29 Jun 2003
Posts: 1578
Location: United Kingdom

PostPosted: Wed Jul 13, 2005 3:10 pm    Post subject: Javascript
Reply with quote

This seems to be a suitable thread to post javascript questions. Post your script here and I will take a look
_________________
Image
Back to top
View user's profile Send private message Send e-mail
Liqid
Sergeant
Sergeant


Joined: 13 Jul 2005
Posts: 24

PostPosted: Wed Jul 13, 2005 4:26 pm    Post subject:
Reply with quote

i might be generating the wrong TYPE of code so ill post up a couple of them


Code:
<?php
    if (@include(getenv('DOCUMENT_ROOT').'/ads/phpadsnew.inc.php')) {
        if (!isset($phpAds_context)) $phpAds_context = array();
        $phpAds_raw = view_raw ('', 2, '', '', '0', $phpAds_context);
        echo $phpAds_raw['html'];
    }
?>




or



Code:
<script language='JavaScript' type='text/javascript' src='http://clubexl.com/ads/adx.js'></script>
<script language='JavaScript' type='text/javascript'>
<!--
   if (!document.phpAds_used) document.phpAds_used = ',';
   phpAds_random = new String (Math.random()); phpAds_random = phpAds_random.substring(2,11);
   
   document.write ("<" + "script language='JavaScript' type='text/javascript' src='");
   document.write ("http://clubexl.com/ads/adjs.php?n=" + phpAds_random);
   document.write ("&amp;clientid=2");
   document.write ("&amp;exclude=" + document.phpAds_used);
   if (document.referrer)
      document.write ("&amp;referer=" + escape(document.referrer));
   document.write ("'><" + "/script>");
//-->
</script><noscript><a href='http://clubexl.com/ads/adclick.php?n=ab0d81b0' target='_blank'><img src='http://clubexl.com/ads/adview.php?clientid=2&amp;n=ab0d81b0' border='0' alt=''></a></noscript>





its either one of the two scripts but
what they are doing is pulling info from my phpADSnew
because i need a type of BANNER that displays on specific day of week

I have a st of 7 banners (html text no images)
and each one is a LINK for
TODAYS LIVE SHOW
since there are 7 days in a week
and the shows change daily
this banner system seems to be my best bet so i dont have to manually change it each night at midnight


any other questions just let me know

and



thanks

[Edit] Code placed inside code tags - arnoldkrg [/Edit]
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address
Liqid
Sergeant
Sergeant


Joined: 13 Jul 2005
Posts: 24

PostPosted: Fri Jul 15, 2005 1:38 pm    Post subject:
Reply with quote

no takers huh?


look here at the LIVE SHOWS block
and you might understand what im looking for

www.clubexl.com/fm
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address
Share this page: These icons link to social bookmarking sites where readers can share and discover new web pages.Digg  del.icio.us  tc.eserver.org  Blinklist  Furl  Reddit  Blogmarks  Magnolia  Sphere  Yahoo!  Google  Windows Live  Technorati  Blue Dot  Simpy  Newsvine  Stumble Upon  co.mments.com  Blinkbits  BlogMemes  Connotea 
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.
   Chris Karakas Online Forum Index -> PHP-Nuke Forum
Page 1 of 12
This page contains valid HTML 4.01 Transitional - click here to check it!
This page contains a valid CSS - click here to check it!

 

Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group