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.

Updating a single element on multiple pages

Featured Replies

I'm working on a set of pages (well, one so far) that will act as an archive for a website. On each page there'll be drop-down list where a user can select from a set of months (each being a separate page).

 

As time goes on I'll need to add to that drop-down list - how can I do so without having to update each page individually?

 

In a previous version of the site I inserted it into a page that I made as a Dreamweaver template and updated it from that - is that the best method or is there a better way?

 

The page

  • Author

Thanks Logic!

I include the PHP code in a separate file and link it to my PHP but in doing that I get 15 W3C Validator errors that I don't know how to sort.

 

The page

 

 

  1. error.png Line 132, Column 121: Stray doctype.
    ….0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

  2. error.png Line 133, Column 43: Stray start tag html.
    <html xmlns="http://www.w3.org/1999/xhtml">

  3. error.png Line 134, Column 6: Stray start tag head.
    <head>

  4. error.png Line 135, Column 69: Attribute http-equiv not allowed on element meta at this point.
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  5. error.png Line 135, Column 69: Element meta is missing one or more of the following attributes: itemprop, property.
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  6. error.png Line 136, Column 7: Element title not allowed as child of element div in this context. (Suppressing further errors from this subtree.)
    <title>Untitled Document</title>
    Contexts in which element title may be used: In a head element containing no other title elements. Content model for element div: Flow content.
  7. error.png Line 137, Column 88: Element link is missing required attribute property.
    …="stylesheet" type="text/css" href="css/newssheetarchive.css" media="screen" />
    Attributes for element link: Global attributes href crossorigin rel media hreflang type sizes Also, the title attribute has special semantics on this element.
  8. error.png Line 138, Column 7: Stray end tag head.
    </head>

  9. error.png Line 140, Column 6: An body start tag seen but an element of the same type was already open.
    <body>

  10. error.png Line 178, Column 7: End tag for body seen, but there were unclosed elements.
    </body>

  11. error.png Line 120, Column 25: Unclosed element div.
    <div class="bodywrapper">

  12. error.png Line 98, Column 21: Unclosed element div.
    <div class="wrapper">

  13. error.png Line 96, Column 19: Unclosed element div.
    <div id="main-div">

  14. error.png Line 180, Column 25: Stray start tag div.
    <div class="listwrapper">

  15. error.png Line 180, Column 25: Cannot recover after last error. Any further errors will be ignored.
    <div class="listwrapper">

Edited by Demonolith

You should not include a full html file with doctype declaration <head> <body> and all that. You already have that in your main document. Thats probably why you get these errors. The included document should only contain markup for the particular element(s) you want to include.

Edited by Nillervision

  • Author

I see what you mean when I click 'View page source' in Chrome, but I don't see that in Dreamweaver and therefore can't edit it.

Instead I have the following line of code:

<?php include("css/monthlist.php"); ?>

 

I see what you mean when I click 'View page source' in Chrome, but I don't see that in Dreamweaver and therefore can't edit it.

 

Instead I have the following line of code:

<?php include("css/monthlist.php"); ?>

No code editor will not show you the php generated markup as HTML I would be wierd if it did. What do you mean you cant edit it? Can't you just open the included file and edit that one so that it only contains the markup you need to include.

  • Author

Never mind - I just realised that I needed to remove DOCTYPE etc. from monthlist.php.

 

Sorry and thank you!

Edited by Demonolith

One small issue.

 

You are using text in all capitals in various places such as:

<div class="mainsidebarbtn">LATEST UPDATES</div>

Some time ago it was pointed out on another forum that some screen readers when they come across text in all capitals will spell it out letter by letter as if it were an acronym like CIA, FBI or OECD.

 

To get around this for accessibility write the text in lower case and apply a class to transform the text to uppercase

<div class="mainsidebarbtn upper">latest updates</div>

Then use:

.upper {
text-transform:uppercase;
}

Alternatively use the following with the CSS

<div class="mainsidebarbtn upper">Latest Updates</div>

This means you have the option to display with all capitals or only first letter capitals by simply commenting out the CSS

incidentally i would suggest using a better photo than the current one - it's good that at least it was taken in fairly good light and with a blue sky (though the clouds are a bit grey :) ) but the road, scrubby plants and rusting barrier are not welcome. neither is the green fence that distances the user from the church (church hall??)

 

also the background is a bit bright - maybe one of these styles??

http://gekkoweb.com/stuff/greencastle2.jpg

or http://gekkoweb.com/stuff/greencastle1.jpg ;)

  • Author

One small issue.

 

Do you mean make it all lower-case, including the first letter?

 

I had considered using that method, but decided not to as surnames beginning with 'Mc' which require a lower-case C would be an issue. You're reasoning is making me reconsider though.

 

 

incidentally i would suggest using a better photo than the current one - it's good that at least it was taken in fairly good light and with a blue sky (though the clouds are a bit grey :) ) but the road, scrubby plants and rusting barrier are not welcome. neither is the green fence that distances the user from the church (church hall??)

 

also the background is a bit bright - maybe one of these styles??

