PDA

View Full Version : Dynamic-FX Slide-In Menu- PHP links



Jcody
08-21-2005, 03:33 PM
Hi, sorry if this has been posted before, but i searched and came up with nothing.

Im trying to use the Dynamic-FX Slide-In Menu (http://www.dynamicdrive.com/dynamicindex1/davidmenu.htm) by maXimus on my forums. I can get it to "install" just fine, but there is a problem. I need to be able to use PHP for the links, for example, the "Log Out" link is
<a href="', $scripturl, '?action=logout;sesc=', $context['session_id'], '">. How can i use PHP in the links? I have no clue. It seems to me like it would be completely re-worked. I know it is possible, because it is done on this forum (http://www.phpbb-design.com/phpBB2_styles_demo/theme/?s=155).

Thanks :)

jscheuer1
08-21-2005, 08:08 PM
I don't know much about PHP but, this is how their code looks for their links, it may be dynamically generated:


//The Menu's Items
addHdr("Forum Navi.");
addItem("Home", "index.php?sid=929d67d5ff9d43f4f75082378c704321", "");
addItem("FAQ", "faq.php?sid=929d67d5ff9d43f4f75082378c704321", "");
addItem("Search", "search.php?sid=929d67d5ff9d43f4f75082378c704321", "");
addItem("Memberslist", "memberlist.php?sid=929d67d5ff9d43f4f75082378c704321", "");
addItem("User Groups", "groupcp.php?sid=929d67d5ff9d43f4f75082378c704321", "");
addItem("Register", "profile.php?mode=register&amp;sid=929d67d5ff9d43f4f75082378c704321", "");
addItem("Profile", "profile.php?mode=editprofile&amp;sid=929d67d5ff9d43f4f75082378c704321", "");
addItem("Priv.Msgs.", "privmsg.php?folder=inbox&amp;sid=929d67d5ff9d43f4f75082378c704321", "");
addItem("Log in", "login.php?sid=929d67d5ff9d43f4f75082378c704321", "");

Jcody
08-21-2005, 11:16 PM
Thanks for the response. Ahh, but php is a server side language. If you view the source, youll only see the generated html content, not what generated it. So in other words, if you go view the source of that same page again tomorrow, you'll probabally (will) see a different session id, that's what that long number is. You need php to generate the correct one, otherwise, you'll get "Session Verification Error".

:)

jscheuer1
08-22-2005, 12:30 AM
Why couldn't you do something like this then:

addItem("Log Out", "', $scripturl, '?action=logout;sesc=', $context['session_id'], '", "");

Jcody
08-22-2005, 12:38 AM
that will not work because it is in a .js file. PHP will just ignore it.

Thanks

I was thinking on making the script "non-external" and placing it in my php index file, so i could use php. Any insight on that? Or am i getting ahead of myself?

EDIT: i should also mention that i will need if's as well. For example, i dont want the log in link show for somebody who is already logged in, or the admin link to show for anyone besides the admin.

jscheuer1
08-22-2005, 05:20 AM
So, that explains why they put their script on the page! All you need to do to make the script internal is to put script tags around the contents of the external file and place it where the link to the external file would go (in this case, the head):

<script type="text/javascript">

//Static Slide Menu 6.5 MaXimuS 2000-2001, All Rights Reserved.
//Site: http://www.absolutegb.com/maximus
//Script featured on Dynamic Drive (http://www.dynamicdrive.com)

NS6 = (document.getElementById&&!document.all)
IE = (document.all)
NS = (navigator.appName=="Netscape" && navigator.appVersion.charAt(0)=="4")

tempBar='';barBuilt=0;ssmItems=new Array();

function truebody(){
return (document.compatMode!="BackCompat")? document.documentElement : document.body
}

