Milonic provide full featured pull down web menus for some of the worlds largest companies
click here to see what it can do for you

Download Milonic DHTML Menu
Buy Milonic DHTML Menu

Back To Start Of Archive
Taken From The Forum: Help & Support for DHTML Menu Version 5+
Forum Topic: Click to view post
Last Updated: Saturday July 14 2012 - 06:07:25

Integrating Cold Fusion Component into the menu


Poster: tubize
Dated: Monday June 7 2004 - 10:36:05 BST

We are using a banner rotation program that we have developed internally as a Cold Fusion Component. We call the banner with this code
<cfinvoke component="cfc.AdBannerMX" method="AdBannerMX">
<cfinvokeargument name="Zone" value="Side Banner">
</cfinvoke>

We are working with a vertical banner 150 px wide that we include on the page using a js include. I can place the banner code on the calling page right after the include but would prefer to incorporate it in the banner. Does anyone know if there is a way to do this?

You will find an example on this page - http://www.expat-online.com/living/index.cfm

Thanks


Poster: John
Dated: Monday June 7 2004 - 14:46:39 BST

I'm a little confused here (it's early). What does the banner have to do with the menu?


Poster: tubize
Dated: Monday June 7 2004 - 15:10:36 BST

My left menus are the same throughout a section of my site. It is more practical to include the rotating banner once in the left nav than on every page where the menu appears. Make sense to you now?

Re: Integrating Cold Fusion Component into the menu


Poster: kevin3442
Dated: Monday June 7 2004 - 19:52:36 BST

Hi Tubize,

I think the source of the confusion was in the original post:
tubize wrote:
...I can place the banner code on the calling page right after the include but would prefer to incorporate it in the banner. Does anyone know if there is a way to do this?...

It reads sort of like, "anybody know how to incorporate the banner into the banner?" ;)

It's now clear that you want to incorporate the banner into the menu. Try inserting the cf code that you've been using into an aI() item's text property, and specify the item type as html. Like so:
Code:
aI("text=<cfinvoke component='cfc.AdBannerMX' method='AdBannerMX'><cfinvokeargument name='Zone' value='Side Banner'></cfinvoke>;type=html;");

Hope that helps,

Kevin


Poster: tubize
Dated: Monday June 7 2004 - 20:02:57 BST

You are right about the confusion. Sorry about that. I tried the code that you provided but it does not work as you can see here -
http://www.expat-online.com/living/index.cfm
The banner that you see is from the calling page. However, if you just call up the left nav banner include - http://www.expat-online.com/living/nav_living.cfm - it looks like it should work. Must just need some tweaking. Any suggestion?


Poster: John
Dated: Monday June 7 2004 - 20:43:54 BST

Sorry I missed your meaning earlier - Monday blockage!

Please post your complete nav_living.cfm file here (cfm hides, as you know) so we can see what's going on. Don't forget to use the [code][/code] tags.


Poster: tubize
Dated: Monday June 7 2004 - 20:53:52 BST

<code>
<cfparam name="page" default=" ">
<cfquery name="get_clubtypes" datasource="business">
SELECT * from club_types order by type
</cfquery>

<cfquery name="get_churchtypes" datasource="business">
SELECT * from church_types order by affiliation_name
</cfquery>

with(milonic=new menuname("Admin Menu")){
style=VerticalStyle;
alwaysvisible=1;
fontstyle="bold";
overflow="scroll";
itemwidth="150";
position="relative";
<cfif isdefined('cookie.member')>
<cfquery name="getuser" datasource="forum" dbtype="ODBC">
select realname from users
where username='#cookie.member#'
</cfquery>

aI("status=Update your profile;image=/about/images/update.gif;url=/register/subscribe.cfm?ar=update");
<cfoutput>aI("text=Hi #getuser.realname#;type=header;align=LEFT;");</cfoutput><cfelse>
aI("status=Register for Expatriate Online;image=/about/images/register.gif;url=/register/subscribe.cfm");
</cfif>
aI("text=LIVING IN BELGIUM;type=header;align=LEFT;");
aI("text=Business Directory;showmenu=business;");
aI("text=Opportunities;showmenu=opportunities;");
aI("text=Eating in Belgium;showmenu=resto;");
aI("text=Sports & Recreation;showmenu=sports;");
aI("text=Belgian News;url=/news/index.cfm;;status=News about Belgium");
aI("text=Classified Ads;url=/living/classifieds/classified_listings.cfm;");
aI("text=Miscellaneous;showmenu=misc;");
aI("text=EXPAT ACTIVITIES;type=header;align=LEFT;");
aI("text=Organizations;showmenu=clubs;");
aI("text=Churches;showmenu=churches;");
aI("text=Expatriate Events;url=/living/club_events/calendar.cfm;");
aI("text=<cfinvoke component='cfc.AdBannerMX' method='AdBannerMX'><cfinvokeargument name='Zone' value='Side Banner'></cfinvoke>;type=html;");
<cfif page is 'church'>
aI("text=&nbsp;;type=header;align=LEFT;");
aI("text=Update Church Info;url=/living/clubs/church_select.cfm;");</cfif>
<cfif page is 'club'>
aI("text=&nbsp;;type=header;align=LEFT;");
aI("text=Update Club Info;url=/living/clubs/club_select.cfm;");</cfif>
}

