Author |
Message |
tangoman
Involved


Joined: Aug 06, 2005
Posts: 301
|
Posted:
Tue Aug 30, 2005 5:23 am |
|
I want two links on my website to flash from one color to another.
One link is in a module and the other is in a block.
The solution I have found is Javascript and requires that the following code be placed in the Header section of an HTML web Page:
Code:<scr ipt language="JavaScript1.2" type="text/javascript">
/***********************************************
* Flashing Link Script- � Dynamic Drive (www.dynamicdrive.com)
* This notice must stay intact for use
* Visit http://www.dynamicdrive.com/ for full source code
***********************************************/
var flashlinks=new Array()
function changelinkcolor(){
for (i=0; i< flashlinks.length; i++){
var flashtype=document.getElementById? flashlinks[i].getAttribute("flashtype")*1 : flashlinks[i].flashtype*1
var flashcolor=document.getElementById? flashlinks[i].getAttribute("flashcolor") : flashlinks[i].flashcolor
if (flashtype==0){
if (flashlinks[i].style.color!=flashcolor)
flashlinks[i].style.color=flashcolor
else
flashlinks[i].style.color=''
}
else if (flashtype==1){
if (flashlinks[i].style.backgroundColor!=flashcolor)
flashlinks[i].style.backgroundColor=flashcolor
else
flashlinks[i].style.backgroundColor=''
}
}
}
function init(){
var i=0
if (document.all){
while (eval("document.all.flashlink"+i)!=null){
flashlinks[i]= eval("document.all.flashlink"+i)
i++
}
}
else if (document.getElementById){
while (document.getElementById("flashlink"+i)!=null){
flashlinks[i]= document.getElementById("flashlink"+i)
i++
}
}
setInterval("changelinkcolor()", 1000)
}
if (window.addEventListener)
window.addEventListener("load", init, false)
else if (window.attachEvent)
window.attachEvent("onload", init)
else if (document.all)
window.onload=init
</scr ipt>
|
Additionally, you must then set the attributes in your link HTML as follows:
Code:<a href="test.htm" id="flashlink0" flashtype=0 flashcolor="green">Example 1</a>
OR
<a href="test.htm" id="flashlink1" flashtype=1 flashcolor="lime">Example 2</a>
|
My fundamental question is, how do I use this code, moreover where does the code that is supposed to be placed in the header section go, in relation to the module or block I am working on? |
_________________ I am using PHPNuke Version 7.6 with patch 3.0, CNB YA 4.4.2, NukeSentinel(tm) 2.3.2 and Nuke Royal. |
|
|
 |
Raven
Site Admin/Owner

Joined: Aug 27, 2002
Posts: 17088
|
Posted:
Tue Aug 30, 2005 6:39 am |
|
includes/custom_files/custom_head.php
or
includes/custom_files/custom_header.php
From what I can tell, includes/custom_files/custom_head.php is meant to replace includes/my_header.php and includes/custom_files/custom_header.php is new. From the logic there is no difference so you'd have to ask FB why, in his infinite nuke wisdom, there are 2
As to the use of the script, you will need to refer to any instructions that came with it. |
|
|
|
 |
tangoman

|
Posted:
Tue Aug 30, 2005 6:51 am |
|
Raven,
(After PMing one another as to how to post this question, I find it an irony and quite hilarious, that you yourself have now replied to this posting!!!....
However, I am not able to understand what you are explaining exactly.
Specifically, I am only used to placing such code, (as directed with this codes instructions), between the <head> and </head> tags in a single, static, HTML page.
The <head> and </head> tags do not feature when I create a Block or Module, so I am really unsure where to place this code.
Please advise. |
|
|
|
 |
Raven

|
Posted:
Tue Aug 30, 2005 6:58 am |
|
header.php is called for all blocks which in turn calles the other 2 files. Modules, however, have to explicitly call it withCode:include("header.php");
| . Look at other modules, in the index.php file, and you will see it. |
|
|
|
 |
tangoman

|
Posted:
Tue Aug 30, 2005 7:06 am |
|
Raven,
I now understand.....I think!...
When you explain '...header.php is called for..., by 'called for', you mean that when a block loads, it 'asks for/takes' the header information from the header.php file then, in turn, when this header.php file receives a 'request' for this information (from a block the user is trying to load into their browser), it in turn 'asks for/takes' information from the includes/custom_files/custom_head.php file or the
includes/custom_files/custom_header.php file ...Does my brain compute this logic correctly now?  |
|
|
|
 |
Raven

|
Posted:
Tue Aug 30, 2005 7:17 am |
|
I make absolutely no claim to understand how your brain computes logic
www.your_domain.xxx/index.php initially calls mainfile.php and header.php which sets up the framework, so to speak, for all blocks. So, the <head></head> are setup at that point. |
|
|
|
 |
tangoman

|
Posted:
Tue Aug 30, 2005 7:35 am |
|
OK Raven,
Let me ask this instead then...
Does the explaination I last posted compute perfectly with YOUR brain?...
 |
|
|
|
 |
Raven

|
Posted:
Tue Aug 30, 2005 1:28 pm |
|
PHP generates HTML, JavaScript, CSS, etc. code, in the end, for your browser because that's all it understands. So, when the index.php script is called, it loads header.php which constructs the <head></head> tags, in addition to other things of course. Now, in header.php are the 2 include calls to include any custom header code that you need. You could just as easily have added that code to header.php but this way it is more accomodating to upgrades. So, when the blocks are built, all javascript (in this case) is already loaded into the "construction" buffer by PHP. |
|
|
|
 |
|