[SOLVED]A Script Doesn't Work In A Parent Block


Subject: [SOLVED]A Script Doesn't Work In A Parent Block
Hi, God bless you!

I'm trying to set a parent block showing some random topics. This script is working in my previous forum, but was not in this forum. This is the script:
Code: [Download] [Hide] [Select]
<script>
jQuery(document).ready(function(){
var mensaje= new Array();

/******** INICIO ZONA EDITABLE******/
var intervalo_en_segundos = 4;

mensaje[0] = "<a href='http://elcaminocorrecto.com.mx/viewtopic.php?f=15&t=4'>no hay base bíblica para el cambio del sábado al domingo?<br \><img src='https://i.servimg.com/u/f11/16/83/96/28/nicea_10.jpg'></a>";
mensaje[1] = "<a href='http://elcaminocorrecto.com.mx/viewtopic.php?f=16&t=32'>el Mesías no murió un viernes?<br \><img src='https://i.servimg.com/u/f11/16/83/96/28/moriah10.jpg'></a>";
mensaje[2] = "<a href='http://elcaminocorrecto.com.mx/viewtopic.php?f=16&t=30'>hay una sola Ley para todo el mundo?<br \><img src='https://i.servimg.com/u/f37/16/11/50/44/abram10.jpg'></a>";
mensaje[3] = "<a href='http://elcaminocorrecto.com.mx/viewtopic.php?f=16&t=31'>en Hechos 20:7 no dice el primer día de la semana?<br \><img src='https://i.servimg.com/u/f37/16/11/50/44/img4510.jpg'></a>";
mensaje[4] = "<a href='http://elcaminocorrecto.com.mx/viewtopic.php?f=20&t=38'>el Mesías nunca violó el día de reposo?<br \><img src='https://i.servimg.com/u/f11/16/83/96/28/image010.gif'></a>";
mensaje[5] = "<a href='http://elcaminocorrecto.com.mx/viewtopic.php?f=16&t=10'>Martín Lutero era un fiero antisemita?<br \><img src='https://i.servimg.com/u/f11/16/83/96/28/photo10.jpg'></a>";
mensaje[6] = "<a href='http://elcaminocorrecto.com.mx/viewtopic.php?f=20&t=33'>el Mesías no nació en diciembre?<br \><img src='https://i.servimg.com/u/f11/16/83/96/28/navida10.jpg'></a>";
mensaje[7] = "<a href='http://elcaminocorrecto.com.mx/viewtopic.php?f=15&t=28'>pecado significa errar el blanco?<br \><img src='https://i.servimg.com/u/f11/16/83/96/28/12894910.jpg'></a>";

/******* FIN ZONA EDITABLE *******/
window.onload=mensaleatorio;
var inter = setInterval(mensaleatorio, intervalo_en_segundos*1000);
function mensaleatorio() {
var numaleatorio = Math.floor(Math.random() * mensaje.length);
var ultmensaje =my_getcookie("fa_ultimo_mens");
while (ultmensaje== mensaje[numaleatorio]){
var numaleatorio = Math.floor(Math.random() * mensaje.length);
}
jQuery( "#mimensaje" ).html(mensaje[numaleatorio]);
my_setcookie('fa_ultimo_mens', mensaje[numaleatorio], 1);
}
});
</script>

I have other scripts and they do work very well. I don't know what is the problem in this particular script.

Could you help me to find out why this script doesn't work? You can see this parent block in my forum.

Last edited by Cristianita on Mon 06 Nov, 2017 21:23; edited 1 time in total
Subject: Re: A Script Doesn't Work In A Parent Block
Hi,

Is there some place we can look at it installed?

Also, maybe you could use the Random Topic feature from Icy Phoenix ?

Profile PM  
Subject: Re: A Script Doesn't Work In A Parent Block
Quote:
Is there some place we can look at it installed?

Yes, this is in my forum:
0026533835

Quote:
Also, maybe you could use the Random Topic feature from Icy Phoenix ?
Well, I don't think so, because I want to show just some topics of different forums, not all of them... This parent block allows only the topics of one forum to show off.

Besides, the JavaScript shows an image too:
5580917886

You can see this script in my previous forum:
Spoiler: [ Show ]

