use this code in menu to display???

Having problems with DHTML Menu? There is usually somebody here who knows the answer.
Post Reply
billz_ster
Beginner
Beginner
Posts: 6
Joined: Wed Oct 01, 2003 7:11 pm

use this code in menu to display???

Post by billz_ster »

I want to be able to display a mini shoppintcart in the menu. It will be an expandlable cart and the code is for asp how could i get this 2 work ex,....

<!--#include file="../admin/db_conn_open.asp"-->
<!--#include file="../vsadmin/includes.asp"--
<!--#include file="../admin/inc/language.asp"-->
<!--#include file="../admin/inc/incfunctions.asp"-->
<!--#include file="../admin/inc/incmini.asp"-->
bzeitner
Super Advanced
Super Advanced
Posts: 32
Joined: Thu Oct 02, 2003 6:02 pm

Post by bzeitner »

Could you post a URL to the site? or tell us what is in the includes, and how it interacts (or how you want it to interact) with your menu?

I can help, but I'll need more details.
billz_ster
Beginner
Beginner
Posts: 6
Joined: Wed Oct 01, 2003 7:11 pm

Post by billz_ster »

OK, the include file extracts the information from the database that will display the information added by the user through a clicked on purchase.
User avatar
Hergio
Milonic God
Milonic God
Posts: 1123
Joined: Wed Jun 12, 2002 7:46 pm
Location: Rochester, NY

Post by Hergio »

Your still not answering the question. Do you want whats imported from those includes to be thrown into a menu item? Or do you want the menu to essentially draw itself with menu items that represent products and items purchased and what not? If you want the latter, you'll have to edit your included asp code significantly to output valid Milonic Menu syntax for the menu to function correctly.
Dave Hergert
Software Engineer
"Helping to make the menu better, one :?: at a time."
billz_ster
Beginner
Beginner
Posts: 6
Joined: Wed Oct 01, 2003 7:11 pm

Post by billz_ster »

8O

I am very pleased on your response so I will start with thanks......
Now, I trying to do the first thing you stated. "import from those includes to be thorwn into a menu item...Again thanks.
bzeitner
Super Advanced
Super Advanced
Posts: 32
Joined: Thu Oct 02, 2003 6:02 pm

Post by bzeitner »

If you just want the shoppingcart to appear in html format, like a small table, then easy enough.

Since ASP is server-side, you could use the includes to create a table and then call that code from the menu. The ASP is done server-side, creating the info you need, which is ready whenever you want. Once at the client-side, the info can be called and placed into the menu.

If you want it to be an expandable menu, that's a bit more difficult, but doable. Create ASP that will Response.Write javascript lines and then call that ASP from within the menu. With a loop or two, you're good to go.

But you're still being fairly vague with your posts.. More information would help.
User avatar
Hergio
Milonic God
Milonic God
Posts: 1123
Joined: Wed Jun 12, 2002 7:46 pm
Location: Rochester, NY

Post by Hergio »

I dont't believe you can do a straight include for two reasons. One, I dont think you can put something like <!--#include file="../admin/db_conn_open.asp"--> inside the text of a menu item definition. I haven't tried it, but something tells me it may get loopy. Second, the HTML that is outputted from your includes may contain things like quotes and single quotes and other invalid characters that you cannot put in a menu item. For example, if you had an include that did a bunch of stuff and then output the following HTML...
<table width="100" border="0"><tr><td>Shopping Cart Empty</td></tr></table>
Try putting this straight into a menu item text and you will get problems because of the quotes. If you can, you can make sure to very carefully pick your output so it will perform ok, and that will work. Or set a some variable name in the ASP code (with carefully selected characters) and have your menu item like so...
aI("text=<%=someVariableName%>;url=myCart.asp;");

The only other thing I can think of that may work is in your menu item, put a span tag with an ID, call your ASP include codes and have them set variables to certain things, and then use javascript to set the span tags in the menu item equal to the output of the include code. I.e....

Code: Select all

aI("text=<span id='menuItemData'>NOTHING</span>;url=#;status=Nothing;");
then have an ASP include that does some stuff and then generates output to a variable name, call it var1. So var1 would be equal to "<table width='100' bord....", you get the picture.
Then after the include, using ASP, you output something like..

Code: Select all

<SCRIPT>
 document.all["menuItemData"].innerHTML = "<%=var1%>";
</SCRIPT>
This would create the menu cleanly, allow you to include your files as is, and then just take whatever your include code generates and set it to the text thats contained in the menu item using that span tag's id. Hope you understand this, I thew alot at you. ;)
Dave Hergert
Software Engineer
"Helping to make the menu better, one :?: at a time."
billz_ster
Beginner
Beginner
Posts: 6
Joined: Wed Oct 01, 2003 7:11 pm