with(milonic=new menuname("business")){
style=VerticalStyle;
aI("text=Businesses;url=/busdirectory/index.cfm;");
aI("text=Schools;url=/busdirectory/schools/schools.cfm;");
aI("text=Special Offers;url=/busdirectory/specials/specials.cfm;");
}

with(milonic=new menuname("opportunities")){
style=VerticalStyle;
aI("text=Business Opportunities;url=/busdirectory/opportunities/business.cfm;");
aI("text=Employment Opportunities;url=/busdirectory/opportunities/employment.cfm;");
}

with(milonic=new menuname("resto")){
style=VerticalStyle;
aI("text=Restaurant Directory;url=/resto/index.cfm;");
<!--- aI("text=Favorite Belgian Spots;url=/resto/favorites.cfm;") --->
aI("text=Belgian Recipes;url=/resto/recipe.cfm;");
aI("text=Hints on Etiquette;url=/resto/hints/hints_on_etiquette.cfm;");
}

with(milonic=new menuname("sports")){
style=VerticalStyle;
aI("text=Swimming Pools;url=/living/sports/swimming/index.cfm;");
}

with(milonic=new menuname("clubs")){
style=VerticalStyle;
<cfoutput query="get_clubtypes">
aI("text=#type#;url=/living/clubs/club_results.cfm?type_no=#type_no#;");</cfoutput>
}

with(milonic=new menuname("churches")){
style=VerticalStyle;
<cfoutput query="get_churchtypes">
aI("text=#affiliation_name#;url=/living/clubs/church_results.cfm?aff_no=#affiliation#;");</cfoutput>
}

with(milonic=new menuname("misc")){
style=VerticalStyle;
aI("text=Metric Conversions;url=/living/miscellaneous/conversions.cfm;");
aI("text=Some Good Jokes;url=/living/miscellaneous/jokes.cfm;");
aI("text=Queen's English;url=/living/potpourri/eng_us_dict.cfm;");
}

drawMenus();
</code>


Poster: John
Dated: Monday June 7 2004 - 22:57:29 BST

I'm getting a JS error - "Unterminated string constant"...
Code:
aI("text=
   

      
      
      
      
      
      
      
      <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" width="110" height="160">
  <param name="movie" value="/AdBannerMX/Ads/200405010900248.swf?target=_blank&clicktag=http://www.expat-online.com/Redirect/ClickThruMX.cfm%3FB68BBCB6758C6BA86998A84E29207DFF|46|YnVzaW5lc3M=|aHR0cCUzQSUyRiUyRnd3dyUyRWNzZG1vdG9ycyUyRWJlJTJG" />
  <param name="quality" value="high" />
  <param name="menu" value="false" />
  <param name="SCALE" value="noborder" />
  <embed src="/AdBannerMX/Ads/200405010900248.swf?target=_blank&clicktag=http://www.expat-online.com/Redirect/ClickThruMX.cfm%3FB68BBCB6758C6BA86998A84E29207DFF|46|YnVzaW5lc3M=|aHR0cCUzQSUyRiUyRnd3dyUyRWNzZG1vdG9ycyUyRWJlJTJG" quality="high" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="110" height="160"></embed>
</object><br />
      
   ;type=html;");

I think the menu is unhappy about all the " that are coming back in the Flash object.

Just for next time, note that "code" is in brackets ([]), not (<>). :)


Poster: kevin3442
Dated: Monday June 7 2004 - 23:33:29 BST

Hi tubize,

The "unterminated string constant" js error is being caused by your cf component. This:
Code:
aI("text=<cfinvoke component='cfc.AdBannerMX' method='AdBannerMX'><cfinvokeargument name='Zone' value='Side Banner'></cfinvoke>;type=html;");

(minus word wrapping of course) is generating this:
Code:
aI("text=









      <a href="/Redirect/ClickThruMX.cfm?C6BFCE11509482DBEFA4F4B9B49CCA94|42|YnVzaW5lc3M=|aHR0cCUzQSUyRiUyRnd3dyUyRW1vbnRlc3Nvcmlob3VzZSUyRW5ldA==" target="_blank"><img src="/AdBannerMX/Ads/200405010827422.gif" alt="Montessori" border="0" /></a>

   ;type=html;");



across several lines. The "unterminated string constant" error is because the js function, aI(), that's used to build a menu item takes one string parameter. In this case, the string began with text= but then got cut off... there's no js continuation character so the string just ends, without being properly terminated. The moral is that each aI() definition should be only one line of code.

Your cf component aparently sends newline characters in the output stream. Normally, when outputting just to html, that's not a problem. But now you're outputting the html as part of a string that's an argument to a js function... so you're really outputting js code now. Your cf component should therefore not generate newlines. Tweak it until the code in the block above comes out all on one line.

Hope that helps,

Kevin


Poster: tubize
Dated: Tuesday June 8 2004 - 7:10:38 BST

Thanks a lot Kevin. You have done a lot of work on it and I appreciate your help. I will let you know when it is done.

John