Reusing menu on multiple pages - Post...

User 2446046 Photo


Registered User
12 posts

I have created a menu in Menu Builder and incorporated it into a page in RSD. It works great.

The website I am (re)creating has multiple pages (15+) with the same menu on it. I know I can copy an existing base page and get the menu on each. However if I make a change in the menu later, I believe I will need to visit each page with a menu and paste the new menu code into the HTML element. The menu doesn't change that often and pasting the same code into several pages isn't overly difficult but I would prefer to simplify as much as possible.

In the previous incarnation, FrontPage allowed a "menu" to be defined and every page that used it incorporated it by reference. Change to the "menu" was immediately reflected on all pages. Simple and less error prone. I'm sure FrontPage played some tricks to make this happen.

I'm wondering if my assumptions about the incorporation of the menu are correct, that changes would require edits of every page incorporating the menu? If so, is there some other approach I can use, putting the menu code in a separate file and incorporating it by reference somehow? So far in researching this I have come across references to Java Script and server side solutions, neither of which is acceptable to me (I think, I suppose I could be convinced otherwise about JavaScript :) )

I have a strong coding background but not in HTML/web. In the past, I have played with this a bit with no success.

Thanks
User 122279 Photo


Senior Advisor
14,450 posts

There are many ways of doing what you want, but I have never tried any of them in RSD. But it seems to me that the 'object' solution would be an option. By using that you keep the file extension html throughout. You need to place a wee bit of code on all your pages:

<object style="width: 166px; height: 350px;" data="inc/file.html">
</object>
I copied this code from a vertical menu I once made, hence the dimensions. They can be changed, but I think you need some dimensions, but nowadays you probably will set them in % with a max-width.

Then you create the 'file.html' with the contents you need there. You have to include the styles and any scripts in that file, it won't take the styles and scripts from the main file, like php includes.

As I said, I have not actually tried this in RSD, but I can't see any reasons why it should not work.
Ha en riktig god dag!
Inger, Norway

My work in progress:
Components for Site Designer and the HTML Editor: https://mock-up.coffeecup.com


User 10077 Photo


Senior Advisor
1,095 posts

If you have access to .htaccess on the server, you can set it to allow php code to execute within html pages. (Check with your web host for how to do this.) If so, then you can use php in your html element similarly to the way Inger described the object.

In the Header box under Settings, put:
<?php include('includes/menu_head.html'); ?>

In the html element on the page, put:
<?php include('includes/menu_body.html'); ?>

Using a text or html editor create two files.
1. menu_head.html - put the code for the <head> in this file.
2. menu_body.html - put the code for the <body> in this file.

You now have two choices:

If you want to keep everything inside the RSD project:
In the RSD resources, create a folder called includes. Import the two files you just created into the includes folder. Now, anytime you make a menu change, simply change the menu_body.html file and replace the one in the RSD resources. Re-export RSD and upload that file.

If you want making changes to be even easier:
After you export the RSD project, create the includes folder and put the two files you created in the folder. Anytime you make a menu change, just change the menu_body.html file and upload.
ASK ME ANYTHING
I provide personalized help for Coffeecup Users including personal or group training for Site Designer, Web Form Builder and more via Zoom.
Email me at support@uscni.org or call 865-687-7698.

Did you know that Web Form Builder can be used for both simple and complicated forms and that it's not limited to the default fonts and buttons? Take a look at a form we developed for WindowTinting.com.
https://forms.windowtinting.com/forms/w … ppingcart/
User 2446046 Photo


Registered User
12 posts

Thanks. I'll give it a try.
User 2446046 Photo


Registered User
12 posts

Well, I tried including the menu as an object.
<object style="z-index: 999; max-width: 80%;" data="CM/church_menu_2016.html">
</object>
The menu shows up but it is not functioning correctly. It is there and does the flyouts but behind other objects and it adds scroll bars ineffectively. I included a z-index value and that seemed to have no effect.
You can see this at: http://jkinchnh.coffeecup.com/index.html
When directly embedding the menu header and body code it works great. The submenus fly out over the rest of the page and there are no scrollbars.

Still thinking about the server side include.
User 2810528 Photo


Registered User
19 posts

Hi Jeff, I just sent tech support this exact question this morning... I am waiting if they have any ideas or if the one mentioned here is only recourse.
Thanks, Dave
User 126158 Photo


Registered User
2 posts

Did a reply come through? - I am currently trying to do the same thing and all options I have tried have come up blanks :(
Thanks all
User 379556 Photo


Registered User
1,535 posts

Looking back at the original post in this thread, I think the Symbols facility in Responsive Foundation Framer and Responsive Bootstrap Builder does exactly what is requested. https://tutorials.coffeecup.com/foundat … er/#nr-043 has the details.

I wouldn't be at all surprised if Responsive Site Designer 2 proves to include the same facility.

It may be that the question has been overtaken by the above matters.

Frank

User 2088758 Photo


Senior Advisor
3,086 posts

I cannot wait for this function! Symbols and possibly Components with RSD would be amazing!
Taking over the world one website at a time!

Steve Kolish
www.misterwebguy.com

YouTube Channel:
https://www.youtube.com/channel/UCL8qVv … ttneYaMSJA
User 2849383 Photo


Registered User
7 posts

Did anyone find a guaranteed way to accomplish this?

Also, has anyone found a way to import modified code/components into an RSD file?

Each time I export it, I end up having to put in my own code (and it gets old). It would be nice if code was modifiable before being exported, but that doesn't seem to be the case.

Thanks!

Have something to add? We’d love to hear it!
You must have an account to participate. Please Sign In Here, then join the conversation.