Post by billz_ster »

Thank for the input. I am still a bit lost though. Just because I am not a porfessinal coder. I do understand some of the things and the idea behind it that were explained Hergio. 8O

I will attempt to do my best. As for setting variables and using java :( I don't believe I could actually create that. But thanks. I hope to get it to work.

I created a page with the code only called minicart.asp, what I am trying to do is figure out how to get the menu to display the table on the page and of course expand when needed. I guees i typing garbage huh. Or need more help. Yep more help...


Anyways thanks SINCERLY...
Billy
bzeitner
Super Advanced
Super Advanced
Posts: 32
Joined: Thu Oct 02, 2003 6:02 pm

Post by bzeitner »

I do believe you can include the file straight into the menu, as long as the code output from the include is clean and you be wary of syntax (mainly quotes). The include is done server-side, generating the table, and then at client-side, the menu renders the output of that code (the table).

If you can post samples, it would be much easier to help.
billz_ster
Beginner
Beginner
Posts: 6
Joined: Wed Oct 01, 2003 7:11 pm

Post by billz_ster »

OK, guide me pleazze.

As for samples I don't know what to give you and using milonic it's not simple for me to understand either. Anyways, what exaples should I list. For now, these strings below produce the realtime minicart table. If i put it anywhere in an asp page it will display a set table with the product name, cost and amount. I would not know how to edit the <!--#include file="../admin/inc/incmini.asp"--> which is the string that does it all, of course after the other strings (in order) pull out the info.

<!--#include file="../admin/db_conn_open.asp"-->
<!--#include file="../admin/includes.asp"--
<!--#include file="../admin/inc/language.asp"-->
<!--#include file="../admin/inc/incfunctions.asp"-->
<!--#include file="../admin/inc/incmini.asp"-->

So what more could I list to assist you in helping this egear humble writter. the url is not live yet so I know giving the url is not applicable.

Hope to here from you soon....
Bill
billz_ster
Beginner
Beginner
Posts: 6
Joined: Wed Oct 01, 2003 7:11 pm

Post by billz_ster »

OK,

What type of sample should I post? I am more than willing to let you folks guide me if you may. Please be aware the my knowledge is minimal at least when it comes to terminalogy and I surly understand examples. So this being said. I need to give u guys samples. Of what??

<!--#include file="../admin/db_conn_open.asp"-->
<!--#include file="../admin/includes.asp"--
<!--#include file="../admin/inc/language.asp"-->
<!--#include file="../admin/inc/incfunctions.asp"-->
<!--#include file="../admin/inc/incmini.asp"-->

above is the script that draws out the live data to a set table called minicart from the last string <!--#include file="../admin/inc/incmini.asp"-->. Of course after the string ahead of it run. The site URL is not live yet. So tell me what to give you to better assist the situation.

Thanks for your help so so so much...
Bill
User avatar
Hergio
Milonic God
Milonic God
Posts: 1123
Joined: Wed Jun 12, 2002 7:46 pm
Location: Rochester, NY

Post by Hergio »

I agree, you CAN pipe the output from an included file into it as long as its clean and you got all the quotes right because afterall, it needs to be parsed by javascript after. But you cannot say
aI("text=<!--#include virtual='support.inc' -->;url=#;");
in a menu and expect it to bring it in. I tried it and got nothing. Cant even do
aI("text="+<!--#include virtual='support.inc' -->+";url=#;");
The menu just takes that STRING and outputs it and it looks like a comment to the browser (as it should). Because you are putting it into a javascript string, the server doesn't see it as serverside script because its in a .js file.

What you should do it create an menu_data.ASP (thats what I gather you are using) page that you will include instead of menu_data.js. I have seen this done with PHP. Your ASP page will essentially write out everything that is currently in your menu_data.js file, like the constants at the top, the styles, and the menu definitions. But when it comes to dyanmically outputting menu's you can use the power of the server side script. Also you should probably edit those files you listed so that just dont spit out html text, they should only do it when functions defined inside of them are called or set the html text to some variable that you can later output when you want. Say we've editted your incmini.asp to only output some text when you call the function getHTML() thats inside of it.

Code: Select all

///menu_data.asp FILE
...
<!--#include file="../admin/inc/incmini.asp"-->

<%
     someVar = getHTML();
%>

with(milonic=new menuname("rptSVGmenu")){
....
aI("text=<%=someVar%>;url=#;");
...}
Hope this points you in the right direction. I apologize if this comes off complicated, but what you are trying to do isn't exactly easy. You have to set things up right and know the order in which things are done by the server. Let me know what you think about this.
Dave Hergert
Software Engineer
"Helping to make the menu better, one :?: at a time."
Post Reply