http://gekkoweb.com/stuff/greencastle2.jpg

or http://gekkoweb.com/stuff/greencastle1.jpg ;)

 

Ha ha, not to worry - the photo is just acting as a placeholder while I take better shots (I aim to use different photos of the churches, one for each page on the site - that photo is in fact of the local school).

 

I quite like the bright background, but I'm definitely open to opinions!

Edited by Demonolith

 

Do you mean make it all lower-case, including the first letter?

 

I had considered using that method, but decided not to as surnames beginning with 'Mc' which require a lower-case C would be an issue. You're reasoning is making me reconsider though.

 

As far as I'm aware most western screen readers will recognise constructs like Mc. However acronyms are different. Does NEWS mean news in uppercase or does it refer to the North East Whelk Society.

 

All lowercase would do and then certain words could be targeted wit the first-letter selector.

 

Personally I felt it was a little short sighted on the part of the W3C to deprecate the <acronym> tag in HTML5, there is the <abbr> tag which covers this but an abbreviation and an acronym are not quite the same thing.

 

If I'd told my junior school English teacher an acronym and an abbreviation were the same she would have administered six of the best. Without any abbreviation. :)

  • Author

Thanks nfc212 and Fuzzy Logic - I'll keep that in mind and make those changes.

 

The drop-down list doesn't appear to be working on all but one of the pages. One the main news sheet page it works fine, but on all others I can't navigate (i.e. the links do nothing when clicked).

 

I've placed all but the main news sheet page in subfolders so I guess that may be the issue, but how can I solve it?

<?php include("http://www.nialldevlin.com/css/monthlist.php"); ?>
<div class="monthlist">
<form>
  <select name="select" onchange="JumpToIt(this)">
    <option value="None">Select a month from the archive</option>
    <option value="http://www.nialldevlin.com/newssheetarchive/2014/july-september.php">July to September, 2014</option>
    <option value="http://www.nialldevlin.com/newssheetarchive/2014/april-june.php">April to June, 2014</option>
    <option value="http://www.nialldevlin.com/newssheetarchive/2014/january-march.php">January to March, 2014</option>
    <option value="http://www.nialldevlin.com/newssheetarchive/2013/october-december.php">October to December, 2013</option>
    <option value="http://www.nialldevlin.com/newssheetarchive/2013/july-september.php">July to September, 2013</option>
    <option value="http://www.nialldevlin.com/newssheetarchive/2013/april-june.php">April to June, 2013</option>
    <option value="http://www.nialldevlin.com/newssheetarchive/2013/january-march.php">January to March, 2013</option>
    <option value="http://www.nialldevlin.com/newssheetarchive/2012/october-december.php">October to December, 2012</option>
    <option value="http://www.nialldevlin.com/newssheetarchive/2012/july-september.php">July to September, 2012</option>
    <option value="http://www.nialldevlin.com/newssheetarchive/2012/april-june.php">April to June, 2012</option>
    <option value="http://www.nialldevlin.com/newssheetarchive/2012/january-march.php">January to March, 2012</option>
    <option value="http://www.nialldevlin.com/newssheetarchive/2011/october-december.php">October to December, 2011</option>
    <option value="http://www.nialldevlin.com/newssheetarchive/2011/july-september.php">July to September, 2011</option>
    <option value="http://www.nialldevlin.com/newssheetarchive/2011/april-june.php">April to June, 2011</option>
    <option value="http://www.nialldevlin.com/newssheetarchive/2011/january-march.php">January to March, 2011</option>
    <option value="http://www.nialldevlin.com/newssheetarchive/2010/october-december.php">October to December, 2010</option>
    <option value="http://www.nialldevlin.com/newssheetarchive/2010/july-september.php">July to September, 2010</option>
    <option value="http://www.nialldevlin.com/newssheetarchive/2010/april-june.php">April to June, 2010</option>
    <option value="http://www.nialldevlin.com/newssheetarchive/2010/january-march.php">January to March, 2010</option>
    <option value="http://www.nialldevlin.com/newssheetarchive/2009/october-december.php">October to December, 2009</option>
    <option value="http://www.nialldevlin.com/newssheetarchive/2009/july-september.php">July to September, 2009</option>
    <option value="http://www.nialldevlin.com/newssheetarchive/2009/april-june.php">April to June, 2009</option>
    <option value="http://www.nialldevlin.com/newssheetarchive/2009/january-march.php">January to March, 2009</option>
    <option value="http://www.nialldevlin.com/newssheetarchive/2008/october-december.php">October to December, 2008</option>
    <option value="http://www.nialldevlin.com/newssheetarchive/2008/july-september.php">July to September, 2008</option>
    <option value="http://www.nialldevlin.com/newssheetarchive/2008/april-june.php">April to June, 2008</option>
    <option value="http://www.nialldevlin.com/newssheetarchive/2008/january-march.php">January to March, 2008</option>
    <option value="http://www.nialldevlin.com/newssheetarchive/2007/september-december.php">September to December, 2007</option>
  </select>
</form>
</div>

One of the pages withing a subfolder.

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.