PDA

View Full Version : image link



scott
07-09-2005, 03:06 AM
Does antone know if it is possible to install a image with link into the header of a php nuke site.

I am able to install other features using a html converter...What i am trying to do is install an image at a certain location of the site tied to a link without floating

Any suggestion? This is what i have so far


<?php

echo "<script>\n";
echo "if (!document.layers)\n";
echo "document.write('<div id=\"divStayTopLeft\" style=\"position:absolute\">')\n";
echo "</script>\n";
echo "\n";
echo "<layer id=\"divStayTopLeft\">\n";
echo "\n";

echo " <p align=\"left\"> <a href=\"http://www.xxxxx\"><IMG SRC=\"http://xxxxxxx.net/homebutton.gif\" BORDER=\"0\" ALT=\"xxxxxxHome Page\"></a>\n";



echo "</layer>\n";
echo "\n";
echo "\n";
echo "<script type=\"text/javascript\">\n";
echo "\n";
echo "/*\n";
echo "Floating Menu script- Roy Whittle (http://www.javascript-fx.com/)\n";
echo "Script featured on/available at http://www.dynamicdrive.com/\n";
echo "This notice must stay intact for use\n";
echo "*/\n";
echo "\n";
echo "//Enter \"frombottom\" or \"fromtop\"\n";
echo "var verticalpos=\"fromtop\"\n";
echo "\n";
echo "if (!document.layers)\n";
echo "document.write('</div>')\n";
echo "\n";
echo "function JSFX_FloatTopDiv()\n";
echo "{\n";
echo " var startX = 586;\n";
echo " startY = 191;\n";
echo " var ns = (navigator.appName.indexOf(\"Netscape\") != -1);\n";
echo " var d = document;\n";
echo " function ml(id)\n";
echo " {\n";
echo " var el=d.getElementById?d.getElementById(id):d.all?d.all[id]:d.layers[id];\n";
echo " if(d.layers)el.style=el;\n";
echo " el.sP=function(x,y){this.style.left=x;this.style.top=y;};\n";
echo " el.x = startX;\n";
echo " if (verticalpos==\"fromtop\")\n";
echo " el.y = startY;\n";
echo " else{\n";
echo " el.y = ns ? pageYOffset + innerHeight : document.body.scrollTop + document.body.clientHeight;\n";
echo " el.y -= startY;\n";
echo " }\n";
echo " return el;\n";
echo " }\n";
echo " window.stayTopLeft=function()\n";
echo " {\n";
echo " if (verticalpos==\"fromtop\"){\n";
echo " var pY = ns ? pageYOffset : document.body.scrollTop;\n";
echo " ftlObj.y += (pY + startY - ftlObj.y)/8;\n";
echo " }\n";
echo " else{\n";
echo " var pY = ns ? pageYOffset + innerHeight : document.body.scrollTop + document.body.clientHeight;\n";
echo " ftlObj.y += (pY - startY - ftlObj.y)/8;\n";
echo " }\n";
echo " ftlObj.sP(ftlObj.x, ftlObj.y);\n";
echo " setTimeout(\"stayTopLeft()\", 10);\n";
echo " }\n";
echo " ftlObj = ml(\"divStayTopLeft\");\n";
echo " stayTopLeft();\n";
echo "}\n";
echo "JSFX_FloatTopDiv();\n";
echo "</script>\n";

?>

Twey
07-10-2005, 11:01 AM
Ooh yuck.
Let's start by making this a little more readable.

print <<<END
<script>
if (!document.layers)
document.write('<div id="divStayTopLeft" style="position:absolute">')
</script>

<layer id="divStayTopLeft">

<p align="left"> <a href="http://www.xxxxx"><IMG SRC="http://xxxxxxx.net/homebutton.gif" BORDER="0" ALT="xxxxxxHome Page"></a>
</layer>


<script type="text/javascript">

/*
Floating Menu script- Roy Whittle (http://www.javascript-fx.com/)
Script featured on/available at http://www.dynamicdrive.com/
This notice must stay intact for use
*/

//Enter "frombottom" or "fromtop"
var verticalpos="fromtop"

if (!document.layers)
document.write('</div>')

function JSFX_FloatTopDiv()
{
var startX = 586;
startY = 191;
var ns = (navigator.appName.indexOf("Netscape") != -1);
var d = document;
function ml(id)
{
var el=d.getElementById?d.getElementById(id):d.all?d.all[id]:d.layers[id];
if(d.layers)el.style=el;
el.sP=function(x,y){this.style.left=x;this.style.top=y;};
el.x = startX;
if (verticalpos=="fromtop")
el.y = startY;
else{
el.y = ns ? pageYOffset + innerHeight : document.body.scrollTop + document.body.clientHeight;
el.y -= startY;
}
return el;
}
window.stayTopLeft=function()
{
if (verticalpos=="fromtop"){
var pY = ns ? pageYOffset : document.body.scrollTop;
ftlObj.y += (pY + startY - ftlObj.y)/8;
}
else{
var pY = ns ? pageYOffset + innerHeight : document.body.scrollTop + document.body.clientHeight;
ftlObj.y += (pY - startY - ftlObj.y)/8;
}
ftlObj.sP(ftlObj.x, ftlObj.y);
setTimeout("stayTopLeft()", 10);
}
ftlObj = ml("divStayTopLeft");
stayTopLeft();
}
JSFX_FloatTopDiv();
</script>

END;

Right. Now, to put that image where you want without using absolute, I'm afraid you're going to have to put it in the right place in the HTML code. This is probably going to involve editing your template. I'm not familiar with php nuke, but I expect it will have a "page_header" or similar file somewhere that you can edit. Remember to back up first!

scott
07-10-2005, 10:56 PM
ty Twey,

But the only way that I can get the image and link to work at all is to convert the html into php and then add it to the header.php. While its there it works fine but Floats.. I like the float script and have it else where on the site but I just dont want it for this instance.

Again Thanks :)

edit: OK your script works fine. However it still floats any suggestions?

Twey
07-12-2005, 07:27 PM
There's no need to "convert" between HTML and PHP.
To switch to PHP parsing mode, you use <?php ; to switch back to HTML, you use ?> .
What do you mean by "floating?" Include a link to the page in question.

scott
07-16-2005, 06:07 PM
TY Twey, The link (http://si-theclan.net) When you scroll the image floats with you

jscheuer1
07-16-2005, 08:46 PM
Here is a javascript approach:

http://www.echoecho.com/toolfloatinglayer.htm