Working with ddsmoothmenu Smooth Navigation Menu by Dynamic Drive for a WordPress project I encountered a stupid lack of setting to provide image paths dynamically. This is a jQuery-based dropdown menu which seems and works fine but requires a static path to the images. Only two images though, for the arrows down and right, but it would be a serious issue when releasing a website or migrating to a new server.
So I decided to add a new setting configurable through the JavaScript call in your call-menu file where you could use php/java/python/whateva to retrieve the correct path dynamically and just pass it. I'm using v.1.5 and I did 2 corrections:
- in the ddsmoothmenu.js file replaced all smoothmenu.arrowimages strings with setting.arrowimages (just changing 'smoothmenu' to 'setting' in these three lines). There are 5 strings to be replaced at lines 75 to 77. What I do is add a new setting for them in the next section.
- Adding the paths to the images as a setting. So at the end my call includes the dynamic path to be used in the menus. Since I'm using WordPress, here there is my code for calling the menu:
ddsmoothmenu.init({ mainmenuid: "header_top_menu", orientation: 'h', classname: 'ddsmoothmenu', arrowimages: {down:['downarrowclass', '<?php bloginfo("template_url"); ?>/img/down.gif', 23], right:['rightarrowclass', '<?php bloginfo("template_url"); ?>/img/right.gif']}, contentsource: "markup" });