Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> How To's
Author Message
American
New Member
New Member


Joined: Mar 14, 2004
Posts: 10

PostPosted: Sun Mar 14, 2004 11:34 am Reply with quote

I have searched and read everything I can find here and on nukecops that Raven has posted but I am still having no luck. This is likely due to my ignorance of programming. I am trying to insert some Web Ring code on a 6.9 site in a bottom center block at Only registered users can see links on this board! Get registered or login!

Here is what I am working with:

PURE CODE

Code:
<script language=javascript type="text/javascript"

src="http://ss.webring.com/navbar?f=j;y=sporttwin;u=defurl">
</script><noscript><center>
<table bgcolor=gray cellspacing=0 border=2><tr>
<td><table cellpadding=2 cellspacing=0 border=0><tr><td align=center>
<font face=arial size=-1>This site is a member of WebRing.
<br>To browse visit <a href="http://ss.webring.com/navbar?f=l;y=sporttwin;u=defurl">
Here</a>.</font></td></tr></table></td></tr></table>
</center></noscript>


I created a block-Buell_Webring.php file in /blocks, gave it the same permissions and ownership as the other then created the block via the admin section. Here is the block code I am using now:

Code:
<?

$content = <<<_JS_         
<script language=javascript type="text/javascript"src="http://ss.webring.com/navbar?f=j;y=sporttwin;u=defurl">
</script><noscript><center>
<table bgcolor=gray cellspacing=0 border=2><tr>
<td><table cellpadding=2 cellspacing=0 border=0><tr><td align=center>
<font face=arial size=-1>This site is a member of WebRing.
<br>To browse visit <a href="http://ss.webring.com/navbar?f=l;y=sporttwin;u=defurl">Here</a>.</font></td></tr></table></td></tr></table>
</center></noscript>
_JS_;         

?>



I am getting this warning in the block on my main page:

Parse error: parse error in /home/buellman/domains/sporttwin.com/public_html/blocks/block-Buell_Webring.php on line 13
Buell Web Ring
There isn't content right now for this block.

Which is the last line after/below ?>. I am using pico on RH9.0. I have tried using the _ANYHTMLCODE_ instead of JS, I have tried to backspace the last line to make sure there was no junk, I tried adding PHP on the first line next to <?, I did away with the space above the last ?>... all with no luck.

I would also be open to adding it to my footer.php file as well, either is fine.

What am I doing wrong?

Thanks!

_________________
Brad G 
View user's profile Send private message
American
PostPosted: Sun Mar 14, 2004 11:58 am Reply with quote

Ok finally got it working. I copied the content via pico then deleted the block-Buell_Webring.php file, created a new one using the following code:

Code:
<?php

$content = <<<_JS_
<script language=javascript type="text/javascript"src="http://ss.webring.com/navbar?f=j;y=sporttwin;u=defurl">
</script><noscript><center>
<table bgcolor=gray cellspacing=0 border=2><tr>
<td><table cellpadding=2 cellspacing=0 border=0><tr><td align=center>
<font face=arial size=-1>This site is a member of WebRing.
<br>To browse visit <a href="http://ss.webring.com/navbar?f=l;y=sporttwin;u=defurl">Here</a>.</font></td></tr></table></td></tr></table>
</center></noscript>
_JS_;
?>


Which seems to work... added the php tag on the first line, I also think that because I initially pulled the code from a temp Notepad file that there must have been some junk at the end I just couldn't get rid of... using pico from start to finish might have been the fix in addition to adding the php tag.
 
Nukeum66
Life Cycles Becoming CPU Cycles


Joined: Jul 30, 2003
Posts: 551
Location: Neurotic, State, USA

PostPosted: Sun Mar 14, 2004 12:20 pm Reply with quote

Try it this way.. let me know how it works I would test it but my host server is upgrading today, so i have no access to my site... Laughing

Code:
<?php


if (eregi("block-Webring.php",$PHP_SELF)) {
    Header("Location: index.php");
    die();
}
$content  =  "<script language=javascript type=\"text/javascript\" src=\"http://ss.webring.com/navbar?f=j;y=sporttwin;u=defurl\"></script><noscript><center><table bgcolor=gray cellspacing=0 border=2><tr><td><table cellpadding=2 cellspacing=0 border=0><tr><td align=center><font face=arial size=-1>This site is a member of WebRing.<br>To browse visit <a href=\"http://ss.webring.com/navbar?f=l;y=sporttwin;u=defurl\">Here</a>.</font></td></tr></table></td></tr></table></center></noscript>";
?>

