Integrating Cold Fusion Component into the menu

Having problems with DHTML Menu? There is usually somebody here who knows the answer.
Post Reply
tubize
Advanced
Advanced
Posts: 27
Joined: Tue Sep 30, 2003 9:14 am

Integrating Cold Fusion Component into the menu

Post by tubize »

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
User avatar
John
 Team
 Team
Posts: 5967
Joined: Sun May 19, 2002 8:23 pm
Location: Phoenix, AZ
Contact:

Post by John »

I'm a little confused here (it's early). What does the banner have to do with the menu?
John
tubize
Advanced
Advanced
Posts: 27
Joined: Tue Sep 30, 2003 9:14 am

Post by tubize »

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?
User avatar
kevin3442
Milonic God
Milonic God
Posts: 2460
Joined: Sat Sep 07, 2002 12:09 am
Location: Lincoln, NE
Contact:

Re: Integrating Cold Fusion Component into the menu

Post by kevin3442 »

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: Select all

aI("text=<cfinvoke component='cfc.AdBannerMX' method='AdBannerMX'><cfinvokeargument name='Zone' value='Side Banner'></cfinvoke>;type=html;");
Hope that helps,

Kevin
tubize
Advanced
Advanced
Posts: 27
Joined: Tue Sep 30, 2003 9:14 am

Post by tubize »

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?
User avatar
John
 Team
 Team
Posts: 5967
Joined: Sun May 19, 2002 8:23 pm
Location: Phoenix, AZ
Contact:

Post by John »

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.
John
tubize
Advanced
Advanced
Posts: 27
Joined: Tue Sep 30, 2003 9:14 am

Post by tubize »

<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>
User avatar
John
 Team
 Team
Posts: 5967
Joined: Sun May 19, 2002 8:23 pm
Location: Phoenix, AZ
Contact:

Post by John »

I'm getting a JS error - "Unterminated string constant"...

Code: Select all

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 (<>). :)
John
User avatar
kevin3442
Milonic God
Milonic God
Posts: 2460
Joined: Sat Sep 07, 2002 12:09 am
Location: Lincoln, NE
Contact:

Post by kevin3442 »

Hi tubize,

The "unterminated string constant" js error is being caused by your cf component. This:

Code: Select all

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: Select all

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
tubize
Advanced
Advanced
Posts: 27
Joined: Tue Sep 30, 2003 9:14 am

Post by tubize »

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
Post Reply