Subject: Re: A Script Doesn't Work In A Parent Block
I think the parent block allows for several different forums, if you separate by ID, but I'd need to check.

Profile PM  
Subject: Re: A Script Doesn't Work In A Parent Block
Informpro wrote: [View Post]
I think the parent block allows for several different forums, if you separate by ID
I feel sorry because I'm not getting what you tell me or what you mean :cry:

I will wait for your checking :oops:

Subject: Re: A Script Doesn't Work In A Parent Block
Hi avatar Cristianita, you can use the "Random Topic Block", when you create it as a new "Parent Block" you can select which forums the topics will be pulled from.

A value of 0 in the forum ID will pull from all forums, while if you manually select the forums id where to pick the topics from you'll be fine. Forum ID can be seen when you hover the mouse over forums links or when you are in viewforum/viewtopic mode in the url in the part the f=XXX where XXX is the forum ID you need to replace.

For example:

Noticias y Actualizaciones -> http://elcaminocorrecto.com.mx/noti...ciones-vf7.html -> forum id = 7
Peticiones de Oración -> http://elcaminocorrecto.com.mx/peticiones-de-oracion-vf11.html -> forum id = 11

Suppose you want to pull topics from these two forums, you just need to set Forum IDs field to: 7,11

Remember that Parent Block settings are in the second step when you first add (or edit) a Parent Block.

Subject: Re: A Script Doesn't Work In A Parent Block
Mighty Gorgon wrote: [View Post]
Hi avatar Cristianita, you can use the "Random Topic Block", when you create it as a new "Parent Block" you can select which forums the topics will be pulled from.

A value of 0 in the forum ID will pull from all forums, while if you manually select the forums id where to pick the topics from you'll be fine. Forum ID can be seen when you hover the mouse over forums links or when you are in viewforum/viewtopic mode in the url in the part the f=XXX where XXX is the forum ID you need to replace.

For example:

Noticias y Actualizaciones -> http://elcaminocorrecto.com.mx/noti...ciones-vf7.html -> forum id = 7
Peticiones de Oración -> http://elcaminocorrecto.com.mx/peticiones-de-oracion-vf11.html -> forum id = 11

Suppose you want to pull topics from these two forums, you just need to set Forum IDs field to: 7,11

Remember that Parent Block settings are in the second step when you first add (or edit) a Parent Block.

I think the Random Topic Block is not really that I need, for two reasons:
  • The JavaScript wich doesn't work shows a mini image.
  • The topics that I want to show in this Parent Block are from different forums, but not all the topic of these forums, just specifics topics.

:shock:

Subject: Re: A Script Doesn't Work In A Parent Block
Icy Phoenix currently doesn't support displaying images for topics, it is something I have started coding a couple of times and never finished.

So far there is nothing automated to do what you need. You can use the Random Pic block from album, but then the picture is not linked to any topic automatically.

Subject: Re: A Script Doesn't Work In A Parent Block
Mighty Gorgon wrote: [View Post]
Icy Phoenix currently doesn't support displaying images for topics, it is something I have started coding a couple of times and never finished.

So far there is nothing automated to do what you need. You can use the Random Pic block from album, but then the picture is not linked to any topic automatically.
I understand it... But this JavaScript does show mini image, because I add its link for that. I add the topic link also.

Spoiler: [ Show ]
I just want to know why this code doesn't work...

Subject: Re: A Script Doesn't Work In A Parent Block
Cristianita wrote: [View Post]
I understand it... But this JavaScript does show mini image, because I add its link for that. I add the topic link also.

...

I just want to know why this code doesn't work...


What you request, is custom support, not related to Icy Phoenix :P

Just because I had few minutes... I have fixed it, but this is still an AWFUL code!

Try this on a new HTML block...

Code: [Download] [Hide] [Select]
<div id="mimensaje"></div>

<script>

function setCookieC(cname, cvalue, exdays) {
var d = new Date();
d.setTime(d.getTime() + (exdays * 24 * 60 * 60 * 1000));
var expires = "expires="+d.toUTCString();
document.cookie = cname + "=" + cvalue + ";" + expires + ";path=/";
}

function getCookieC(cname) {
var name = cname + "=";
var ca = document.cookie.split(';');
for(var i = 0; i < ca.length; i++) {
var c = ca[i];
while (c.charAt(0) == ' ') {
c = c.substring(1);
}
if (c.indexOf(name) == 0) {
return c.substring(name.length, c.length);
}
}
return "";
}