_________________
Scott Johnson MIS Ubuntu/Linux 11.10 
View user's profile Send private message Visit poster's website
Raven
Site Admin/Owner


Joined: Aug 27, 2002
Posts: 17077

PostPosted: Sun Mar 14, 2004 1:48 pm Reply with quote

The way you got it working is the preferred and recommended way. That way you never have to escape '\' quotes and it literally is copy and paste. In addition, you can reference PHP variable in the heredoc syntax. Rather than having to edit it in *nix, if you prefer to work in windoz, get Textpad. It's great.
 
View user's profile Send private message
southern
Client


Joined: Jan 29, 2004
Posts: 591
Location: Texas

PostPosted: Sat Apr 10, 2004 10:46 am Reply with quote

I have a similar problem getting javascript to work, only I want to run a little mindnumbing midi tune to greet visitors. I've tried the disipal block creator:
Code:


<?php
#### Generated by Block Creator by Disipal Site (www.disipal.net) ###
if (eregi("block-music.php",$PHP_SELF)) {
    Header("Location: index.php");
    die();
}
$content  =  "<script language=\"JavaScript\"><!--";
$content  .= "if(navigator.appName==\"Netscape\"){";
$content  .= "document.write('<embed src=\"http://southernwolf.net/sounds/mexshuf.mid\" autostart=\"true\" loop=\"1\" hidden=\"false\"></embed>');}";
$content  .= "else if(navigator.appName==\"Microsoft Internet Explorer\"){";
$content  .= "document.write('<embed src=\"http://southernwolf.net/sounds/mexshuf.mid\" autostart=\"true\" loop=\"1\" hidden=\"false\"></embed>');}";
$content  .= "else{";
$content  .= "document.write('<embed src=\"http://southernwolf.net/sounds/mexshuf.mid\" autostart=\"true\" loop=\"1\"></embed>');}";
$content  .= "//-->";
$content  .= "</script>";
$content  .= "<noscript><embed src=\"http://southernwolf.net/sounds/mexshuf.mid\" autostart=\"true\" loop=\"1\"></embed></noscript>";
$content  .= "<noembed><bgsound src=\"http://southernwolf.net/sounds/mexshuf.mid\" loop=1></noembed>.";
?>

but this doesn't seem to work well. So I next tried the way American did it:
Code:


<?php
$content = <<<_JS_
<script language="JavaScript"><!--
if(navigator.appName=="Netscape"){
document.write('<embed src="http://southernwolf.net/sounds/mexshuf.mid" autostart="true" loop="1" hidden="true"></embed>');}
else if(navigator.appName=="Microsoft Internet Explorer"){
document.write('<embed src="http://southernwolf.net/sounds/mexshuf.mid" autostart="true" loop="1" hidden="true"></embed>');}
else{
document.write('<embed src="http://southernwolf.net/sounds/mexshuf.mid" autostart="true" loop="1"></embed>');}
//-->
</script>
<noscript><embed src="http://southernwolf.net/sounds/mexshuf.mid" autostart="true" loop="1"></embed></noscript>
<noembed><bgsound src="http://southernwolf.net/sounds/mexshuf.mid" loop=1></noembed>
_JS_;
?>

but I got a parse error.
Is there a simple solution to inserting this sort of javascript into nuke that my numbed mind hasn't discerned? Perhaps in my_header.php? Thanks for any insights.

_________________
Computer Science is no more about computers than astronomy is about telescopes.
- E. W. Dijkstra 
View user's profile Send private message Visit poster's website MSN Messenger ICQ Number
Raven
PostPosted: Sat Apr 10, 2004 11:18 am Reply with quote

I have to run out and I can't look at this right now. But, a parse error is just that - a parse error. That's a syntactical error. Look closely for code that has a line break that shouldn't, usually due to a copy and paste problem. Like moving that loop="1" back to the previous line. Things like that. The method I have prescribed ALWAYS works.
 
southern
PostPosted: Sat Apr 10, 2004 1:21 pm Reply with quote

OK, I'll tinker around. I'll let you know how it develops later. Right now I've gotta shuffle off to plant melons...
 
Nukeum66
PostPosted: Sat Apr 10, 2004 4:01 pm Reply with quote

Cool sound! I have it working on my family site I'm building ... Laughing
Only registered users can see links on this board! Get registered or login!

