11
mjz55
Re: random img => random audio
  • 2007/8/2 21:29

  • mjz55

  • Quite a regular

  • Posts: 298

  • Since: 2007/1/18


Whoohoo, it worked. Very nice and simple. Thanks sooo much.

12
Peekay
Re: random img => random audio
  • 2007/8/2 21:39

  • Peekay

  • XOOPS is my life!

  • Posts: 2335

  • Since: 2004/11/20


You're welcome. Glad you asked the question. I learnt a lot myself.
A thread is for life. Not just for Christmas.

13
mjz55
Re: random img => random audio
  • 2007/8/7 16:26

  • mjz55

  • Quite a regular

  • Posts: 298

  • Since: 2007/1/18


Peekay, not looking a gift horse in the mouth, sort to speak but..... is there a way not to have that block visible or can I just make it real small? How about one play per visit?

14
Peekay
Re: random img => random audio
  • 2007/8/7 16:56

  • Peekay

  • XOOPS is my life!

  • Posts: 2335

  • Since: 2004/11/20


You can put this in your theme.html instead of a block and hide the player by setting the height and width to 1px, e.g.
<table>
<
tr><td>
<
object type="application/x-shockwave-flash" width="1" height="1"
data="http://www.example.com/xspf/xspf_player_slim.swf?playlist_url=http://www.example.com/xspf/playlist.xspf&autoplay=true">
<
param name="movie" 
value="http://www.example.com/xspf/xspf_player_slim.swf?playlist_url=http://www.example.com/xspf/playlist.xspf&autoplay=true" />
object>
td>tr>
table>


Or you could hide the player in the block the same way.

I don't recall seeing a 'play once only' parameter on the dev's website, although I agree it would be nice.
A thread is for life. Not just for Christmas.

15
mjz55
Re: random img => random audio
  • 2007/8/7 18:07

  • mjz55

  • Quite a regular

  • Posts: 298

  • Since: 2007/1/18


Hehe, that worked but everytime you open a module or a pic or anything the darn message comes across. I think I'll go back and try the 1px in the block next. Thanks!!

16
Peekay
Re: random img => random audio
  • 2007/8/7 18:32

  • Peekay

  • XOOPS is my life!

  • Posts: 2335

  • Since: 2004/11/20


Quote:

mjz55 wrote:
Hehe, that worked but everytime you open a module or a pic or anything the darn message comes across.

Ah, yes... I suppose it would. At least with the block you can restrict it to the homepage.

I'll see if I can find a way to set it to play once only.
A thread is for life. Not just for Christmas.

17
Peekay
Re: random img => random audio
  • 2007/8/7 20:38

  • Peekay

  • XOOPS is my life!

  • Posts: 2335

  • Since: 2004/11/20


O.K. You could try this.

The modified block code checks the HTTP referer VAR to see if the page has been loaded from within your own website. If 'false' (a new visitor) the player loads. If 'true' (e.g. the visitor went to the forum, then back to the homepage) the script simply displays a bit of text. You can change the text string to "" if you want.

Important: You need to change the block type to 'PHP Script'.

$_SERVER["HTTP_REFERER"] = !isset($_SERVER["HTTP_REFERER"])? NULL $_SERVER["HTTP_REFERER"];
$origin $_SERVER["HTTP_REFERER"];
if ( 
strstr$origin"example.com" ) ) {
echo 
"Still here then" ;
 }
else {
echo 
"application/x-shockwave-flash" width="1" height="1"
data="
http://www.example.com/xspf/xspf_player_slim.swf?playlist_url=http://www.example.com/xspf/playlist.xspf&autoplay=true">
<param name="movie" 
value="http://www.example.com/xspf/xspf_player_slim.swf?playlist_url=http://www.example.com/xspf/playlist.xspf&autoplay=true" />object>" ;
 }

Don't forget to replace 'example.com' with your website address.

Let me know if it works, 'cos I have only tested it on my LAN.

If anyone else copies the above code, don't forget the player is set to 1 x 1 pixels to hide it.
A thread is for life. Not just for Christmas.

18
mjz55
Re: random img => random audio
  • 2007/8/7 21:16

  • mjz55

  • Quite a regular

  • Posts: 298

  • Since: 2007/1/18


Does this code go in the block?

19
Peekay
Re: random img => random audio
  • 2007/8/7 21:17

  • Peekay

  • XOOPS is my life!

  • Posts: 2335

  • Since: 2004/11/20


Ah... but there's a snag. It works really well, until you log in, or out. When you do, it seems to 'break' the referer info and the player loads as if you were a new site visitor.

I must say, this works a treat if you want to hide the block from 'anons' and play the intro once to people after they log in. They won't hear the intro again when they log out either.

OR...

...the other way around, play the intro to anons, but hide the block from registered users so it doesn't repeat when they log in. However, they'll hear it again when they log out. I confess at the moment, I have no idea how to stop this.

(yes, code goes in the block)
A thread is for life. Not just for Christmas.

20
mjz55
Re: random img => random audio
  • 2007/8/7 21:18

  • mjz55

  • Quite a regular

  • Posts: 298

  • Since: 2007/1/18


LOL, I'm killing ya!!

Login

Who's Online

467 user(s) are online (332 user(s) are browsing Support Forums)


Members: 0


Guests: 467


more...

Donat-O-Meter

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

Latest GitHub Commits