This seems like an odd problem. Maybe it’s also the wrong approach. But I have to do this:
- there are a few menu items on a page
- the content for each page is stored in some
.phtmlfiles - when the page loads the default content is displayed (using
require) - all other content should be loaded too and should be stored in a JavaScript-array
- when a user clicks a link, the content is swapped
The problem is:
- AJAX should not be used
- all content can’t be appended in the beginning, for the good old SEO
All parts are easy, except for: How do I get the content into a JavaScript array. Something like content.push('<?php print require 'page.phtml'; ?>'); won’t work of course, because it will return a multi line string, which does not work with JavaScript. All ideas are welcome. Maybe I’m overlooking something very simple.
if there is no php code in your
page.phtmlfile you can make it even easierobviously you can use it in this way too:
why not function