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 can I find pages that are missing a menu?

Featured Replies

My website

https://www.kirkbymicrowave.co.uk/

should have a menu at the top of each page. It is included by a bit of php like this, which includes menu.php.

<?php
include ("../../menu.php");
?>

The deeper the page is below the root, the further up the directory structure menu.php is, so in principle a page might have

<?php
include ("../../../../../../../../menu.php");
?>

although I don't have any pages that deep!

If I move a page up or down a directory level, I need to remember to change the path to menu.php (for some annoying reason /menu.php does not work). The problem is, sometimes I forget to update the reference properly, so end up with a page like this.

https://www.kirkbymicrowave.co.uk/Support/FAQ/page-screwed-up/

Is there any obvious way of finding problems like this? I have shell access on the Apache server. :

There should be a footer too. Again included with a bit of php code, and again needs to have the correct path. I'd like to try to find some automated way of checking every page, to see if it has both the menu and the footer you see on most pages.

Dave

 

Edited by drkirkby
clarify things, with more details.

Use a CMS. It will solve so many of your problems.

However...

Keep it really simple:

<?php
include ("https://www.kirkbymicrowave.co.uk/menu.php");
?> 

No need to worry about levels.

And simplify your directory structure:

https://www.kirkbymicrowave.co.uk/Support/page-screwed-up/

not:

https://www.kirkbymicrowave.co.uk/Support/FAQ/page-screwed-up/

Fewer folders mean less chances of broken links.

As for automated checking, it depends on what editor you are using. I use brakets (for a mac) and it does all this for you.

Edited by fisicx

  • Author

I thought a reference to

include ("https://www.kirkbymicrowave.co.uk/menu.php");

would slow things down, as a DNS lookup needs to be performed, whereas a link to a file is faster.

I am thinking of migrating to WordPress, but have not made my mind up yet. I'm trying to weigh up the advantages vs disadvantages, given most of the content is written. I think if starting a few site from scratch, I would probably not hand-code all the HTML again.

Dave

3 minutes ago, fisicx said:

Keep it really simple:


<?php
include ("https://www.kirkbymicrowave.co.uk/menu.php");
?> 

No need to worry about levels.

I agree on principal, but not all php files should be accessible direct, some should even be kept outside the root for security. 

I normally set a core path and then use absolute paths to other files, this saves relative heartache during development or moving files. This can be done in a few ways, normally this would work fine (on most hosts I've tried) and where you store the include file would be outside the root. So structure assuming 'Site' is the host root.

Capture.PNG.7f535bedd16f539fb6b1031a5078d807.PNG

Then in the core.php file;

<?php
$main_path = "/var/sites/y/yoursite.co.uk";
$public_path = $main_path . "/public_html";
?>

In a public page you can add this right at the start;

<?php include("/var/sites/y/yoursite.co.uk/inc/core.php"); ?>

So now in any file you can access either a secure file or public file with ease, like the menu;

<?php include($public_path."/menu.php"); ?>

Now everything would be root down, so absolute rather than relative. Also means you can store all you database connects etc outside the public root.

Even better than my suggestion.

Certainly avoid using ../../ wherever possible

@drkirkby what is your objection to using a CMS? It will make your life so much simpler and you will be able to include things like a site search - a useful feature for a service like yours.

Moving your content to WordPress or any other CMS is a doddle. Wordpress offers all sorts of tools to help you with this. Copy all your content to excel, save as a CSV and use something like this: https://wordpress.org/plugins/wp-ultimate-csv-importer/

Edited by fisicx

PS: you will get lots of people telling you not to use plugins. But in this case you will only use it once then uninstall so it's not going to be an issue.

  • Author

@fisick I don't really object to a CMS. It is just weighing  up the time spent to learn it, or the cost to pay someone else to do the work. I'd rather spend the time myself, to save money, but also the skills I can use on another site.  I have in fact bought a book on WordPress, but have not opened it.

I also bought a couple of books on SEO, which I have started reading.

Dave

You don't really need a book on WordPress.

Here's a simple example of how a menu works.

  1. Login to your dashboard (admin area).
  2. Go to Appearance > Menus
  3. Create a menu by giving it a name (eg: main).
  4. Select which pages you want in the menu from the list of pages.
  5. Drag and drop to reorder. Drag to the right to create a sub-menu item (for a drop down)
  6. Save the menu.

That's is. nothing else to do. Wordpress will display this menu on every page.

The style of the menu is determined by the theme.

If you switch themes the menu still exists, you just need to tell the theme which menu to put where.

  • Author

I'm sure it would take me many days of work to get the website "right".

 

Dave

Trust me on this. If you have the content you will be able to publish a working wordpress site in a few hours. The key to the website is the content and how it is organised. The layout for a service like yours is almost irrelevant. All you need to do is pick one of the thousands of free themes and let wordpress do all the complicated bit for you.

You don't even need to worry about links - you can fix all these in seconds.

Don't worry about the site being 'right'. Just make sure the content is properly organised and accessible.

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.