Let me run another test and I'll tell you how to do this...
Oh I'm Hot linked to the sound file, but I"ll remove it soon..
I don't want HitsFan


Last edited by Nukeum66 on Sat Apr 10, 2004 4:21 pm; edited 1 time in total 
Nukeum66
PostPosted: Sat Apr 10, 2004 4:18 pm Reply with quote

Ok it works fine, so here you go Wink

Saves this as whatever.php (just as it is)and upload it to your includes directory
Code:
<script language="JavaScript"><!--

if(navigator.appName=="Netscape"){
document.write('<embed src="http://southernwolf.net/sounds/mexshuf.mid" autostart="true" loop="1" hidden="true"></embed>');}
else if(navigator.appName=="Microsoft Internet Explorer"){
document.write('<embed src="http://southernwolf.net/sounds/mexshuf.mid" autostart="true" loop="1" hidden="true"></embed>');}
else{
document.write('<embed src="http://southernwolf.net/sounds/mexshuf.mid" autostart="true" loop="1"></embed>');}
//-->
</script>
<noscript><embed src="http://southernwolf.net/sounds/mexshuf.mid" autostart="true" loop="1"></embed></noscript>
<noembed><bgsound src="http://southernwolf.net/sounds/mexshuf.mid" loop=1></noembed>


then open includes/my_header.php and add this line
Code:
include("includes/whatever.php");


So it looks like this
Code:
<?php


/************************************************************************/
/* PHP-NUKE: Web Portal System                                          */
/* ===========================                                          */
/*                                                                      */
/* Copyright (c) 2002 by Francisco Burzi                                */
/* http://phpnuke.org                                                   */
/*                                                                      */
/* This program is free software. You can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 2 of the License.       */
/************************************************************************/

/*
   This file is to customize whatever stuff you need to include in your site
   when the header loads. This can be used for third party banners, custom
   javascript, popup windows, etc. With this file you don't need to edit
   system code each time you upgrade to a new version. Just remember, in case
   you add code here to not overwrite this file when updating!
   Whatever you put here will be between <head> and </head> tags.
*/
include("includes/whatever.php");

?>
 
Nukeum66
PostPosted: Sat Apr 10, 2004 4:44 pm Reply with quote

NOTE!: If you want it to eventually STOP and you will! Shocked . Set loop=0
 
southern
PostPosted: Sat Apr 10, 2004 7:28 pm Reply with quote

Haha, Nukeum, you were listening to that Mexican Shuffle midi tune? You made me laugh at your crackwise attitude! OK I'll save that as whatever.php 'cause I might change the tune now and then, so whatever... uh, I guess this means another case of Pepsi, right? That makes two so far.
 
Nukeum66
PostPosted: Sat Apr 10, 2004 11:37 pm Reply with quote

By whatever.php I meant whatever you what to call it. Laughing
Went on a diet so now I'll have Diet Pepsi ... Not Diet Coke! Laughing
 
southern
PostPosted: Sun Apr 11, 2004 10:44 am Reply with quote

Well, whatever.php is a good enough name, why change a winner? And I changed the loop to 0- I want mindnumbing not insanity provoking. Smile How in the hey am I supposed to get two cases of Diet Pepsi to Memphis? Maybe you can pick it up at a store there... I'll look into it!
 
Deseroka
Client


Joined: Apr 15, 2003
Posts: 466
Location: FL

PostPosted: Sun Apr 11, 2004 11:08 am Reply with quote

Eeew, Nukeem, why don't you just get some Coke and add water? Pepsi don't have enuff fizz unless it comes from a fountain where they are trying to save $ by addng extra co2 Laughing
 
View user's profile Send private message
southern
PostPosted: Sun Apr 11, 2004 10:15 pm Reply with quote

I think,Nukeum guru, that the site needs a bit more... ah... Caribbean look to go with the sound but its a start. Smile
And everything is Coke in the souf',Deseroka, as you might know there in FL. Smile
 
Deseroka
PostPosted: Sun Apr 11, 2004 10:46 pm Reply with quote

Now you know that in Texas when going to the store you ask
"Wanna Coke?"
"What kind?"
Even Grapette's are Coke's!
 
southern
PostPosted: Mon Apr 12, 2004 11:26 am Reply with quote

Right! And that's why Nukeum said Pepsi not Coke!
Got another bit of javascript and wonder if it can load the same way as whatever.php:
Code:


<script language="javascript">


