TOT: HTML/css trick to selectively display parts of page

Seconded, PHP provides great flexibility

I maintain a site with over 100, mainly static, pages. Every page starts with a require() function call to load all the standard HTML headers, title blocks and menu and ends with another require() to generate standard footer data and insert the final the and tags. If I need to modify the menus I only need to update a single file for the change to be implemented across the entire site.

The small number of dynamic pages are created from a MySQL database using PHP's MySQL extensions.

There's excellent documentation for PHP at

Reply to
Mike Clarke
Loading thread data ...

Bur there is a risk that your data might not get indexed by the search engines if it's buried deep inside complex javascript.

Javascript could also create problems for people using things like screen reader software for the visually impaired.

If your pages utilize javascript you need to put sufficient effort into ensuring that things degrade gracefully when javascript isn't used. A good way of testing this is with the lynx text-only browser.

Reply to
Mike Clarke

as the way frames were implemented was by pixel size, not by size_of_contents.

Particularly a problem with the second example as there's no frame boundary to grab to resize them.

JGH

Reply to
jgharston

Mike Clarke ( snipped-for-privacy@milibyte.co.uk) wibbled on Thursday 03 February 2011

10:48:

That's solvable (easily) if you use JS/CSS to "add value".

The usual approach is make your page render cleanly, menus as list (nested if needs be) and surround text with div or span blocks with IDs.

So, worst case scenario, browser sees whole page cleanly - and so does Google so indexing works fine.

Now use the CSS and/or JS to mark various blocks as no-display - job done.

The excercise should not involve much JS.

Cheers

Tim

Reply to
Tim Watts

I wouldn't recommend putting *content* in the JavaScript.

Do you have any specific experience to relate?

Agreed, but you can achieve the same effect more simply by turning off JavaScript (and css) in a mainstream browser.

Reply to
Mike Barnes

Using macros? ;-)

I have done stuff like that in the past using Perl, and could probably hack it in that or [ba]sh these days. I have some one-liners I copy'n'paste onto the command line for semi-automating some web page generation tasks, but you just can't get the Tuits these days for a proper script-based system.

Reply to
John Stumbles

I've got this peecee with a keyboard and I type stuff like blah blah into a text file and ... :-)

...

That sounds like the biz. Unfortunately my knowledge of js is even more minimal than needed to do this. Any pointers? (Pretty please ;-))

Reply to
John Stumbles

As John says, if you were using something like Dreamweaver, what you want to do is built in. It is not cheap to buy new, but Dreamweaver MX does crop up second hand on eBay and will still do templates.

Colin Bignell

Reply to
Nightjar

Didn't need macros for that one, but you can now see how I'd process them...!

I use REXX.

Reply to
Bob Eager

I'm somewhat surprised ML/1 still lives...

(It *is* a '1', isn't it? I've always pronounced it "Emm Ell One".)

Reply to
Huge

Well that's one way of doing it ;-)

A simple example would be something like:

function showMe() { document.getElementById("sectionid").style.visibility = "visible" ; }

Click the link...

Change

Hello World

Or for a posher version using spry to give a tabbed panel style control:

Tab panel demo

Name of tab 1 Name of tab 2

Content of tab one Content of tab two

(you can have as many as you want)

You will need a dir called SpryAssets with SpryTabbedPanels.cc and .js in it for the above to work, you can download the full spry setup from adobe here:

formatting link
just grab those files from:

formatting link

Reply to
John Rumm

John Stumbles ( snipped-for-privacy@ntlworld.com) wibbled on Thursday 03 February

2011 15:28:

Good man. Have you tried HTML::Embperl or HTML::Mason ?

Reply to
Tim Watts

ML/I (Roman 'one'). And yes, it's "Emm Ell One".

I get a surprising number of enquiries for a 44 year old program! That's why I did the website - it saves me time in the end.

Reply to
Bob Eager

No direct experience but I remember reading advice to this affect and I'm quite prepared to accept the possibility. So I always try to restrict javascript to adding value rather than being an essential component.

Reply to
Mike Clarke

If you can get a cheap old version, (might need to be CS now) you can get a legit upgrade to the latest for about £150 normally.

(CS4 is much better setup for doing everything the CSS way)

Reply to
John Rumm

Indeed... also handy for folks running the NoScript addon for firfox/chrome/seamonkey etc.

Doing stuff like making all sections visible by default in the HTML, and then hiding them on initial display with the JS will make it fail "safe".

Reply to
John Rumm

Are frames deprecated ? Well, you can use iframes instead. They are quite nifty. Simon.

Reply to
sm_jamieson

No. What do they do (in an arm-waving sort of way rather than a 'man' sort of way :-)) ?

Reply to
John Stumbles

John Stumbles ( snipped-for-privacy@ntlworld.com) wibbled on Friday 04 February

2011 00:51:

Same as PHP except you get to use perl.

Context of a srved document is plain (text, HTML, CSS, whatever) by default until the server hits magic delimeters such as perl stuff

I use mine in a slightly more complicated template way to auto wrap header and footer stuff around a bare content .html file (which can still have HTML::Mason directives) - but you don;t need to - you can just include other files where you want.

I've found it very solid and although I've done PHP, I find perl a much better language IMO. Let the holy wars begin...

PHP does have the advantage of excellent documentation, but HTML::Mason is pretty decent and it is small because it does one thing - that is deal with the embedding and a bit of context management. The rest is pure perl.

Can be run in CGI context which makes it more hostable by generic hosting companies.

Reply to
Tim Watts

Tim Watts :

Is that available on your everyday shared hosting account or does it need anything special?

Reply to
Mike Barnes

HomeOwnersHub website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.