Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

How to modularize CSS menus

Featured Replies

hello,

 

Here's a question to be sure: how do I modularize CSS menus? In other words, I want to define a menu (e.g., SuckerTree Horizontal Menu) once, and then call/invoke it from any number of pages. Is this possible, or must I duplicate the HTML code in every page? Seems to me that last method would be inefficient, since a change to the menu would require a change to each and every page.

 

 

Thanks

 

http://www.infysolutions.com

Outsourcing software development

I don't think css does that...it changes layout, style and background images not content.

 

Somebody else may advise otherwise but I say:

 

You can use php includes which are really very simple.

 

Save the stuff you want to repeat on each page into a file called menu.php.

 

Then type where you want it in your html page;

<?php

@include("menu.php");

?>

 

See this tutorial!

 

Hope this helps :)

I don't think css does that...it changes layout, style and background images not content.

 

Somebody else may advise otherwise but I say:

 

You can use php includes which are really very simple.

 

Save the stuff you want to repeat on each page into a file called menu.php.

 

Then type where you want it in your html page;

<?php

@include("menu.php");

?>

 

See this tutorial!

 

Hope this helps :)

 

yes that is about the only means to do it, but you also have to remember any page that is including php has to be re-named from .html to .php.. so for example you would need to rename index.html to index.php

 

also, the syntax is not

 

<?php

@include("menu.php");

?>

 

it is

 

<?php

include("menu.php");

?>

Lol thanks ....I did wonder about that when I re-read the tutorial. I'm not sure where the @ came from. Sorry :(

the @ symbol tells php to not throw errors it the file doesn't exist!

thats very true :lol:

 

I was just letting guezala what it meant!

Ah thanks I remember now....I did it so no errors would show on the page. Thanks :)

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.