<!-- hide
var howMany = 12
var snd = new Array(howMany+1)
snd[0]= "browneyedgirl.mid"
snd[1]= "lyingeyes.mid"
snd[2]= "takeiteasy.mid"
snd[3]= "tamborineman.mid"
snd[4]= "brn-eyed.mid"
snd[5]= "crockrock.mid"
snd[6]= "64.mid"
snd[7]= "thing.mid"
snd[8]= "margt.mid"
snd[9]= "allmyexs.mid"
snd[10]= "taxman.mid"
snd[11]= "whtshdpl.mid"
snd[12]= "navy.mid"
//function to generate a random number between 0 and howMany.
function rndnumber(){
var randscript = -1
while (randscript < 0 || randscript > howMany || isNaN(randscript)){
randscript = parseInt(Math.random()*(howMany+1))
}
return randscript
}

// Code below creates the tag that plays the random sound.>
var randomsub = rndnumber()
var sfile = snd[randomsub]

sfile= "http://southernwolf.net/sounds" + sfile

// Background sound for Internet Explorer.
document.write ('<bgsound src= "' + sfile + '" loop="infinite">')

// Background sound for Netscape Navigator.
if (navigator.appName == "Netscape") {
document.write ('<EMBED src= "' + sfile + '" hidden=true autostart=true loop=true>')
}
//unhide -->


</script>

The song names are just examples. Could this go into whatever.php?
 
Nukeum66
PostPosted: Mon Apr 12, 2004 12:49 pm Reply with quote

I believe so! try it all you can do is break it! ... LOL! Very Happy
 
southern
PostPosted: Mon Apr 12, 2004 2:35 pm Reply with quote

lol indeed. It's not the breaking I mind so much as the fixing. Smile
 
southern
PostPosted: Mon Apr 12, 2004 3:45 pm Reply with quote

OK, click the little WWW icon and let me know how your reception is on Planet M16X5, I have a good selection of random tunes for the listening pleasure of visitors to my site, including the interplantary variety.
 
Nukeum66
PostPosted: Mon Apr 12, 2004 4:42 pm Reply with quote

Reception here on Planet M16X5 is great! Good Job! The transition affects are cool ... I really liked the Mex-Music. Did you keep it in the selection? Shocked
 
Deseroka
PostPosted: Mon Apr 12, 2004 5:48 pm Reply with quote

I understand how a Pepsi can be a Coke, but I'm not sure how a Coke can be a Pespi.
 
southern
PostPosted: Mon Apr 12, 2004 6:03 pm Reply with quote

Nukeum66 wrote:
Reception here on Planet M16X5 is great! Good Job! The transition affects are cool ... I really liked the Mex-Music. Did you keep it in the selection? Shocked


Of course, it's in the random selection somewhere. I did have to change the code a bit for IE so autostart=true.
 
Deseroka
PostPosted: Mon Apr 12, 2004 7:18 pm Reply with quote

What are you running for music? I was by earlier today, but just for a second. I'll have to go back now and check it out. I'm always looking for a new way to pipe music in. Not that many NDN stations out there.........
Crying or Very sad
 
southern
PostPosted: Tue Apr 27, 2004 10:39 am Reply with quote

In my whatever.php I have these set for random play:
ATasteOfHoney.mid 18 k
Blues_Stay_Away_From_Me.mid 47 k
Boom_Boom_Boom.mid 39 k
Brain_Damage.mid 21 k
GoodMorningLittleSchoolGirl.mid 54 k
Great_Gig_in_the_Sky.mid 27 k
Have_a_Cigar.mid 49 k
Hey_You.mid 52 k
Honky_Tonk_Blues.mid 47 k
ISawHerStandingThere.mid 31 k
Little_Red_Rooster.mid 47 k
OneBourbonOneScotchOneBeer.mid 60 k
PleasePleaseMe.mid 25 k
Salty_Dog.mid 25 k
The_Wind_Cries_Mary.mid 28 k
TheresAPlace.mid 25 k
Wish_You_Were_Here.mid 44 k
Yellow_Rose_Of_Texas.mid 6 k
deep_tex.mid 14 k
mexshuf.mid 32 k
Just the right blend of mindnumbing oldies but goodies from jazz, blues, early r&r...
 
Display posts from previous:       
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> How To's

View next topic
View previous topic
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
You can attach files in this forum
You can download files in this forum


Powered by phpBB © 2001-2007 phpBB Group
All times are GMT - 6 Hours
 
Forums ©