$(document).ready(function(){

var ultmensaje = getCookieC("ultmensaje");
var numaleatorio = 0;
var mensaje= new Array();

/******** INICIO ZONA EDITABLE******/
var intervalo_en_segundos = 4;
mensaje[0] = '<a href="http://elcaminocorrecto.com.mx/viewtopic.php?f=15&t=4">no hay base bíblica para el cambio del sábado al domingo?<br /><img src="https://i.servimg.com/u/f11/16/83/96/28/nicea_10.jpg"></a>';
mensaje[1] = '<a href="http://elcaminocorrecto.com.mx/viewtopic.php?f=16&t=32">el Mesías no murió un viernes?<br /><img src="https://i.servimg.com/u/f11/16/83/96/28/moriah10.jpg"></a>';
mensaje[2] = '<a href="http://elcaminocorrecto.com.mx/viewtopic.php?f=16&t=30">hay una sola Ley para todo el mundo?<br /><img src="https://i.servimg.com/u/f37/16/11/50/44/abram10.jpg"></a>';
mensaje[3] = '<a href="http://elcaminocorrecto.com.mx/viewtopic.php?f=16&t=31">en Hechos 20:7 no dice el primer día de la semana?<br /><img src="https://i.servimg.com/u/f37/16/11/50/44/img4510.jpg"></a>';
mensaje[4] = '<a href="http://elcaminocorrecto.com.mx/viewtopic.php?f=20&t=38">el Mesías nunca violó el día de reposo?<br /><img src="https://i.servimg.com/u/f11/16/83/96/28/image010.gif"></a>';
mensaje[5] = '<a href="http://elcaminocorrecto.com.mx/viewtopic.php?f=16&t=10">Martín Lutero era un fiero antisemita?<br /><img src="https://i.servimg.com/u/f11/16/83/96/28/photo10.jpg"></a>';
mensaje[6] = '<a href="http://elcaminocorrecto.com.mx/viewtopic.php?f=20&t=33">el Mesías no nació en diciembre?<br /><img src="https://i.servimg.com/u/f11/16/83/96/28/navida10.jpg"></a>';
mensaje[7] = '<a href="http://elcaminocorrecto.com.mx/viewtopic.php?f=15&t=28">pecado significa errar el blanco?<br /><img src="https://i.servimg.com/u/f11/16/83/96/28/12894910.jpg"></a>';
/******* FIN ZONA EDITABLE *******/

function mensaleatorio()
{
numaleatorio = Math.floor(Math.random() * mensaje.length);
while (ultmensaje == numaleatorio)
{
numaleatorio = Math.floor(Math.random() * mensaje.length);
}
$("#mimensaje").html(mensaje[numaleatorio]);
setCookieC('ultmensaje', numaleatorio, 365);
}

window.onload = mensaleatorio;
var inter = setInterval(mensaleatorio, intervalo_en_segundos * 1000);
});
</script>

Subject: Re: A Script Doesn't Work In A Parent Block
Quote:
What you request, is custom support, not related to Icy Phoenix
:cry: Yes, I know... But I didn't know why this code is working in my previous forum, but not here in IcyPhoenix Forum...
Quote:
Just because I had few minutes... I have fixed it
I truly appreciate very much your effort!!
Quote:
but this is still an AWFUL code!
Really??? I don't understand it, this code is working very well in the other forum. I only copied and pasted the code in the parent block... Well, not all the code, because I had to bring the topics from the other forum, and changed the links. But that was all.

Whatever, the code is working now, and I insist: you are a genius and a very kind man, avatar Mighty Gorgon

Thank you very much! gracias ¡Shalom! hola


Page 1 of 1


  
You cannot post new topics
You cannot reply to topics
You cannot edit your posts
You cannot delete your posts
You cannot vote in polls
You cannot attach files
You can download files
You cannot post calendar events

   

This is a "Lo-Fi" version of our main content. To view the full version with more information, formatting and images, please click here.

Powered by Icy Phoenix based on phpBB
Design by DiDiDaDo

Generation Time: 0.1906s (PHP: 52% SQL: 48%)
SQL queries: 18 - Debug On - GZIP Enabled