moving=setTimeout('null',1)
function moveOut() {
if ((NS6||NS)&&parseInt(ssm.left)<0 || IE && ssm.pixelLeft<0) {
. . . .rest of script omitted. . .
</script>and:

<script type="text/javascript">
/*
Configure menu styles below
NOTE: To edit the link colors, go to the STYLE tags and edit the ssm2Items colors
*/
YOffset=150; // no quotes!!
XOffset=0;
staticYOffset=30; // no quotes!!
slideSpeed=20 // no quotes!!
waitTime=100; // no quotes!! this sets the time the menu stays out for after the mouse goes off it.
menuBGColor="black";
menuIsStatic="yes"; //this sets whether menu should stay static on the screen
menuWidth=150; // Must be a multiple of 10! no quotes!!
menuCols=2;
hdrFontFamily="verdana";
hdrFontSize="2";
hdrFontColor="white";
hdrBGColor="#170088";
hdrAlign="left";
hdrVAlign="center";
hdrHeight="15";
linkFontFamily="Verdana";
linkFontSize="2";
linkBGColor="white";
linkOverBGColor="#FFFF99";
linkTarget="_top";
linkAlign="Left";
barBGColor="#444444";
barFontFamily="Verdana";
barFontSize="2";
barFontColor="white";
barVAlign="center";
barWidth=20; // no quotes!!
barText="SIDE MENU"; // <IMG> tag supported. Put exact html for an image to show.

///////////////////////////

// ssmItems[...]=[name, link, target, colspan, endrow?] - leave 'link' and 'target' blank to make a header
ssmItems[0]=["Menu"] //create header
ssmItems[1]=["Dynamic Drive", "http://www.dynamicdrive.com", ""]
ssmItems[2]=["What's New", "http://www.dynamicdrive.com/new.htm",""]
ssmItems[3]=["What's Hot", "http://www.dynamicdrive.com/hot.htm", ""]
ssmItems[4]=["Message Forum", "http://www.codingforums.com", "_new"]
ssmItems[5]=["Submit Script", "http://www.dynamicdrive.com/submitscript.htm", ""]
ssmItems[6]=["Link to Us", "http://www.dynamicdrive.com/link.htm", ""]

ssmItems[7]=["FAQ", "http://www.dynamicdrive.com/faqs.htm", "", 1, "no"] //create two column row
ssmItems[8]=["Email", "http://www.dynamicdrive.com/contact.htm", "",1]

ssmItems[9]=["External Links", "", ""] //create header
ssmItems[10]=["JavaScript Kit", "http://www.javascriptkit.com", ""]
ssmItems[11]=["Freewarejava", "http://www.freewarejava.com", ""]
ssmItems[12]=["Coding Forums", "http://www.codingforums.com", ""]

buildMenu();
</script>Altering to include ifs is a little beyond me though.

Jcody
08-22-2005, 09:09 PM
ahh, thanks. If's are no problem for me. Im competant with php :) .

My only concern with including the php file, is that it may cause conflict. Ill see what i can do. If anybody could give any insigt on that...because i have had bad luck with that.

Thanks for your help jscheuer1!

liberate
08-08-2007, 05:01 AM
Hi

I was trying to do the same thing - to use php links with Dynamic-FX Slide-In Menu, but I wasn't getting very far until I read this message series.

Let me say up front, I do not know html, php, or javascript.

Based on what was said by Jcody and jscheuer1, I got the php links to work.

After I got the colors and the rest of the configuration to look the way I wanted, I cut and pasted the configuration portion of "ssmItems.js" into the top of "ssm.js".

Now all I have between the <head> tags on my php pages is the links portion of "ssmItems.js". The advantage is that each page can have it's own sub- category related links.

In the <head> remove the line that calls "ssmItems.js"
<SCRIPT SRC="ssmItems.js" language="JavaScript1.2"></SCRIPT>, because "ssmItems.js" no longer exists.


On a side note:
If you use a small bullet .gif for the configuration / barText="menu";

You can do this:
barText="mouse<br>over<br><IMG src=1.gif>";

and you will get (written horizontally, rather then vertically) :
Mouse
over
<gif_image>

It looks cool. I matched all the background and text colors to that of my page, and used barely visible gray for "Mouse Over".

Hope this helps the next person who reads this message series.