mercredi 26 avril 2017

how to hide outputbuffers using javascript inside a php print function

The page in question is constructed in php using a print "" function. example of the construction code is:

include("header.php");
Print("
 . $OutputBuffers[$OUTPUT_HEADING]
 . "<br /> some text and other html"
 . $OutputBuffers[$OUTPUT_SUMMARY]
 . "<br /> other html elements..."

and also for responsive html purposes i also use codes such as

. "</td><script type='text/javascript'>
            if (window.screen.width < 800) {document.write('</tr><tr>');}
        </script>"

to change horizontal tables to vertical tables and also <div hidden='true'> etc to hide other html page elements for the same responsive purposes.

I have successfully used these methods to move different print outputs ie . $OutputBuffers[$OUTPUT_ELEMENTS] around page however when I try to hide php outputbuffers using responsive javascript code It fails.

One solution I tried was using document.write('<div hidden='true'>'); but because its in side a set of "" already it totally screws up code. because the closing ' in div hidden='true' ends javascript document.write early. and I can't use
any suggestions on how to hide an $outputbuffer using a htm wrap around code of sorts? example:

 `. "</td><script type='text/javascript'>
        if (window.screen.width < 800) {document.write(' some html code');}
    </script>"
    . $OutputBuffers[$OUTPUT_ELEMENT_TO_HIDE]
    . "</td><script type='text/javascript'>
        if (window.screen.width < 800) {document.write('some html code');}
      </script>"`

Any suggestions on a method to simply hide or show an $output_element depending on device screen size I'm up for all suggestions, however it will be used within a php print"" function so can't use " " within ' ' or ' ' within another set of ' ' will not work as far as I know.




Aucun commentaire:

Enregistrer un commentaire